diff --git a/CHANGELOG.md b/CHANGELOG.md index 33450b7b69ae..83baddc63c48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # CHANGELOG +## `v63.4.0` + +### New Packages + +- `github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice` +- `github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network` +- `github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice` +- `github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations` + +### Updated Packages + +| Package Path | Changelog | +| :--- | :---: | +| `github.com/Azure/azure-sdk-for-go/services/preview/synapse/mgmt/v2.0/synapse` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/synapse/mgmt/v2.0/synapse/CHANGELOG.md) | + ## `v63.3.0` ### New Packages @@ -10,7 +25,7 @@ | Package Path | Changelog | | :--- | :---: | -| `github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice` | [details](https://github.com/Azure/azure-sdk-for-go/tree/main/services/preview/botservice/mgmt/2021-05-01-preview/botservice/CHANGELOG.md) | +| `github.com/Azure/azure-sdk-for-go/services/preview/botservice/mgmt/2021-05-01-preview/botservice` | [details](https://github.com/Azure/azure-sdk-for-go/blob/v63.3.0/services/preview/botservice/mgmt/2021-05-01-preview/botservice/CHANGELOG.md) | ## `v63.2.0` diff --git a/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go b/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go index 75d5ad40ed94..20628c171912 100644 --- a/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go +++ b/profiles/latest/containerservice/mgmt/containerservice/containerserviceapi/models.go @@ -9,7 +9,7 @@ package containerserviceapi -import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-02-01/containerservice/containerserviceapi" +import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice/containerserviceapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type MaintenanceConfigurationsClientAPI = original.MaintenanceConfigurationsClientAPI diff --git a/profiles/latest/containerservice/mgmt/containerservice/models.go b/profiles/latest/containerservice/mgmt/containerservice/models.go index 94a3acb7ee55..40d5c02936ef 100644 --- a/profiles/latest/containerservice/mgmt/containerservice/models.go +++ b/profiles/latest/containerservice/mgmt/containerservice/models.go @@ -12,7 +12,7 @@ package containerservice import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-02-01/containerservice" + original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice" ) const ( @@ -473,6 +473,7 @@ type AgentPoolsClient = original.AgentPoolsClient type AgentPoolsCreateOrUpdateFuture = original.AgentPoolsCreateOrUpdateFuture type AgentPoolsDeleteFuture = original.AgentPoolsDeleteFuture type AgentPoolsUpgradeNodeImageVersionFuture = original.AgentPoolsUpgradeNodeImageVersionFuture +type AzureEntityResource = original.AzureEntityResource type BaseClient = original.BaseClient type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody @@ -528,6 +529,10 @@ type ManagedClusterSKU = original.ManagedClusterSKU type ManagedClusterSecurityProfile = original.ManagedClusterSecurityProfile type ManagedClusterSecurityProfileAzureDefender = original.ManagedClusterSecurityProfileAzureDefender type ManagedClusterServicePrincipalProfile = original.ManagedClusterServicePrincipalProfile +type ManagedClusterStorageProfile = original.ManagedClusterStorageProfile +type ManagedClusterStorageProfileDiskCSIDriver = original.ManagedClusterStorageProfileDiskCSIDriver +type ManagedClusterStorageProfileFileCSIDriver = original.ManagedClusterStorageProfileFileCSIDriver +type ManagedClusterStorageProfileSnapshotController = original.ManagedClusterStorageProfileSnapshotController type ManagedClusterUpgradeProfile = original.ManagedClusterUpgradeProfile type ManagedClusterUpgradeProfileProperties = original.ManagedClusterUpgradeProfileProperties type ManagedClusterWindowsProfile = original.ManagedClusterWindowsProfile @@ -565,6 +570,7 @@ type PrivateLinkResource = original.PrivateLinkResource type PrivateLinkResourcesClient = original.PrivateLinkResourcesClient type PrivateLinkResourcesListResult = original.PrivateLinkResourcesListResult type PrivateLinkServiceConnectionState = original.PrivateLinkServiceConnectionState +type ProxyResource = original.ProxyResource type ResolvePrivateLinkServiceIDClient = original.ResolvePrivateLinkServiceIDClient type Resource = original.Resource type ResourceReference = original.ResourceReference @@ -584,6 +590,7 @@ type SystemData = original.SystemData type TagsObject = original.TagsObject type TimeInWeek = original.TimeInWeek type TimeSpan = original.TimeSpan +type TrackedResource = original.TrackedResource type UserAssignedIdentity = original.UserAssignedIdentity type VMDiagnostics = original.VMDiagnostics type WindowsGmsaProfile = original.WindowsGmsaProfile diff --git a/profiles/latest/network/mgmt/network/models.go b/profiles/latest/network/mgmt/network/models.go index 0335fb919e38..c58d7e2705cd 100644 --- a/profiles/latest/network/mgmt/network/models.go +++ b/profiles/latest/network/mgmt/network/models.go @@ -12,7 +12,7 @@ package network import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network" + original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" ) const ( @@ -79,6 +79,8 @@ type ApplicationGatewayProtocol = original.ApplicationGatewayProtocol const ( ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = original.ApplicationGatewayProtocolHTTP ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = original.ApplicationGatewayProtocolHTTPS + ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = original.ApplicationGatewayProtocolTCP + ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = original.ApplicationGatewayProtocolTLS ) type ApplicationGatewayRedirectType = original.ApplicationGatewayRedirectType @@ -533,6 +535,13 @@ const ( ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = original.ExpressRoutePeeringTypeMicrosoftPeering ) +type ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatus + +const ( + ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatusAvailable + ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatusInUse +) + type ExpressRoutePortsEncapsulation = original.ExpressRoutePortsEncapsulation const ( @@ -553,6 +562,13 @@ const ( FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = original.FirewallPolicyFilterRuleCollectionActionTypeDeny ) +type FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrder + +const ( + FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrderAscending + FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrderDescending +) + type FirewallPolicyIntrusionDetectionProtocol = original.FirewallPolicyIntrusionDetectionProtocol const ( @@ -644,6 +660,14 @@ const ( HubBgpConnectionStatusUnknown HubBgpConnectionStatus = original.HubBgpConnectionStatusUnknown ) +type HubRoutingPreference = original.HubRoutingPreference + +const ( + HubRoutingPreferenceASPath HubRoutingPreference = original.HubRoutingPreferenceASPath + HubRoutingPreferenceExpressRoute HubRoutingPreference = original.HubRoutingPreferenceExpressRoute + HubRoutingPreferenceVpnGateway HubRoutingPreference = original.HubRoutingPreferenceVpnGateway +) + type HubVirtualNetworkConnectionStatus = original.HubVirtualNetworkConnectionStatus const ( @@ -711,6 +735,14 @@ const ( InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = original.InboundSecurityRulesProtocolUDP ) +type InterfaceAuxiliaryMode = original.InterfaceAuxiliaryMode + +const ( + InterfaceAuxiliaryModeFloating InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeFloating + InterfaceAuxiliaryModeMaxConnections InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeMaxConnections + InterfaceAuxiliaryModeNone InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeNone +) + type InterfaceMigrationPhase = original.InterfaceMigrationPhase const ( @@ -767,6 +799,15 @@ const ( IssueTypeUserDefinedRoute IssueType = original.IssueTypeUserDefinedRoute ) +type LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminState + +const ( + LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateDown + LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateDrain + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateNone + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateUp +) + type LoadBalancerOutboundRuleProtocol = original.LoadBalancerOutboundRuleProtocol const ( @@ -838,13 +879,6 @@ const ( OperationStatusSucceeded OperationStatus = original.OperationStatusSucceeded ) -type Order = original.Order - -const ( - OrderAscending Order = original.OrderAscending - OrderDescending Order = original.OrderDescending -) - type Origin = original.Origin const ( @@ -1350,6 +1384,14 @@ const ( VpnNatRuleTypeStatic VpnNatRuleType = original.VpnNatRuleTypeStatic ) +type VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeType + +const ( + VpnPolicyMemberAttributeTypeAADGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeAADGroupID + VpnPolicyMemberAttributeTypeCertificateGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeCertificateGroupID + VpnPolicyMemberAttributeTypeRadiusAzureGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeRadiusAzureGroupID +) + type VpnType = original.VpnType const ( @@ -1459,6 +1501,8 @@ type ApplicationGatewayBackendHealthHTTPSettings = original.ApplicationGatewayBa type ApplicationGatewayBackendHealthOnDemand = original.ApplicationGatewayBackendHealthOnDemand type ApplicationGatewayBackendHealthPool = original.ApplicationGatewayBackendHealthPool type ApplicationGatewayBackendHealthServer = original.ApplicationGatewayBackendHealthServer +type ApplicationGatewayBackendSettings = original.ApplicationGatewayBackendSettings +type ApplicationGatewayBackendSettingsPropertiesFormat = original.ApplicationGatewayBackendSettingsPropertiesFormat type ApplicationGatewayClientAuthConfiguration = original.ApplicationGatewayClientAuthConfiguration type ApplicationGatewayConnectionDraining = original.ApplicationGatewayConnectionDraining type ApplicationGatewayCustomError = original.ApplicationGatewayCustomError @@ -1481,6 +1525,8 @@ type ApplicationGatewayIPConfigurationPropertiesFormat = original.ApplicationGat type ApplicationGatewayListResult = original.ApplicationGatewayListResult type ApplicationGatewayListResultIterator = original.ApplicationGatewayListResultIterator type ApplicationGatewayListResultPage = original.ApplicationGatewayListResultPage +type ApplicationGatewayListener = original.ApplicationGatewayListener +type ApplicationGatewayListenerPropertiesFormat = original.ApplicationGatewayListenerPropertiesFormat type ApplicationGatewayLoadDistributionPolicy = original.ApplicationGatewayLoadDistributionPolicy type ApplicationGatewayLoadDistributionPolicyPropertiesFormat = original.ApplicationGatewayLoadDistributionPolicyPropertiesFormat type ApplicationGatewayLoadDistributionTarget = original.ApplicationGatewayLoadDistributionTarget @@ -1519,6 +1565,8 @@ type ApplicationGatewayRewriteRuleActionSet = original.ApplicationGatewayRewrite type ApplicationGatewayRewriteRuleCondition = original.ApplicationGatewayRewriteRuleCondition type ApplicationGatewayRewriteRuleSet = original.ApplicationGatewayRewriteRuleSet type ApplicationGatewayRewriteRuleSetPropertiesFormat = original.ApplicationGatewayRewriteRuleSetPropertiesFormat +type ApplicationGatewayRoutingRule = original.ApplicationGatewayRoutingRule +type ApplicationGatewayRoutingRulePropertiesFormat = original.ApplicationGatewayRoutingRulePropertiesFormat type ApplicationGatewaySku = original.ApplicationGatewaySku type ApplicationGatewaySslCertificate = original.ApplicationGatewaySslCertificate type ApplicationGatewaySslCertificatePropertiesFormat = original.ApplicationGatewaySslCertificatePropertiesFormat @@ -1675,6 +1723,9 @@ type ConfigurationDiagnosticParameters = original.ConfigurationDiagnosticParamet type ConfigurationDiagnosticProfile = original.ConfigurationDiagnosticProfile type ConfigurationDiagnosticResponse = original.ConfigurationDiagnosticResponse type ConfigurationDiagnosticResult = original.ConfigurationDiagnosticResult +type ConfigurationPolicyGroupsClient = original.ConfigurationPolicyGroupsClient +type ConfigurationPolicyGroupsCreateOrUpdateFuture = original.ConfigurationPolicyGroupsCreateOrUpdateFuture +type ConfigurationPolicyGroupsDeleteFuture = original.ConfigurationPolicyGroupsDeleteFuture type ConnectionMonitor = original.ConnectionMonitor type ConnectionMonitorDestination = original.ConnectionMonitorDestination type ConnectionMonitorEndpoint = original.ConnectionMonitorEndpoint @@ -1863,6 +1914,14 @@ type ExpressRouteLinkMacSecConfig = original.ExpressRouteLinkMacSecConfig type ExpressRouteLinkPropertiesFormat = original.ExpressRouteLinkPropertiesFormat type ExpressRouteLinksClient = original.ExpressRouteLinksClient type ExpressRoutePort = original.ExpressRoutePort +type ExpressRoutePortAuthorization = original.ExpressRoutePortAuthorization +type ExpressRoutePortAuthorizationListResult = original.ExpressRoutePortAuthorizationListResult +type ExpressRoutePortAuthorizationListResultIterator = original.ExpressRoutePortAuthorizationListResultIterator +type ExpressRoutePortAuthorizationListResultPage = original.ExpressRoutePortAuthorizationListResultPage +type ExpressRoutePortAuthorizationPropertiesFormat = original.ExpressRoutePortAuthorizationPropertiesFormat +type ExpressRoutePortAuthorizationsClient = original.ExpressRoutePortAuthorizationsClient +type ExpressRoutePortAuthorizationsCreateOrUpdateFuture = original.ExpressRoutePortAuthorizationsCreateOrUpdateFuture +type ExpressRoutePortAuthorizationsDeleteFuture = original.ExpressRoutePortAuthorizationsDeleteFuture type ExpressRoutePortListResult = original.ExpressRoutePortListResult type ExpressRoutePortListResultIterator = original.ExpressRoutePortListResultIterator type ExpressRoutePortListResultPage = original.ExpressRoutePortListResultPage @@ -1939,6 +1998,7 @@ type FlowLogsCreateOrUpdateFuture = original.FlowLogsCreateOrUpdateFuture type FlowLogsDeleteFuture = original.FlowLogsDeleteFuture type FrontendIPConfiguration = original.FrontendIPConfiguration type FrontendIPConfigurationPropertiesFormat = original.FrontendIPConfigurationPropertiesFormat +type GatewayCustomBgpIPAddressIPConfiguration = original.GatewayCustomBgpIPAddressIPConfiguration type GatewayLoadBalancerTunnelInterface = original.GatewayLoadBalancerTunnelInterface type GatewayRoute = original.GatewayRoute type GatewayRouteListResult = original.GatewayRouteListResult @@ -2083,6 +2143,9 @@ type ListVpnGatewayNatRulesResultPage = original.ListVpnGatewayNatRulesResultPag type ListVpnGatewaysResult = original.ListVpnGatewaysResult type ListVpnGatewaysResultIterator = original.ListVpnGatewaysResultIterator type ListVpnGatewaysResultPage = original.ListVpnGatewaysResultPage +type ListVpnServerConfigurationPolicyGroupsResult = original.ListVpnServerConfigurationPolicyGroupsResult +type ListVpnServerConfigurationPolicyGroupsResultIterator = original.ListVpnServerConfigurationPolicyGroupsResultIterator +type ListVpnServerConfigurationPolicyGroupsResultPage = original.ListVpnServerConfigurationPolicyGroupsResultPage type ListVpnServerConfigurationsResult = original.ListVpnServerConfigurationsResult type ListVpnServerConfigurationsResultIterator = original.ListVpnServerConfigurationsResultIterator type ListVpnServerConfigurationsResultPage = original.ListVpnServerConfigurationsResultPage @@ -2674,6 +2737,9 @@ type VpnServerConfigRadiusServerRootCertificate = original.VpnServerConfigRadius type VpnServerConfigVpnClientRevokedCertificate = original.VpnServerConfigVpnClientRevokedCertificate type VpnServerConfigVpnClientRootCertificate = original.VpnServerConfigVpnClientRootCertificate type VpnServerConfiguration = original.VpnServerConfiguration +type VpnServerConfigurationPolicyGroup = original.VpnServerConfigurationPolicyGroup +type VpnServerConfigurationPolicyGroupMember = original.VpnServerConfigurationPolicyGroupMember +type VpnServerConfigurationPolicyGroupProperties = original.VpnServerConfigurationPolicyGroupProperties type VpnServerConfigurationProperties = original.VpnServerConfigurationProperties type VpnServerConfigurationsAssociatedWithVirtualWanClient = original.VpnServerConfigurationsAssociatedWithVirtualWanClient type VpnServerConfigurationsAssociatedWithVirtualWanListFuture = original.VpnServerConfigurationsAssociatedWithVirtualWanListFuture @@ -2910,6 +2976,12 @@ func NewBgpServiceCommunityListResultIterator(page BgpServiceCommunityListResult func NewBgpServiceCommunityListResultPage(cur BgpServiceCommunityListResult, getNextPage func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error)) BgpServiceCommunityListResultPage { return original.NewBgpServiceCommunityListResultPage(cur, getNextPage) } +func NewConfigurationPolicyGroupsClient(subscriptionID string) ConfigurationPolicyGroupsClient { + return original.NewConfigurationPolicyGroupsClient(subscriptionID) +} +func NewConfigurationPolicyGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationPolicyGroupsClient { + return original.NewConfigurationPolicyGroupsClientWithBaseURI(baseURI, subscriptionID) +} func NewConnectionMonitorsClient(subscriptionID string) ConnectionMonitorsClient { return original.NewConnectionMonitorsClient(subscriptionID) } @@ -3060,6 +3132,18 @@ func NewExpressRouteLinksClient(subscriptionID string) ExpressRouteLinksClient { func NewExpressRouteLinksClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteLinksClient { return original.NewExpressRouteLinksClientWithBaseURI(baseURI, subscriptionID) } +func NewExpressRoutePortAuthorizationListResultIterator(page ExpressRoutePortAuthorizationListResultPage) ExpressRoutePortAuthorizationListResultIterator { + return original.NewExpressRoutePortAuthorizationListResultIterator(page) +} +func NewExpressRoutePortAuthorizationListResultPage(cur ExpressRoutePortAuthorizationListResult, getNextPage func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error)) ExpressRoutePortAuthorizationListResultPage { + return original.NewExpressRoutePortAuthorizationListResultPage(cur, getNextPage) +} +func NewExpressRoutePortAuthorizationsClient(subscriptionID string) ExpressRoutePortAuthorizationsClient { + return original.NewExpressRoutePortAuthorizationsClient(subscriptionID) +} +func NewExpressRoutePortAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRoutePortAuthorizationsClient { + return original.NewExpressRoutePortAuthorizationsClientWithBaseURI(baseURI, subscriptionID) +} func NewExpressRoutePortListResultIterator(page ExpressRoutePortListResultPage) ExpressRoutePortListResultIterator { return original.NewExpressRoutePortListResultIterator(page) } @@ -3330,6 +3414,12 @@ func NewListVpnGatewaysResultIterator(page ListVpnGatewaysResultPage) ListVpnGat func NewListVpnGatewaysResultPage(cur ListVpnGatewaysResult, getNextPage func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error)) ListVpnGatewaysResultPage { return original.NewListVpnGatewaysResultPage(cur, getNextPage) } +func NewListVpnServerConfigurationPolicyGroupsResultIterator(page ListVpnServerConfigurationPolicyGroupsResultPage) ListVpnServerConfigurationPolicyGroupsResultIterator { + return original.NewListVpnServerConfigurationPolicyGroupsResultIterator(page) +} +func NewListVpnServerConfigurationPolicyGroupsResultPage(cur ListVpnServerConfigurationPolicyGroupsResult, getNextPage func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error)) ListVpnServerConfigurationPolicyGroupsResultPage { + return original.NewListVpnServerConfigurationPolicyGroupsResultPage(cur, getNextPage) +} func NewListVpnServerConfigurationsResultIterator(page ListVpnServerConfigurationsResultPage) ListVpnServerConfigurationsResultIterator { return original.NewListVpnServerConfigurationsResultIterator(page) } @@ -4182,6 +4272,9 @@ func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { return original.PossibleExpressRoutePeeringTypeValues() } +func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { + return original.PossibleExpressRoutePortAuthorizationUseStatusValues() +} func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { return original.PossibleExpressRoutePortsEncapsulationValues() } @@ -4191,6 +4284,9 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { return original.PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() } +func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { + return original.PossibleFirewallPolicyIDPSQuerySortOrderValues() +} func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { return original.PossibleFirewallPolicyIntrusionDetectionProtocolValues() } @@ -4227,6 +4323,9 @@ func PossibleHTTPMethodValues() []HTTPMethod { func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { return original.PossibleHubBgpConnectionStatusValues() } +func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { + return original.PossibleHubRoutingPreferenceValues() +} func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { return original.PossibleHubVirtualNetworkConnectionStatusValues() } @@ -4251,6 +4350,9 @@ func PossibleIkeIntegrityValues() []IkeIntegrity { func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { return original.PossibleInboundSecurityRulesProtocolValues() } +func PossibleInterfaceAuxiliaryModeValues() []InterfaceAuxiliaryMode { + return original.PossibleInterfaceAuxiliaryModeValues() +} func PossibleInterfaceMigrationPhaseValues() []InterfaceMigrationPhase { return original.PossibleInterfaceMigrationPhaseValues() } @@ -4266,6 +4368,9 @@ func PossibleIpsecIntegrityValues() []IpsecIntegrity { func PossibleIssueTypeValues() []IssueType { return original.PossibleIssueTypeValues() } +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return original.PossibleLoadBalancerBackendAddressAdminStateValues() +} func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { return original.PossibleLoadBalancerOutboundRuleProtocolValues() } @@ -4293,9 +4398,6 @@ func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { func PossibleOperationStatusValues() []OperationStatus { return original.PossibleOperationStatusValues() } -func PossibleOrderValues() []Order { - return original.PossibleOrderValues() -} func PossibleOriginValues() []Origin { return original.PossibleOriginValues() } @@ -4467,6 +4569,9 @@ func PossibleVpnNatRuleModeValues() []VpnNatRuleMode { func PossibleVpnNatRuleTypeValues() []VpnNatRuleType { return original.PossibleVpnNatRuleTypeValues() } +func PossibleVpnPolicyMemberAttributeTypeValues() []VpnPolicyMemberAttributeType { + return original.PossibleVpnPolicyMemberAttributeTypeValues() +} func PossibleVpnTypeValues() []VpnType { return original.PossibleVpnTypeValues() } diff --git a/profiles/latest/network/mgmt/network/networkapi/models.go b/profiles/latest/network/mgmt/network/networkapi/models.go index 64d10d77c541..e3b4b15d8b4b 100644 --- a/profiles/latest/network/mgmt/network/networkapi/models.go +++ b/profiles/latest/network/mgmt/network/networkapi/models.go @@ -9,7 +9,7 @@ package networkapi -import original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network/networkapi" +import original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network/networkapi" type ApplicationGatewayPrivateEndpointConnectionsClientAPI = original.ApplicationGatewayPrivateEndpointConnectionsClientAPI type ApplicationGatewayPrivateLinkResourcesClientAPI = original.ApplicationGatewayPrivateLinkResourcesClientAPI @@ -25,6 +25,7 @@ type AzureFirewallsClientAPI = original.AzureFirewallsClientAPI type BaseClientAPI = original.BaseClientAPI type BastionHostsClientAPI = original.BastionHostsClientAPI type BgpServiceCommunitiesClientAPI = original.BgpServiceCommunitiesClientAPI +type ConfigurationPolicyGroupsClientAPI = original.ConfigurationPolicyGroupsClientAPI type ConnectionMonitorsClientAPI = original.ConnectionMonitorsClientAPI type CustomIPPrefixesClientAPI = original.CustomIPPrefixesClientAPI type DdosCustomPoliciesClientAPI = original.DdosCustomPoliciesClientAPI @@ -40,6 +41,7 @@ type ExpressRouteCrossConnectionPeeringsClientAPI = original.ExpressRouteCrossCo type ExpressRouteCrossConnectionsClientAPI = original.ExpressRouteCrossConnectionsClientAPI type ExpressRouteGatewaysClientAPI = original.ExpressRouteGatewaysClientAPI type ExpressRouteLinksClientAPI = original.ExpressRouteLinksClientAPI +type ExpressRoutePortAuthorizationsClientAPI = original.ExpressRoutePortAuthorizationsClientAPI type ExpressRoutePortsClientAPI = original.ExpressRoutePortsClientAPI type ExpressRoutePortsLocationsClientAPI = original.ExpressRoutePortsLocationsClientAPI type ExpressRouteServiceProvidersClientAPI = original.ExpressRouteServiceProvidersClientAPI diff --git a/profiles/latest/reservations/mgmt/reservations/models.go b/profiles/latest/reservations/mgmt/reservations/models.go index b55cfacebf60..b92e8344b1a9 100644 --- a/profiles/latest/reservations/mgmt/reservations/models.go +++ b/profiles/latest/reservations/mgmt/reservations/models.go @@ -12,7 +12,7 @@ package reservations import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2017-11-01/reservations" + original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations" ) const ( @@ -22,128 +22,146 @@ const ( type AppliedScopeType = original.AppliedScopeType const ( - Shared AppliedScopeType = original.Shared - Single AppliedScopeType = original.Single + AppliedScopeTypeShared AppliedScopeType = original.AppliedScopeTypeShared + AppliedScopeTypeSingle AppliedScopeType = original.AppliedScopeTypeSingle ) -type AppliedScopeType1 = original.AppliedScopeType1 +type CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatus const ( - AppliedScopeType1Shared AppliedScopeType1 = original.AppliedScopeType1Shared - AppliedScopeType1Single AppliedScopeType1 = original.AppliedScopeType1Single + CalculateExchangeOperationResultStatusCancelled CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusCancelled + CalculateExchangeOperationResultStatusFailed CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusFailed + CalculateExchangeOperationResultStatusPending CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusPending + CalculateExchangeOperationResultStatusSucceeded CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusSucceeded ) -type Code = original.Code +type CreatedByType = original.CreatedByType const ( - ActivateQuoteFailed Code = original.ActivateQuoteFailed - AppliedScopesNotAssociatedWithCommerceAccount Code = original.AppliedScopesNotAssociatedWithCommerceAccount - AppliedScopesSameAsExisting Code = original.AppliedScopesSameAsExisting - AuthorizationFailed Code = original.AuthorizationFailed - BadRequest Code = original.BadRequest - BillingCustomerInputError Code = original.BillingCustomerInputError - BillingError Code = original.BillingError - BillingPaymentInstrumentHardError Code = original.BillingPaymentInstrumentHardError - BillingPaymentInstrumentSoftError Code = original.BillingPaymentInstrumentSoftError - BillingScopeIDCannotBeChanged Code = original.BillingScopeIDCannotBeChanged - BillingTransientError Code = original.BillingTransientError - CalculatePriceFailed Code = original.CalculatePriceFailed - CapacityUpdateScopesFailed Code = original.CapacityUpdateScopesFailed - ClientCertificateThumbprintNotSet Code = original.ClientCertificateThumbprintNotSet - CreateQuoteFailed Code = original.CreateQuoteFailed - Forbidden Code = original.Forbidden - FulfillmentConfigurationError Code = original.FulfillmentConfigurationError - FulfillmentError Code = original.FulfillmentError - FulfillmentOutOfStockError Code = original.FulfillmentOutOfStockError - FulfillmentTransientError Code = original.FulfillmentTransientError - HTTPMethodNotSupported Code = original.HTTPMethodNotSupported - InternalServerError Code = original.InternalServerError - InvalidAccessToken Code = original.InvalidAccessToken - InvalidFulfillmentRequestParameters Code = original.InvalidFulfillmentRequestParameters - InvalidHealthCheckType Code = original.InvalidHealthCheckType - InvalidLocationID Code = original.InvalidLocationID - InvalidRefundQuantity Code = original.InvalidRefundQuantity - InvalidRequestContent Code = original.InvalidRequestContent - InvalidRequestURI Code = original.InvalidRequestURI - InvalidReservationID Code = original.InvalidReservationID - InvalidReservationOrderID Code = original.InvalidReservationOrderID - InvalidSingleAppliedScopesCount Code = original.InvalidSingleAppliedScopesCount - InvalidSubscriptionID Code = original.InvalidSubscriptionID - InvalidTenantID Code = original.InvalidTenantID - MissingAppliedScopesForSingle Code = original.MissingAppliedScopesForSingle - MissingTenantID Code = original.MissingTenantID - NonsupportedAccountID Code = original.NonsupportedAccountID - NotSpecified Code = original.NotSpecified - NotSupportedCountry Code = original.NotSupportedCountry - NoValidReservationsToReRate Code = original.NoValidReservationsToReRate - OperationCannotBePerformedInCurrentState Code = original.OperationCannotBePerformedInCurrentState - OperationFailed Code = original.OperationFailed - PaymentInstrumentNotFound Code = original.PaymentInstrumentNotFound - PurchaseError Code = original.PurchaseError - ReRateOnlyAllowedForEA Code = original.ReRateOnlyAllowedForEA - ReservationIDNotInReservationOrder Code = original.ReservationIDNotInReservationOrder - ReservationOrderCreationFailed Code = original.ReservationOrderCreationFailed - ReservationOrderIDAlreadyExists Code = original.ReservationOrderIDAlreadyExists - ReservationOrderNotEnabled Code = original.ReservationOrderNotEnabled - ReservationOrderNotFound Code = original.ReservationOrderNotFound - RiskCheckFailed Code = original.RiskCheckFailed - RoleAssignmentCreationFailed Code = original.RoleAssignmentCreationFailed - ServerTimeout Code = original.ServerTimeout - UnauthenticatedRequestsThrottled Code = original.UnauthenticatedRequestsThrottled - UnsupportedReservationTerm Code = original.UnsupportedReservationTerm + CreatedByTypeApplication CreatedByType = original.CreatedByTypeApplication + CreatedByTypeKey CreatedByType = original.CreatedByTypeKey + CreatedByTypeManagedIdentity CreatedByType = original.CreatedByTypeManagedIdentity + CreatedByTypeUser CreatedByType = original.CreatedByTypeUser +) + +type ErrorResponseCode = original.ErrorResponseCode + +const ( + ErrorResponseCodeActivateQuoteFailed ErrorResponseCode = original.ErrorResponseCodeActivateQuoteFailed + ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount ErrorResponseCode = original.ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount + ErrorResponseCodeAppliedScopesSameAsExisting ErrorResponseCode = original.ErrorResponseCodeAppliedScopesSameAsExisting + ErrorResponseCodeAuthorizationFailed ErrorResponseCode = original.ErrorResponseCodeAuthorizationFailed + ErrorResponseCodeBadRequest ErrorResponseCode = original.ErrorResponseCodeBadRequest + ErrorResponseCodeBillingCustomerInputError ErrorResponseCode = original.ErrorResponseCodeBillingCustomerInputError + ErrorResponseCodeBillingError ErrorResponseCode = original.ErrorResponseCodeBillingError + ErrorResponseCodeBillingPaymentInstrumentHardError ErrorResponseCode = original.ErrorResponseCodeBillingPaymentInstrumentHardError + ErrorResponseCodeBillingPaymentInstrumentSoftError ErrorResponseCode = original.ErrorResponseCodeBillingPaymentInstrumentSoftError + ErrorResponseCodeBillingScopeIDCannotBeChanged ErrorResponseCode = original.ErrorResponseCodeBillingScopeIDCannotBeChanged + ErrorResponseCodeBillingTransientError ErrorResponseCode = original.ErrorResponseCodeBillingTransientError + ErrorResponseCodeCalculatePriceFailed ErrorResponseCode = original.ErrorResponseCodeCalculatePriceFailed + ErrorResponseCodeCapacityUpdateScopesFailed ErrorResponseCode = original.ErrorResponseCodeCapacityUpdateScopesFailed + ErrorResponseCodeClientCertificateThumbprintNotSet ErrorResponseCode = original.ErrorResponseCodeClientCertificateThumbprintNotSet + ErrorResponseCodeCreateQuoteFailed ErrorResponseCode = original.ErrorResponseCodeCreateQuoteFailed + ErrorResponseCodeForbidden ErrorResponseCode = original.ErrorResponseCodeForbidden + ErrorResponseCodeFulfillmentConfigurationError ErrorResponseCode = original.ErrorResponseCodeFulfillmentConfigurationError + ErrorResponseCodeFulfillmentError ErrorResponseCode = original.ErrorResponseCodeFulfillmentError + ErrorResponseCodeFulfillmentOutOfStockError ErrorResponseCode = original.ErrorResponseCodeFulfillmentOutOfStockError + ErrorResponseCodeFulfillmentTransientError ErrorResponseCode = original.ErrorResponseCodeFulfillmentTransientError + ErrorResponseCodeHTTPMethodNotSupported ErrorResponseCode = original.ErrorResponseCodeHTTPMethodNotSupported + ErrorResponseCodeInternalServerError ErrorResponseCode = original.ErrorResponseCodeInternalServerError + ErrorResponseCodeInvalidAccessToken ErrorResponseCode = original.ErrorResponseCodeInvalidAccessToken + ErrorResponseCodeInvalidFulfillmentRequestParameters ErrorResponseCode = original.ErrorResponseCodeInvalidFulfillmentRequestParameters + ErrorResponseCodeInvalidHealthCheckType ErrorResponseCode = original.ErrorResponseCodeInvalidHealthCheckType + ErrorResponseCodeInvalidLocationID ErrorResponseCode = original.ErrorResponseCodeInvalidLocationID + ErrorResponseCodeInvalidRefundQuantity ErrorResponseCode = original.ErrorResponseCodeInvalidRefundQuantity + ErrorResponseCodeInvalidRequestContent ErrorResponseCode = original.ErrorResponseCodeInvalidRequestContent + ErrorResponseCodeInvalidRequestURI ErrorResponseCode = original.ErrorResponseCodeInvalidRequestURI + ErrorResponseCodeInvalidReservationID ErrorResponseCode = original.ErrorResponseCodeInvalidReservationID + ErrorResponseCodeInvalidReservationOrderID ErrorResponseCode = original.ErrorResponseCodeInvalidReservationOrderID + ErrorResponseCodeInvalidSingleAppliedScopesCount ErrorResponseCode = original.ErrorResponseCodeInvalidSingleAppliedScopesCount + ErrorResponseCodeInvalidSubscriptionID ErrorResponseCode = original.ErrorResponseCodeInvalidSubscriptionID + ErrorResponseCodeInvalidTenantID ErrorResponseCode = original.ErrorResponseCodeInvalidTenantID + ErrorResponseCodeMissingAppliedScopesForSingle ErrorResponseCode = original.ErrorResponseCodeMissingAppliedScopesForSingle + ErrorResponseCodeMissingTenantID ErrorResponseCode = original.ErrorResponseCodeMissingTenantID + ErrorResponseCodeNonsupportedAccountID ErrorResponseCode = original.ErrorResponseCodeNonsupportedAccountID + ErrorResponseCodeNotSpecified ErrorResponseCode = original.ErrorResponseCodeNotSpecified + ErrorResponseCodeNotSupportedCountry ErrorResponseCode = original.ErrorResponseCodeNotSupportedCountry + ErrorResponseCodeNoValidReservationsToReRate ErrorResponseCode = original.ErrorResponseCodeNoValidReservationsToReRate + ErrorResponseCodeOperationCannotBePerformedInCurrentState ErrorResponseCode = original.ErrorResponseCodeOperationCannotBePerformedInCurrentState + ErrorResponseCodeOperationFailed ErrorResponseCode = original.ErrorResponseCodeOperationFailed + ErrorResponseCodePatchValuesSameAsExisting ErrorResponseCode = original.ErrorResponseCodePatchValuesSameAsExisting + ErrorResponseCodePaymentInstrumentNotFound ErrorResponseCode = original.ErrorResponseCodePaymentInstrumentNotFound + ErrorResponseCodePurchaseError ErrorResponseCode = original.ErrorResponseCodePurchaseError + ErrorResponseCodeReRateOnlyAllowedForEA ErrorResponseCode = original.ErrorResponseCodeReRateOnlyAllowedForEA + ErrorResponseCodeReservationIDNotInReservationOrder ErrorResponseCode = original.ErrorResponseCodeReservationIDNotInReservationOrder + ErrorResponseCodeReservationOrderCreationFailed ErrorResponseCode = original.ErrorResponseCodeReservationOrderCreationFailed + ErrorResponseCodeReservationOrderIDAlreadyExists ErrorResponseCode = original.ErrorResponseCodeReservationOrderIDAlreadyExists + ErrorResponseCodeReservationOrderNotEnabled ErrorResponseCode = original.ErrorResponseCodeReservationOrderNotEnabled + ErrorResponseCodeReservationOrderNotFound ErrorResponseCode = original.ErrorResponseCodeReservationOrderNotFound + ErrorResponseCodeRiskCheckFailed ErrorResponseCode = original.ErrorResponseCodeRiskCheckFailed + ErrorResponseCodeRoleAssignmentCreationFailed ErrorResponseCode = original.ErrorResponseCodeRoleAssignmentCreationFailed + ErrorResponseCodeServerTimeout ErrorResponseCode = original.ErrorResponseCodeServerTimeout + ErrorResponseCodeUnauthenticatedRequestsThrottled ErrorResponseCode = original.ErrorResponseCodeUnauthenticatedRequestsThrottled + ErrorResponseCodeUnsupportedReservationTerm ErrorResponseCode = original.ErrorResponseCodeUnsupportedReservationTerm +) + +type ExchangeOperationResultStatus = original.ExchangeOperationResultStatus + +const ( + ExchangeOperationResultStatusCancelled ExchangeOperationResultStatus = original.ExchangeOperationResultStatusCancelled + ExchangeOperationResultStatusFailed ExchangeOperationResultStatus = original.ExchangeOperationResultStatusFailed + ExchangeOperationResultStatusPendingPurchases ExchangeOperationResultStatus = original.ExchangeOperationResultStatusPendingPurchases + ExchangeOperationResultStatusPendingRefunds ExchangeOperationResultStatus = original.ExchangeOperationResultStatusPendingRefunds + ExchangeOperationResultStatusSucceeded ExchangeOperationResultStatus = original.ExchangeOperationResultStatusSucceeded +) + +type InstanceFlexibility = original.InstanceFlexibility + +const ( + InstanceFlexibilityOff InstanceFlexibility = original.InstanceFlexibilityOff + InstanceFlexibilityOn InstanceFlexibility = original.InstanceFlexibilityOn ) type Kind = original.Kind const ( - MicrosoftCompute Kind = original.MicrosoftCompute + KindMicrosoftCompute Kind = original.KindMicrosoftCompute +) + +type OperationStatus = original.OperationStatus + +const ( + OperationStatusCancelled OperationStatus = original.OperationStatusCancelled + OperationStatusFailed OperationStatus = original.OperationStatusFailed + OperationStatusPending OperationStatus = original.OperationStatusPending + OperationStatusSucceeded OperationStatus = original.OperationStatusSucceeded ) -type Location = original.Location +type PaymentStatus = original.PaymentStatus const ( - Australiaeast Location = original.Australiaeast - Australiasoutheast Location = original.Australiasoutheast - Brazilsouth Location = original.Brazilsouth - Canadacentral Location = original.Canadacentral - Canadaeast Location = original.Canadaeast - Centralindia Location = original.Centralindia - Centralus Location = original.Centralus - Eastasia Location = original.Eastasia - Eastus Location = original.Eastus - Eastus2 Location = original.Eastus2 - Japaneast Location = original.Japaneast - Japanwest Location = original.Japanwest - Northcentralus Location = original.Northcentralus - Northeurope Location = original.Northeurope - Southcentralus Location = original.Southcentralus - Southeastasia Location = original.Southeastasia - Southindia Location = original.Southindia - Uksouth Location = original.Uksouth - Ukwest Location = original.Ukwest - Westcentralus Location = original.Westcentralus - Westeurope Location = original.Westeurope - Westindia Location = original.Westindia - Westus Location = original.Westus - Westus2 Location = original.Westus2 + PaymentStatusCancelled PaymentStatus = original.PaymentStatusCancelled + PaymentStatusFailed PaymentStatus = original.PaymentStatusFailed + PaymentStatusScheduled PaymentStatus = original.PaymentStatusScheduled + PaymentStatusSucceeded PaymentStatus = original.PaymentStatusSucceeded ) type ProvisioningState = original.ProvisioningState const ( - BillingFailed ProvisioningState = original.BillingFailed - Cancelled ProvisioningState = original.Cancelled - ConfirmedBilling ProvisioningState = original.ConfirmedBilling - ConfirmedResourceHold ProvisioningState = original.ConfirmedResourceHold - Created ProvisioningState = original.Created - Creating ProvisioningState = original.Creating - Expired ProvisioningState = original.Expired - Failed ProvisioningState = original.Failed - Merged ProvisioningState = original.Merged - PendingBilling ProvisioningState = original.PendingBilling - PendingResourceHold ProvisioningState = original.PendingResourceHold - Split ProvisioningState = original.Split - Succeeded ProvisioningState = original.Succeeded + ProvisioningStateBillingFailed ProvisioningState = original.ProvisioningStateBillingFailed + ProvisioningStateCancelled ProvisioningState = original.ProvisioningStateCancelled + ProvisioningStateConfirmedBilling ProvisioningState = original.ProvisioningStateConfirmedBilling + ProvisioningStateConfirmedResourceHold ProvisioningState = original.ProvisioningStateConfirmedResourceHold + ProvisioningStateCreated ProvisioningState = original.ProvisioningStateCreated + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateExpired ProvisioningState = original.ProvisioningStateExpired + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateMerged ProvisioningState = original.ProvisioningStateMerged + ProvisioningStatePendingBilling ProvisioningState = original.ProvisioningStatePendingBilling + ProvisioningStatePendingResourceHold ProvisioningState = original.ProvisioningStatePendingResourceHold + ProvisioningStateSplit ProvisioningState = original.ProvisioningStateSplit + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded ) type ProvisioningState1 = original.ProvisioningState1 @@ -164,6 +182,72 @@ const ( ProvisioningState1Succeeded ProvisioningState1 = original.ProvisioningState1Succeeded ) +type QuotaRequestState = original.QuotaRequestState + +const ( + QuotaRequestStateAccepted QuotaRequestState = original.QuotaRequestStateAccepted + QuotaRequestStateFailed QuotaRequestState = original.QuotaRequestStateFailed + QuotaRequestStateInProgress QuotaRequestState = original.QuotaRequestStateInProgress + QuotaRequestStateInvalid QuotaRequestState = original.QuotaRequestStateInvalid + QuotaRequestStateSucceeded QuotaRequestState = original.QuotaRequestStateSucceeded +) + +type ReservationBillingPlan = original.ReservationBillingPlan + +const ( + ReservationBillingPlanMonthly ReservationBillingPlan = original.ReservationBillingPlanMonthly + ReservationBillingPlanUpfront ReservationBillingPlan = original.ReservationBillingPlanUpfront +) + +type ReservationTerm = original.ReservationTerm + +const ( + ReservationTermP1Y ReservationTerm = original.ReservationTermP1Y + ReservationTermP3Y ReservationTerm = original.ReservationTermP3Y + ReservationTermP5Y ReservationTerm = original.ReservationTermP5Y +) + +type ReservedResourceType = original.ReservedResourceType + +const ( + ReservedResourceTypeAppService ReservedResourceType = original.ReservedResourceTypeAppService + ReservedResourceTypeAVS ReservedResourceType = original.ReservedResourceTypeAVS + ReservedResourceTypeAzureDataExplorer ReservedResourceType = original.ReservedResourceTypeAzureDataExplorer + ReservedResourceTypeAzureFiles ReservedResourceType = original.ReservedResourceTypeAzureFiles + ReservedResourceTypeBlockBlob ReservedResourceType = original.ReservedResourceTypeBlockBlob + ReservedResourceTypeCosmosDb ReservedResourceType = original.ReservedResourceTypeCosmosDb + ReservedResourceTypeDatabricks ReservedResourceType = original.ReservedResourceTypeDatabricks + ReservedResourceTypeDataFactory ReservedResourceType = original.ReservedResourceTypeDataFactory + ReservedResourceTypeDedicatedHost ReservedResourceType = original.ReservedResourceTypeDedicatedHost + ReservedResourceTypeManagedDisk ReservedResourceType = original.ReservedResourceTypeManagedDisk + ReservedResourceTypeMariaDb ReservedResourceType = original.ReservedResourceTypeMariaDb + ReservedResourceTypeMySQL ReservedResourceType = original.ReservedResourceTypeMySQL + ReservedResourceTypeNetAppStorage ReservedResourceType = original.ReservedResourceTypeNetAppStorage + ReservedResourceTypePostgreSQL ReservedResourceType = original.ReservedResourceTypePostgreSQL + ReservedResourceTypeRedHat ReservedResourceType = original.ReservedResourceTypeRedHat + ReservedResourceTypeRedHatOsa ReservedResourceType = original.ReservedResourceTypeRedHatOsa + ReservedResourceTypeRedisCache ReservedResourceType = original.ReservedResourceTypeRedisCache + ReservedResourceTypeSapHana ReservedResourceType = original.ReservedResourceTypeSapHana + ReservedResourceTypeSQLAzureHybridBenefit ReservedResourceType = original.ReservedResourceTypeSQLAzureHybridBenefit + ReservedResourceTypeSQLDatabases ReservedResourceType = original.ReservedResourceTypeSQLDatabases + ReservedResourceTypeSQLDataWarehouse ReservedResourceType = original.ReservedResourceTypeSQLDataWarehouse + ReservedResourceTypeSQLEdge ReservedResourceType = original.ReservedResourceTypeSQLEdge + ReservedResourceTypeSuseLinux ReservedResourceType = original.ReservedResourceTypeSuseLinux + ReservedResourceTypeVirtualMachines ReservedResourceType = original.ReservedResourceTypeVirtualMachines + ReservedResourceTypeVirtualMachineSoftware ReservedResourceType = original.ReservedResourceTypeVirtualMachineSoftware + ReservedResourceTypeVMwareCloudSimple ReservedResourceType = original.ReservedResourceTypeVMwareCloudSimple +) + +type ResourceType = original.ResourceType + +const ( + ResourceTypeDedicated ResourceType = original.ResourceTypeDedicated + ResourceTypeLowPriority ResourceType = original.ResourceTypeLowPriority + ResourceTypeServiceSpecific ResourceType = original.ResourceTypeServiceSpecific + ResourceTypeShared ResourceType = original.ResourceTypeShared + ResourceTypeStandard ResourceType = original.ResourceTypeStandard +) + type StatusCode = original.StatusCode const ( @@ -173,25 +257,51 @@ const ( StatusCodeNone StatusCode = original.StatusCodeNone StatusCodePaymentInstrumentError StatusCode = original.StatusCodePaymentInstrumentError StatusCodePending StatusCode = original.StatusCodePending + StatusCodeProcessing StatusCode = original.StatusCodeProcessing StatusCodePurchaseError StatusCode = original.StatusCodePurchaseError StatusCodeSplit StatusCode = original.StatusCodeSplit StatusCodeSucceeded StatusCode = original.StatusCodeSucceeded ) -type Term = original.Term - -const ( - P1Y Term = original.P1Y - P3Y Term = original.P3Y -) - type AppliedReservationList = original.AppliedReservationList type AppliedReservations = original.AppliedReservations type AppliedReservationsProperties = original.AppliedReservationsProperties +type AvailableScopeProperties = original.AvailableScopeProperties +type AvailableScopeRequest = original.AvailableScopeRequest +type AvailableScopeRequestProperties = original.AvailableScopeRequestProperties type BaseClient = original.BaseClient +type BillingInformation = original.BillingInformation +type CalculateExchangeClient = original.CalculateExchangeClient +type CalculateExchangeOperationResultResponse = original.CalculateExchangeOperationResultResponse +type CalculateExchangePostFuture = original.CalculateExchangePostFuture +type CalculateExchangeRequest = original.CalculateExchangeRequest +type CalculateExchangeRequestProperties = original.CalculateExchangeRequestProperties +type CalculateExchangeResponseProperties = original.CalculateExchangeResponseProperties +type CalculatePriceResponse = original.CalculatePriceResponse +type CalculatePriceResponseProperties = original.CalculatePriceResponseProperties +type CalculatePriceResponsePropertiesBillingCurrencyTotal = original.CalculatePriceResponsePropertiesBillingCurrencyTotal +type CalculatePriceResponsePropertiesPricingCurrencyTotal = original.CalculatePriceResponsePropertiesPricingCurrencyTotal type Catalog = original.Catalog +type CatalogMsrp = original.CatalogMsrp +type ChangeDirectoryRequest = original.ChangeDirectoryRequest +type ChangeDirectoryResponse = original.ChangeDirectoryResponse +type ChangeDirectoryResult = original.ChangeDirectoryResult type Client = original.Client +type CreateGenericQuotaRequestParameters = original.CreateGenericQuotaRequestParameters +type CurrentQuotaLimit = original.CurrentQuotaLimit +type CurrentQuotaLimitBase = original.CurrentQuotaLimitBase type Error = original.Error +type ErrorDetails = original.ErrorDetails +type ErrorResponse = original.ErrorResponse +type ExceptionResponse = original.ExceptionResponse +type ExchangeClient = original.ExchangeClient +type ExchangeOperationResultResponse = original.ExchangeOperationResultResponse +type ExchangePolicyError = original.ExchangePolicyError +type ExchangePolicyErrors = original.ExchangePolicyErrors +type ExchangePostFuture = original.ExchangePostFuture +type ExchangeRequest = original.ExchangeRequest +type ExchangeRequestProperties = original.ExchangeRequestProperties +type ExchangeResponseProperties = original.ExchangeResponseProperties type ExtendedErrorInfo = original.ExtendedErrorInfo type ExtendedStatusInfo = original.ExtendedStatusInfo type List = original.List @@ -199,6 +309,9 @@ type ListCatalog = original.ListCatalog type ListIterator = original.ListIterator type ListPage = original.ListPage type ListResponse = original.ListResponse +type ListResult = original.ListResult +type ListResultIterator = original.ListResultIterator +type ListResultPage = original.ListResultPage type MergeProperties = original.MergeProperties type MergePropertiesType = original.MergePropertiesType type MergeRequest = original.MergeRequest @@ -208,41 +321,108 @@ type OperationList = original.OperationList type OperationListIterator = original.OperationListIterator type OperationListPage = original.OperationListPage type OperationResponse = original.OperationResponse +type OperationResultError = original.OperationResultError +type OrderBillingPlanInformation = original.OrderBillingPlanInformation type OrderClient = original.OrderClient type OrderList = original.OrderList type OrderListIterator = original.OrderListIterator type OrderListPage = original.OrderListPage type OrderProperties = original.OrderProperties +type OrderPurchaseFuture = original.OrderPurchaseFuture type OrderResponse = original.OrderResponse type Patch = original.Patch type PatchProperties = original.PatchProperties +type PatchPropertiesRenewProperties = original.PatchPropertiesRenewProperties +type PaymentDetail = original.PaymentDetail +type Price = original.Price type Properties = original.Properties +type PropertiesUtilization = original.PropertiesUtilization +type PurchaseRequest = original.PurchaseRequest +type PurchaseRequestProperties = original.PurchaseRequestProperties +type PurchaseRequestPropertiesReservedResourceProperties = original.PurchaseRequestPropertiesReservedResourceProperties +type QuotaClient = original.QuotaClient +type QuotaCreateOrUpdateFuture = original.QuotaCreateOrUpdateFuture +type QuotaLimits = original.QuotaLimits +type QuotaLimitsIterator = original.QuotaLimitsIterator +type QuotaLimitsPage = original.QuotaLimitsPage +type QuotaLimitsResponse = original.QuotaLimitsResponse +type QuotaProperties = original.QuotaProperties +type QuotaRequestDetails = original.QuotaRequestDetails +type QuotaRequestDetailsList = original.QuotaRequestDetailsList +type QuotaRequestDetailsListIterator = original.QuotaRequestDetailsListIterator +type QuotaRequestDetailsListPage = original.QuotaRequestDetailsListPage +type QuotaRequestOneResourceProperties = original.QuotaRequestOneResourceProperties +type QuotaRequestOneResourceSubmitResponse = original.QuotaRequestOneResourceSubmitResponse +type QuotaRequestProperties = original.QuotaRequestProperties +type QuotaRequestStatusClient = original.QuotaRequestStatusClient +type QuotaRequestStatusDetails = original.QuotaRequestStatusDetails +type QuotaRequestSubmitResponse = original.QuotaRequestSubmitResponse +type QuotaRequestSubmitResponse201 = original.QuotaRequestSubmitResponse201 +type QuotaUpdateFuture = original.QuotaUpdateFuture +type RenewPropertiesResponse = original.RenewPropertiesResponse +type RenewPropertiesResponseBillingCurrencyTotal = original.RenewPropertiesResponseBillingCurrencyTotal +type RenewPropertiesResponsePricingCurrencyTotal = original.RenewPropertiesResponsePricingCurrencyTotal +type ReservationAvailableScopesFuture = original.ReservationAvailableScopesFuture type ReservationMergeFuture = original.ReservationMergeFuture type ReservationUpdateFuture = original.ReservationUpdateFuture +type ResourceName = original.ResourceName type Response = original.Response +type ScopeProperties = original.ScopeProperties +type ServiceError = original.ServiceError +type ServiceErrorDetail = original.ServiceErrorDetail +type SetObject = original.SetObject type SkuCapability = original.SkuCapability type SkuName = original.SkuName +type SkuProperty = original.SkuProperty type SkuRestriction = original.SkuRestriction type SplitFuture = original.SplitFuture type SplitProperties = original.SplitProperties type SplitPropertiesType = original.SplitPropertiesType type SplitRequest = original.SplitRequest +type SubRequest = original.SubRequest +type SubscriptionScopeProperties = original.SubscriptionScopeProperties +type Summary = original.Summary +type SystemData = original.SystemData +type ToExchange = original.ToExchange +type ToPurchaseCalculateExchange = original.ToPurchaseCalculateExchange +type ToPurchaseExchange = original.ToPurchaseExchange +type ToReturn = original.ToReturn +type ToReturnForExchange = original.ToReturnForExchange +type UtilizationAggregates = original.UtilizationAggregates func New() BaseClient { return original.New() } +func NewCalculateExchangeClient() CalculateExchangeClient { + return original.NewCalculateExchangeClient() +} +func NewCalculateExchangeClientWithBaseURI(baseURI string) CalculateExchangeClient { + return original.NewCalculateExchangeClientWithBaseURI(baseURI) +} func NewClient() Client { return original.NewClient() } func NewClientWithBaseURI(baseURI string) Client { return original.NewClientWithBaseURI(baseURI) } +func NewExchangeClient() ExchangeClient { + return original.NewExchangeClient() +} +func NewExchangeClientWithBaseURI(baseURI string) ExchangeClient { + return original.NewExchangeClientWithBaseURI(baseURI) +} func NewListIterator(page ListPage) ListIterator { return original.NewListIterator(page) } func NewListPage(cur List, getNextPage func(context.Context, List) (List, error)) ListPage { return original.NewListPage(cur, getNextPage) } +func NewListResultIterator(page ListResultPage) ListResultIterator { + return original.NewListResultIterator(page) +} +func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { + return original.NewListResultPage(cur, getNextPage) +} func NewOperationClient() OperationClient { return original.NewOperationClient() } @@ -267,23 +447,59 @@ func NewOrderListIterator(page OrderListPage) OrderListIterator { func NewOrderListPage(cur OrderList, getNextPage func(context.Context, OrderList) (OrderList, error)) OrderListPage { return original.NewOrderListPage(cur, getNextPage) } +func NewQuotaClient() QuotaClient { + return original.NewQuotaClient() +} +func NewQuotaClientWithBaseURI(baseURI string) QuotaClient { + return original.NewQuotaClientWithBaseURI(baseURI) +} +func NewQuotaLimitsIterator(page QuotaLimitsPage) QuotaLimitsIterator { + return original.NewQuotaLimitsIterator(page) +} +func NewQuotaLimitsPage(cur QuotaLimits, getNextPage func(context.Context, QuotaLimits) (QuotaLimits, error)) QuotaLimitsPage { + return original.NewQuotaLimitsPage(cur, getNextPage) +} +func NewQuotaRequestDetailsListIterator(page QuotaRequestDetailsListPage) QuotaRequestDetailsListIterator { + return original.NewQuotaRequestDetailsListIterator(page) +} +func NewQuotaRequestDetailsListPage(cur QuotaRequestDetailsList, getNextPage func(context.Context, QuotaRequestDetailsList) (QuotaRequestDetailsList, error)) QuotaRequestDetailsListPage { + return original.NewQuotaRequestDetailsListPage(cur, getNextPage) +} +func NewQuotaRequestStatusClient() QuotaRequestStatusClient { + return original.NewQuotaRequestStatusClient() +} +func NewQuotaRequestStatusClientWithBaseURI(baseURI string) QuotaRequestStatusClient { + return original.NewQuotaRequestStatusClientWithBaseURI(baseURI) +} func NewWithBaseURI(baseURI string) BaseClient { return original.NewWithBaseURI(baseURI) } -func PossibleAppliedScopeType1Values() []AppliedScopeType1 { - return original.PossibleAppliedScopeType1Values() -} func PossibleAppliedScopeTypeValues() []AppliedScopeType { return original.PossibleAppliedScopeTypeValues() } -func PossibleCodeValues() []Code { - return original.PossibleCodeValues() +func PossibleCalculateExchangeOperationResultStatusValues() []CalculateExchangeOperationResultStatus { + return original.PossibleCalculateExchangeOperationResultStatusValues() +} +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} +func PossibleErrorResponseCodeValues() []ErrorResponseCode { + return original.PossibleErrorResponseCodeValues() +} +func PossibleExchangeOperationResultStatusValues() []ExchangeOperationResultStatus { + return original.PossibleExchangeOperationResultStatusValues() +} +func PossibleInstanceFlexibilityValues() []InstanceFlexibility { + return original.PossibleInstanceFlexibilityValues() } func PossibleKindValues() []Kind { return original.PossibleKindValues() } -func PossibleLocationValues() []Location { - return original.PossibleLocationValues() +func PossibleOperationStatusValues() []OperationStatus { + return original.PossibleOperationStatusValues() +} +func PossiblePaymentStatusValues() []PaymentStatus { + return original.PossiblePaymentStatusValues() } func PossibleProvisioningState1Values() []ProvisioningState1 { return original.PossibleProvisioningState1Values() @@ -291,12 +507,24 @@ func PossibleProvisioningState1Values() []ProvisioningState1 { func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } +func PossibleQuotaRequestStateValues() []QuotaRequestState { + return original.PossibleQuotaRequestStateValues() +} +func PossibleReservationBillingPlanValues() []ReservationBillingPlan { + return original.PossibleReservationBillingPlanValues() +} +func PossibleReservationTermValues() []ReservationTerm { + return original.PossibleReservationTermValues() +} +func PossibleReservedResourceTypeValues() []ReservedResourceType { + return original.PossibleReservedResourceTypeValues() +} +func PossibleResourceTypeValues() []ResourceType { + return original.PossibleResourceTypeValues() +} func PossibleStatusCodeValues() []StatusCode { return original.PossibleStatusCodeValues() } -func PossibleTermValues() []Term { - return original.PossibleTermValues() -} func UserAgent() string { return original.UserAgent() + " profiles/latest" } diff --git a/profiles/latest/reservations/mgmt/reservations/reservationsapi/models.go b/profiles/latest/reservations/mgmt/reservations/reservationsapi/models.go index 3ba16f68e6b3..821f0cd6f37a 100644 --- a/profiles/latest/reservations/mgmt/reservations/reservationsapi/models.go +++ b/profiles/latest/reservations/mgmt/reservations/reservationsapi/models.go @@ -9,9 +9,13 @@ package reservationsapi -import original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2017-11-01/reservations/reservationsapi" +import original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations/reservationsapi" type BaseClientAPI = original.BaseClientAPI +type CalculateExchangeClientAPI = original.CalculateExchangeClientAPI type ClientAPI = original.ClientAPI +type ExchangeClientAPI = original.ExchangeClientAPI type OperationClientAPI = original.OperationClientAPI type OrderClientAPI = original.OrderClientAPI +type QuotaClientAPI = original.QuotaClientAPI +type QuotaRequestStatusClientAPI = original.QuotaRequestStatusClientAPI diff --git a/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go b/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go index 75d5ad40ed94..20628c171912 100644 --- a/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go +++ b/profiles/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go @@ -9,7 +9,7 @@ package containerserviceapi -import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-02-01/containerservice/containerserviceapi" +import original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice/containerserviceapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type MaintenanceConfigurationsClientAPI = original.MaintenanceConfigurationsClientAPI diff --git a/profiles/preview/containerservice/mgmt/containerservice/models.go b/profiles/preview/containerservice/mgmt/containerservice/models.go index 5356b85ade98..b1b67ad95e63 100644 --- a/profiles/preview/containerservice/mgmt/containerservice/models.go +++ b/profiles/preview/containerservice/mgmt/containerservice/models.go @@ -12,7 +12,7 @@ package containerservice import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-02-01/containerservice" + original "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice" ) const ( @@ -473,6 +473,7 @@ type AgentPoolsClient = original.AgentPoolsClient type AgentPoolsCreateOrUpdateFuture = original.AgentPoolsCreateOrUpdateFuture type AgentPoolsDeleteFuture = original.AgentPoolsDeleteFuture type AgentPoolsUpgradeNodeImageVersionFuture = original.AgentPoolsUpgradeNodeImageVersionFuture +type AzureEntityResource = original.AzureEntityResource type BaseClient = original.BaseClient type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody @@ -528,6 +529,10 @@ type ManagedClusterSKU = original.ManagedClusterSKU type ManagedClusterSecurityProfile = original.ManagedClusterSecurityProfile type ManagedClusterSecurityProfileAzureDefender = original.ManagedClusterSecurityProfileAzureDefender type ManagedClusterServicePrincipalProfile = original.ManagedClusterServicePrincipalProfile +type ManagedClusterStorageProfile = original.ManagedClusterStorageProfile +type ManagedClusterStorageProfileDiskCSIDriver = original.ManagedClusterStorageProfileDiskCSIDriver +type ManagedClusterStorageProfileFileCSIDriver = original.ManagedClusterStorageProfileFileCSIDriver +type ManagedClusterStorageProfileSnapshotController = original.ManagedClusterStorageProfileSnapshotController type ManagedClusterUpgradeProfile = original.ManagedClusterUpgradeProfile type ManagedClusterUpgradeProfileProperties = original.ManagedClusterUpgradeProfileProperties type ManagedClusterWindowsProfile = original.ManagedClusterWindowsProfile @@ -565,6 +570,7 @@ type PrivateLinkResource = original.PrivateLinkResource type PrivateLinkResourcesClient = original.PrivateLinkResourcesClient type PrivateLinkResourcesListResult = original.PrivateLinkResourcesListResult type PrivateLinkServiceConnectionState = original.PrivateLinkServiceConnectionState +type ProxyResource = original.ProxyResource type ResolvePrivateLinkServiceIDClient = original.ResolvePrivateLinkServiceIDClient type Resource = original.Resource type ResourceReference = original.ResourceReference @@ -584,6 +590,7 @@ type SystemData = original.SystemData type TagsObject = original.TagsObject type TimeInWeek = original.TimeInWeek type TimeSpan = original.TimeSpan +type TrackedResource = original.TrackedResource type UserAssignedIdentity = original.UserAssignedIdentity type VMDiagnostics = original.VMDiagnostics type WindowsGmsaProfile = original.WindowsGmsaProfile diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index 3fb60c4bf846..46fd2d1aeecf 100644 --- a/profiles/preview/network/mgmt/network/models.go +++ b/profiles/preview/network/mgmt/network/models.go @@ -12,7 +12,7 @@ package network import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network" + original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" ) const ( @@ -79,6 +79,8 @@ type ApplicationGatewayProtocol = original.ApplicationGatewayProtocol const ( ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = original.ApplicationGatewayProtocolHTTP ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = original.ApplicationGatewayProtocolHTTPS + ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = original.ApplicationGatewayProtocolTCP + ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = original.ApplicationGatewayProtocolTLS ) type ApplicationGatewayRedirectType = original.ApplicationGatewayRedirectType @@ -533,6 +535,13 @@ const ( ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = original.ExpressRoutePeeringTypeMicrosoftPeering ) +type ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatus + +const ( + ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatusAvailable + ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = original.ExpressRoutePortAuthorizationUseStatusInUse +) + type ExpressRoutePortsEncapsulation = original.ExpressRoutePortsEncapsulation const ( @@ -553,6 +562,13 @@ const ( FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = original.FirewallPolicyFilterRuleCollectionActionTypeDeny ) +type FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrder + +const ( + FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrderAscending + FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = original.FirewallPolicyIDPSQuerySortOrderDescending +) + type FirewallPolicyIntrusionDetectionProtocol = original.FirewallPolicyIntrusionDetectionProtocol const ( @@ -644,6 +660,14 @@ const ( HubBgpConnectionStatusUnknown HubBgpConnectionStatus = original.HubBgpConnectionStatusUnknown ) +type HubRoutingPreference = original.HubRoutingPreference + +const ( + HubRoutingPreferenceASPath HubRoutingPreference = original.HubRoutingPreferenceASPath + HubRoutingPreferenceExpressRoute HubRoutingPreference = original.HubRoutingPreferenceExpressRoute + HubRoutingPreferenceVpnGateway HubRoutingPreference = original.HubRoutingPreferenceVpnGateway +) + type HubVirtualNetworkConnectionStatus = original.HubVirtualNetworkConnectionStatus const ( @@ -711,6 +735,14 @@ const ( InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = original.InboundSecurityRulesProtocolUDP ) +type InterfaceAuxiliaryMode = original.InterfaceAuxiliaryMode + +const ( + InterfaceAuxiliaryModeFloating InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeFloating + InterfaceAuxiliaryModeMaxConnections InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeMaxConnections + InterfaceAuxiliaryModeNone InterfaceAuxiliaryMode = original.InterfaceAuxiliaryModeNone +) + type InterfaceMigrationPhase = original.InterfaceMigrationPhase const ( @@ -767,6 +799,15 @@ const ( IssueTypeUserDefinedRoute IssueType = original.IssueTypeUserDefinedRoute ) +type LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminState + +const ( + LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateDown + LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateDrain + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateNone + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = original.LoadBalancerBackendAddressAdminStateUp +) + type LoadBalancerOutboundRuleProtocol = original.LoadBalancerOutboundRuleProtocol const ( @@ -838,13 +879,6 @@ const ( OperationStatusSucceeded OperationStatus = original.OperationStatusSucceeded ) -type Order = original.Order - -const ( - OrderAscending Order = original.OrderAscending - OrderDescending Order = original.OrderDescending -) - type Origin = original.Origin const ( @@ -1350,6 +1384,14 @@ const ( VpnNatRuleTypeStatic VpnNatRuleType = original.VpnNatRuleTypeStatic ) +type VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeType + +const ( + VpnPolicyMemberAttributeTypeAADGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeAADGroupID + VpnPolicyMemberAttributeTypeCertificateGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeCertificateGroupID + VpnPolicyMemberAttributeTypeRadiusAzureGroupID VpnPolicyMemberAttributeType = original.VpnPolicyMemberAttributeTypeRadiusAzureGroupID +) + type VpnType = original.VpnType const ( @@ -1459,6 +1501,8 @@ type ApplicationGatewayBackendHealthHTTPSettings = original.ApplicationGatewayBa type ApplicationGatewayBackendHealthOnDemand = original.ApplicationGatewayBackendHealthOnDemand type ApplicationGatewayBackendHealthPool = original.ApplicationGatewayBackendHealthPool type ApplicationGatewayBackendHealthServer = original.ApplicationGatewayBackendHealthServer +type ApplicationGatewayBackendSettings = original.ApplicationGatewayBackendSettings +type ApplicationGatewayBackendSettingsPropertiesFormat = original.ApplicationGatewayBackendSettingsPropertiesFormat type ApplicationGatewayClientAuthConfiguration = original.ApplicationGatewayClientAuthConfiguration type ApplicationGatewayConnectionDraining = original.ApplicationGatewayConnectionDraining type ApplicationGatewayCustomError = original.ApplicationGatewayCustomError @@ -1481,6 +1525,8 @@ type ApplicationGatewayIPConfigurationPropertiesFormat = original.ApplicationGat type ApplicationGatewayListResult = original.ApplicationGatewayListResult type ApplicationGatewayListResultIterator = original.ApplicationGatewayListResultIterator type ApplicationGatewayListResultPage = original.ApplicationGatewayListResultPage +type ApplicationGatewayListener = original.ApplicationGatewayListener +type ApplicationGatewayListenerPropertiesFormat = original.ApplicationGatewayListenerPropertiesFormat type ApplicationGatewayLoadDistributionPolicy = original.ApplicationGatewayLoadDistributionPolicy type ApplicationGatewayLoadDistributionPolicyPropertiesFormat = original.ApplicationGatewayLoadDistributionPolicyPropertiesFormat type ApplicationGatewayLoadDistributionTarget = original.ApplicationGatewayLoadDistributionTarget @@ -1519,6 +1565,8 @@ type ApplicationGatewayRewriteRuleActionSet = original.ApplicationGatewayRewrite type ApplicationGatewayRewriteRuleCondition = original.ApplicationGatewayRewriteRuleCondition type ApplicationGatewayRewriteRuleSet = original.ApplicationGatewayRewriteRuleSet type ApplicationGatewayRewriteRuleSetPropertiesFormat = original.ApplicationGatewayRewriteRuleSetPropertiesFormat +type ApplicationGatewayRoutingRule = original.ApplicationGatewayRoutingRule +type ApplicationGatewayRoutingRulePropertiesFormat = original.ApplicationGatewayRoutingRulePropertiesFormat type ApplicationGatewaySku = original.ApplicationGatewaySku type ApplicationGatewaySslCertificate = original.ApplicationGatewaySslCertificate type ApplicationGatewaySslCertificatePropertiesFormat = original.ApplicationGatewaySslCertificatePropertiesFormat @@ -1675,6 +1723,9 @@ type ConfigurationDiagnosticParameters = original.ConfigurationDiagnosticParamet type ConfigurationDiagnosticProfile = original.ConfigurationDiagnosticProfile type ConfigurationDiagnosticResponse = original.ConfigurationDiagnosticResponse type ConfigurationDiagnosticResult = original.ConfigurationDiagnosticResult +type ConfigurationPolicyGroupsClient = original.ConfigurationPolicyGroupsClient +type ConfigurationPolicyGroupsCreateOrUpdateFuture = original.ConfigurationPolicyGroupsCreateOrUpdateFuture +type ConfigurationPolicyGroupsDeleteFuture = original.ConfigurationPolicyGroupsDeleteFuture type ConnectionMonitor = original.ConnectionMonitor type ConnectionMonitorDestination = original.ConnectionMonitorDestination type ConnectionMonitorEndpoint = original.ConnectionMonitorEndpoint @@ -1863,6 +1914,14 @@ type ExpressRouteLinkMacSecConfig = original.ExpressRouteLinkMacSecConfig type ExpressRouteLinkPropertiesFormat = original.ExpressRouteLinkPropertiesFormat type ExpressRouteLinksClient = original.ExpressRouteLinksClient type ExpressRoutePort = original.ExpressRoutePort +type ExpressRoutePortAuthorization = original.ExpressRoutePortAuthorization +type ExpressRoutePortAuthorizationListResult = original.ExpressRoutePortAuthorizationListResult +type ExpressRoutePortAuthorizationListResultIterator = original.ExpressRoutePortAuthorizationListResultIterator +type ExpressRoutePortAuthorizationListResultPage = original.ExpressRoutePortAuthorizationListResultPage +type ExpressRoutePortAuthorizationPropertiesFormat = original.ExpressRoutePortAuthorizationPropertiesFormat +type ExpressRoutePortAuthorizationsClient = original.ExpressRoutePortAuthorizationsClient +type ExpressRoutePortAuthorizationsCreateOrUpdateFuture = original.ExpressRoutePortAuthorizationsCreateOrUpdateFuture +type ExpressRoutePortAuthorizationsDeleteFuture = original.ExpressRoutePortAuthorizationsDeleteFuture type ExpressRoutePortListResult = original.ExpressRoutePortListResult type ExpressRoutePortListResultIterator = original.ExpressRoutePortListResultIterator type ExpressRoutePortListResultPage = original.ExpressRoutePortListResultPage @@ -1939,6 +1998,7 @@ type FlowLogsCreateOrUpdateFuture = original.FlowLogsCreateOrUpdateFuture type FlowLogsDeleteFuture = original.FlowLogsDeleteFuture type FrontendIPConfiguration = original.FrontendIPConfiguration type FrontendIPConfigurationPropertiesFormat = original.FrontendIPConfigurationPropertiesFormat +type GatewayCustomBgpIPAddressIPConfiguration = original.GatewayCustomBgpIPAddressIPConfiguration type GatewayLoadBalancerTunnelInterface = original.GatewayLoadBalancerTunnelInterface type GatewayRoute = original.GatewayRoute type GatewayRouteListResult = original.GatewayRouteListResult @@ -2083,6 +2143,9 @@ type ListVpnGatewayNatRulesResultPage = original.ListVpnGatewayNatRulesResultPag type ListVpnGatewaysResult = original.ListVpnGatewaysResult type ListVpnGatewaysResultIterator = original.ListVpnGatewaysResultIterator type ListVpnGatewaysResultPage = original.ListVpnGatewaysResultPage +type ListVpnServerConfigurationPolicyGroupsResult = original.ListVpnServerConfigurationPolicyGroupsResult +type ListVpnServerConfigurationPolicyGroupsResultIterator = original.ListVpnServerConfigurationPolicyGroupsResultIterator +type ListVpnServerConfigurationPolicyGroupsResultPage = original.ListVpnServerConfigurationPolicyGroupsResultPage type ListVpnServerConfigurationsResult = original.ListVpnServerConfigurationsResult type ListVpnServerConfigurationsResultIterator = original.ListVpnServerConfigurationsResultIterator type ListVpnServerConfigurationsResultPage = original.ListVpnServerConfigurationsResultPage @@ -2674,6 +2737,9 @@ type VpnServerConfigRadiusServerRootCertificate = original.VpnServerConfigRadius type VpnServerConfigVpnClientRevokedCertificate = original.VpnServerConfigVpnClientRevokedCertificate type VpnServerConfigVpnClientRootCertificate = original.VpnServerConfigVpnClientRootCertificate type VpnServerConfiguration = original.VpnServerConfiguration +type VpnServerConfigurationPolicyGroup = original.VpnServerConfigurationPolicyGroup +type VpnServerConfigurationPolicyGroupMember = original.VpnServerConfigurationPolicyGroupMember +type VpnServerConfigurationPolicyGroupProperties = original.VpnServerConfigurationPolicyGroupProperties type VpnServerConfigurationProperties = original.VpnServerConfigurationProperties type VpnServerConfigurationsAssociatedWithVirtualWanClient = original.VpnServerConfigurationsAssociatedWithVirtualWanClient type VpnServerConfigurationsAssociatedWithVirtualWanListFuture = original.VpnServerConfigurationsAssociatedWithVirtualWanListFuture @@ -2910,6 +2976,12 @@ func NewBgpServiceCommunityListResultIterator(page BgpServiceCommunityListResult func NewBgpServiceCommunityListResultPage(cur BgpServiceCommunityListResult, getNextPage func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error)) BgpServiceCommunityListResultPage { return original.NewBgpServiceCommunityListResultPage(cur, getNextPage) } +func NewConfigurationPolicyGroupsClient(subscriptionID string) ConfigurationPolicyGroupsClient { + return original.NewConfigurationPolicyGroupsClient(subscriptionID) +} +func NewConfigurationPolicyGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationPolicyGroupsClient { + return original.NewConfigurationPolicyGroupsClientWithBaseURI(baseURI, subscriptionID) +} func NewConnectionMonitorsClient(subscriptionID string) ConnectionMonitorsClient { return original.NewConnectionMonitorsClient(subscriptionID) } @@ -3060,6 +3132,18 @@ func NewExpressRouteLinksClient(subscriptionID string) ExpressRouteLinksClient { func NewExpressRouteLinksClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteLinksClient { return original.NewExpressRouteLinksClientWithBaseURI(baseURI, subscriptionID) } +func NewExpressRoutePortAuthorizationListResultIterator(page ExpressRoutePortAuthorizationListResultPage) ExpressRoutePortAuthorizationListResultIterator { + return original.NewExpressRoutePortAuthorizationListResultIterator(page) +} +func NewExpressRoutePortAuthorizationListResultPage(cur ExpressRoutePortAuthorizationListResult, getNextPage func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error)) ExpressRoutePortAuthorizationListResultPage { + return original.NewExpressRoutePortAuthorizationListResultPage(cur, getNextPage) +} +func NewExpressRoutePortAuthorizationsClient(subscriptionID string) ExpressRoutePortAuthorizationsClient { + return original.NewExpressRoutePortAuthorizationsClient(subscriptionID) +} +func NewExpressRoutePortAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRoutePortAuthorizationsClient { + return original.NewExpressRoutePortAuthorizationsClientWithBaseURI(baseURI, subscriptionID) +} func NewExpressRoutePortListResultIterator(page ExpressRoutePortListResultPage) ExpressRoutePortListResultIterator { return original.NewExpressRoutePortListResultIterator(page) } @@ -3330,6 +3414,12 @@ func NewListVpnGatewaysResultIterator(page ListVpnGatewaysResultPage) ListVpnGat func NewListVpnGatewaysResultPage(cur ListVpnGatewaysResult, getNextPage func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error)) ListVpnGatewaysResultPage { return original.NewListVpnGatewaysResultPage(cur, getNextPage) } +func NewListVpnServerConfigurationPolicyGroupsResultIterator(page ListVpnServerConfigurationPolicyGroupsResultPage) ListVpnServerConfigurationPolicyGroupsResultIterator { + return original.NewListVpnServerConfigurationPolicyGroupsResultIterator(page) +} +func NewListVpnServerConfigurationPolicyGroupsResultPage(cur ListVpnServerConfigurationPolicyGroupsResult, getNextPage func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error)) ListVpnServerConfigurationPolicyGroupsResultPage { + return original.NewListVpnServerConfigurationPolicyGroupsResultPage(cur, getNextPage) +} func NewListVpnServerConfigurationsResultIterator(page ListVpnServerConfigurationsResultPage) ListVpnServerConfigurationsResultIterator { return original.NewListVpnServerConfigurationsResultIterator(page) } @@ -4182,6 +4272,9 @@ func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { return original.PossibleExpressRoutePeeringTypeValues() } +func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { + return original.PossibleExpressRoutePortAuthorizationUseStatusValues() +} func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { return original.PossibleExpressRoutePortsEncapsulationValues() } @@ -4191,6 +4284,9 @@ func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { return original.PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() } +func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { + return original.PossibleFirewallPolicyIDPSQuerySortOrderValues() +} func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { return original.PossibleFirewallPolicyIntrusionDetectionProtocolValues() } @@ -4227,6 +4323,9 @@ func PossibleHTTPMethodValues() []HTTPMethod { func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { return original.PossibleHubBgpConnectionStatusValues() } +func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { + return original.PossibleHubRoutingPreferenceValues() +} func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { return original.PossibleHubVirtualNetworkConnectionStatusValues() } @@ -4251,6 +4350,9 @@ func PossibleIkeIntegrityValues() []IkeIntegrity { func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { return original.PossibleInboundSecurityRulesProtocolValues() } +func PossibleInterfaceAuxiliaryModeValues() []InterfaceAuxiliaryMode { + return original.PossibleInterfaceAuxiliaryModeValues() +} func PossibleInterfaceMigrationPhaseValues() []InterfaceMigrationPhase { return original.PossibleInterfaceMigrationPhaseValues() } @@ -4266,6 +4368,9 @@ func PossibleIpsecIntegrityValues() []IpsecIntegrity { func PossibleIssueTypeValues() []IssueType { return original.PossibleIssueTypeValues() } +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return original.PossibleLoadBalancerBackendAddressAdminStateValues() +} func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { return original.PossibleLoadBalancerOutboundRuleProtocolValues() } @@ -4293,9 +4398,6 @@ func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { func PossibleOperationStatusValues() []OperationStatus { return original.PossibleOperationStatusValues() } -func PossibleOrderValues() []Order { - return original.PossibleOrderValues() -} func PossibleOriginValues() []Origin { return original.PossibleOriginValues() } @@ -4467,6 +4569,9 @@ func PossibleVpnNatRuleModeValues() []VpnNatRuleMode { func PossibleVpnNatRuleTypeValues() []VpnNatRuleType { return original.PossibleVpnNatRuleTypeValues() } +func PossibleVpnPolicyMemberAttributeTypeValues() []VpnPolicyMemberAttributeType { + return original.PossibleVpnPolicyMemberAttributeTypeValues() +} func PossibleVpnTypeValues() []VpnType { return original.PossibleVpnTypeValues() } diff --git a/profiles/preview/network/mgmt/network/networkapi/models.go b/profiles/preview/network/mgmt/network/networkapi/models.go index 64d10d77c541..e3b4b15d8b4b 100644 --- a/profiles/preview/network/mgmt/network/networkapi/models.go +++ b/profiles/preview/network/mgmt/network/networkapi/models.go @@ -9,7 +9,7 @@ package networkapi -import original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-05-01/network/networkapi" +import original "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network/networkapi" type ApplicationGatewayPrivateEndpointConnectionsClientAPI = original.ApplicationGatewayPrivateEndpointConnectionsClientAPI type ApplicationGatewayPrivateLinkResourcesClientAPI = original.ApplicationGatewayPrivateLinkResourcesClientAPI @@ -25,6 +25,7 @@ type AzureFirewallsClientAPI = original.AzureFirewallsClientAPI type BaseClientAPI = original.BaseClientAPI type BastionHostsClientAPI = original.BastionHostsClientAPI type BgpServiceCommunitiesClientAPI = original.BgpServiceCommunitiesClientAPI +type ConfigurationPolicyGroupsClientAPI = original.ConfigurationPolicyGroupsClientAPI type ConnectionMonitorsClientAPI = original.ConnectionMonitorsClientAPI type CustomIPPrefixesClientAPI = original.CustomIPPrefixesClientAPI type DdosCustomPoliciesClientAPI = original.DdosCustomPoliciesClientAPI @@ -40,6 +41,7 @@ type ExpressRouteCrossConnectionPeeringsClientAPI = original.ExpressRouteCrossCo type ExpressRouteCrossConnectionsClientAPI = original.ExpressRouteCrossConnectionsClientAPI type ExpressRouteGatewaysClientAPI = original.ExpressRouteGatewaysClientAPI type ExpressRouteLinksClientAPI = original.ExpressRouteLinksClientAPI +type ExpressRoutePortAuthorizationsClientAPI = original.ExpressRoutePortAuthorizationsClientAPI type ExpressRoutePortsClientAPI = original.ExpressRoutePortsClientAPI type ExpressRoutePortsLocationsClientAPI = original.ExpressRoutePortsLocationsClientAPI type ExpressRouteServiceProvidersClientAPI = original.ExpressRouteServiceProvidersClientAPI diff --git a/profiles/preview/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go b/profiles/preview/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go index db3a5352a843..16ec2bf1f2ff 100644 --- a/profiles/preview/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go +++ b/profiles/preview/preview/containerservice/mgmt/containerservice/containerserviceapi/models.go @@ -9,10 +9,11 @@ package containerserviceapi -import original "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice/containerserviceapi" +import original "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/containerserviceapi" type AgentPoolsClientAPI = original.AgentPoolsClientAPI type MaintenanceConfigurationsClientAPI = original.MaintenanceConfigurationsClientAPI +type ManagedClusterSnapshotsClientAPI = original.ManagedClusterSnapshotsClientAPI type ManagedClustersClientAPI = original.ManagedClustersClientAPI type OperationsClientAPI = original.OperationsClientAPI type PrivateEndpointConnectionsClientAPI = original.PrivateEndpointConnectionsClientAPI diff --git a/profiles/preview/preview/containerservice/mgmt/containerservice/models.go b/profiles/preview/preview/containerservice/mgmt/containerservice/models.go index 1863b8ae36a6..29725ff87f8d 100644 --- a/profiles/preview/preview/containerservice/mgmt/containerservice/models.go +++ b/profiles/preview/preview/containerservice/mgmt/containerservice/models.go @@ -12,7 +12,7 @@ package containerservice import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-01-02-preview/containerservice" + original "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" ) const ( @@ -240,7 +240,8 @@ const ( type SnapshotType = original.SnapshotType const ( - SnapshotTypeNodePool SnapshotType = original.SnapshotTypeNodePool + SnapshotTypeManagedCluster SnapshotType = original.SnapshotTypeManagedCluster + SnapshotTypeNodePool SnapshotType = original.SnapshotTypeNodePool ) type StorageProfileTypes = original.StorageProfileTypes @@ -474,6 +475,8 @@ type AgentPoolsClient = original.AgentPoolsClient type AgentPoolsCreateOrUpdateFuture = original.AgentPoolsCreateOrUpdateFuture type AgentPoolsDeleteFuture = original.AgentPoolsDeleteFuture type AgentPoolsUpgradeNodeImageVersionFuture = original.AgentPoolsUpgradeNodeImageVersionFuture +type AzureEntityResource = original.AzureEntityResource +type AzureKeyVaultKms = original.AzureKeyVaultKms type BaseClient = original.BaseClient type CloudError = original.CloudError type CloudErrorBody = original.CloudErrorBody @@ -506,6 +509,8 @@ type ManagedClusterAutoUpgradeProfile = original.ManagedClusterAutoUpgradeProfil type ManagedClusterHTTPProxyConfig = original.ManagedClusterHTTPProxyConfig type ManagedClusterIdentity = original.ManagedClusterIdentity type ManagedClusterIdentityUserAssignedIdentitiesValue = original.ManagedClusterIdentityUserAssignedIdentitiesValue +type ManagedClusterIngressProfile = original.ManagedClusterIngressProfile +type ManagedClusterIngressProfileWebAppRouting = original.ManagedClusterIngressProfileWebAppRouting type ManagedClusterListResult = original.ManagedClusterListResult type ManagedClusterListResultIterator = original.ManagedClusterListResultIterator type ManagedClusterListResultPage = original.ManagedClusterListResultPage @@ -526,10 +531,22 @@ type ManagedClusterPoolUpgradeProfile = original.ManagedClusterPoolUpgradeProfil type ManagedClusterPoolUpgradeProfileUpgradesItem = original.ManagedClusterPoolUpgradeProfileUpgradesItem type ManagedClusterProperties = original.ManagedClusterProperties type ManagedClusterPropertiesAutoScalerProfile = original.ManagedClusterPropertiesAutoScalerProfile +type ManagedClusterPropertiesForSnapshot = original.ManagedClusterPropertiesForSnapshot type ManagedClusterSKU = original.ManagedClusterSKU type ManagedClusterSecurityProfile = original.ManagedClusterSecurityProfile type ManagedClusterSecurityProfileAzureDefender = original.ManagedClusterSecurityProfileAzureDefender +type ManagedClusterSecurityProfileWorkloadIdentity = original.ManagedClusterSecurityProfileWorkloadIdentity type ManagedClusterServicePrincipalProfile = original.ManagedClusterServicePrincipalProfile +type ManagedClusterSnapshot = original.ManagedClusterSnapshot +type ManagedClusterSnapshotListResult = original.ManagedClusterSnapshotListResult +type ManagedClusterSnapshotListResultIterator = original.ManagedClusterSnapshotListResultIterator +type ManagedClusterSnapshotListResultPage = original.ManagedClusterSnapshotListResultPage +type ManagedClusterSnapshotProperties = original.ManagedClusterSnapshotProperties +type ManagedClusterSnapshotsClient = original.ManagedClusterSnapshotsClient +type ManagedClusterStorageProfile = original.ManagedClusterStorageProfile +type ManagedClusterStorageProfileDiskCSIDriver = original.ManagedClusterStorageProfileDiskCSIDriver +type ManagedClusterStorageProfileFileCSIDriver = original.ManagedClusterStorageProfileFileCSIDriver +type ManagedClusterStorageProfileSnapshotController = original.ManagedClusterStorageProfileSnapshotController type ManagedClusterUpgradeProfile = original.ManagedClusterUpgradeProfile type ManagedClusterUpgradeProfileProperties = original.ManagedClusterUpgradeProfileProperties type ManagedClusterWindowsProfile = original.ManagedClusterWindowsProfile @@ -539,12 +556,14 @@ type ManagedClustersDeleteFuture = original.ManagedClustersDeleteFuture type ManagedClustersResetAADProfileFuture = original.ManagedClustersResetAADProfileFuture type ManagedClustersResetServicePrincipalProfileFuture = original.ManagedClustersResetServicePrincipalProfileFuture type ManagedClustersRotateClusterCertificatesFuture = original.ManagedClustersRotateClusterCertificatesFuture +type ManagedClustersRotateServiceAccountSigningKeysFuture = original.ManagedClustersRotateServiceAccountSigningKeysFuture type ManagedClustersRunCommandFuture = original.ManagedClustersRunCommandFuture type ManagedClustersStartFuture = original.ManagedClustersStartFuture type ManagedClustersStopFuture = original.ManagedClustersStopFuture type ManagedClustersUpdateTagsFuture = original.ManagedClustersUpdateTagsFuture type MasterProfile = original.MasterProfile type NetworkProfile = original.NetworkProfile +type NetworkProfileForSnapshot = original.NetworkProfileForSnapshot type OSOptionProfile = original.OSOptionProfile type OSOptionProperty = original.OSOptionProperty type OSOptionPropertyList = original.OSOptionPropertyList @@ -567,6 +586,7 @@ type PrivateLinkResource = original.PrivateLinkResource type PrivateLinkResourcesClient = original.PrivateLinkResourcesClient type PrivateLinkResourcesListResult = original.PrivateLinkResourcesListResult type PrivateLinkServiceConnectionState = original.PrivateLinkServiceConnectionState +type ProxyResource = original.ProxyResource type ResolvePrivateLinkServiceIDClient = original.ResolvePrivateLinkServiceIDClient type Resource = original.Resource type ResourceReference = original.ResourceReference @@ -586,6 +606,7 @@ type SystemData = original.SystemData type TagsObject = original.TagsObject type TimeInWeek = original.TimeInWeek type TimeSpan = original.TimeSpan +type TrackedResource = original.TrackedResource type UserAssignedIdentity = original.UserAssignedIdentity type VMDiagnostics = original.VMDiagnostics type WindowsGmsaProfile = original.WindowsGmsaProfile @@ -623,6 +644,18 @@ func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) Mana func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { return original.NewManagedClusterListResultPage(cur, getNextPage) } +func NewManagedClusterSnapshotListResultIterator(page ManagedClusterSnapshotListResultPage) ManagedClusterSnapshotListResultIterator { + return original.NewManagedClusterSnapshotListResultIterator(page) +} +func NewManagedClusterSnapshotListResultPage(cur ManagedClusterSnapshotListResult, getNextPage func(context.Context, ManagedClusterSnapshotListResult) (ManagedClusterSnapshotListResult, error)) ManagedClusterSnapshotListResultPage { + return original.NewManagedClusterSnapshotListResultPage(cur, getNextPage) +} +func NewManagedClusterSnapshotsClient(subscriptionID string) ManagedClusterSnapshotsClient { + return original.NewManagedClusterSnapshotsClient(subscriptionID) +} +func NewManagedClusterSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) ManagedClusterSnapshotsClient { + return original.NewManagedClusterSnapshotsClientWithBaseURI(baseURI, subscriptionID) +} func NewManagedClustersClient(subscriptionID string) ManagedClustersClient { return original.NewManagedClustersClient(subscriptionID) } diff --git a/profiles/preview/reservations/mgmt/reservations/models.go b/profiles/preview/reservations/mgmt/reservations/models.go index 7e8468ba7140..5f1742942e90 100644 --- a/profiles/preview/reservations/mgmt/reservations/models.go +++ b/profiles/preview/reservations/mgmt/reservations/models.go @@ -12,7 +12,7 @@ package reservations import ( "context" - original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2017-11-01/reservations" + original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations" ) const ( @@ -22,128 +22,146 @@ const ( type AppliedScopeType = original.AppliedScopeType const ( - Shared AppliedScopeType = original.Shared - Single AppliedScopeType = original.Single + AppliedScopeTypeShared AppliedScopeType = original.AppliedScopeTypeShared + AppliedScopeTypeSingle AppliedScopeType = original.AppliedScopeTypeSingle ) -type AppliedScopeType1 = original.AppliedScopeType1 +type CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatus const ( - AppliedScopeType1Shared AppliedScopeType1 = original.AppliedScopeType1Shared - AppliedScopeType1Single AppliedScopeType1 = original.AppliedScopeType1Single + CalculateExchangeOperationResultStatusCancelled CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusCancelled + CalculateExchangeOperationResultStatusFailed CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusFailed + CalculateExchangeOperationResultStatusPending CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusPending + CalculateExchangeOperationResultStatusSucceeded CalculateExchangeOperationResultStatus = original.CalculateExchangeOperationResultStatusSucceeded ) -type Code = original.Code +type CreatedByType = original.CreatedByType const ( - ActivateQuoteFailed Code = original.ActivateQuoteFailed - AppliedScopesNotAssociatedWithCommerceAccount Code = original.AppliedScopesNotAssociatedWithCommerceAccount - AppliedScopesSameAsExisting Code = original.AppliedScopesSameAsExisting - AuthorizationFailed Code = original.AuthorizationFailed - BadRequest Code = original.BadRequest - BillingCustomerInputError Code = original.BillingCustomerInputError - BillingError Code = original.BillingError - BillingPaymentInstrumentHardError Code = original.BillingPaymentInstrumentHardError - BillingPaymentInstrumentSoftError Code = original.BillingPaymentInstrumentSoftError - BillingScopeIDCannotBeChanged Code = original.BillingScopeIDCannotBeChanged - BillingTransientError Code = original.BillingTransientError - CalculatePriceFailed Code = original.CalculatePriceFailed - CapacityUpdateScopesFailed Code = original.CapacityUpdateScopesFailed - ClientCertificateThumbprintNotSet Code = original.ClientCertificateThumbprintNotSet - CreateQuoteFailed Code = original.CreateQuoteFailed - Forbidden Code = original.Forbidden - FulfillmentConfigurationError Code = original.FulfillmentConfigurationError - FulfillmentError Code = original.FulfillmentError - FulfillmentOutOfStockError Code = original.FulfillmentOutOfStockError - FulfillmentTransientError Code = original.FulfillmentTransientError - HTTPMethodNotSupported Code = original.HTTPMethodNotSupported - InternalServerError Code = original.InternalServerError - InvalidAccessToken Code = original.InvalidAccessToken - InvalidFulfillmentRequestParameters Code = original.InvalidFulfillmentRequestParameters - InvalidHealthCheckType Code = original.InvalidHealthCheckType - InvalidLocationID Code = original.InvalidLocationID - InvalidRefundQuantity Code = original.InvalidRefundQuantity - InvalidRequestContent Code = original.InvalidRequestContent - InvalidRequestURI Code = original.InvalidRequestURI - InvalidReservationID Code = original.InvalidReservationID - InvalidReservationOrderID Code = original.InvalidReservationOrderID - InvalidSingleAppliedScopesCount Code = original.InvalidSingleAppliedScopesCount - InvalidSubscriptionID Code = original.InvalidSubscriptionID - InvalidTenantID Code = original.InvalidTenantID - MissingAppliedScopesForSingle Code = original.MissingAppliedScopesForSingle - MissingTenantID Code = original.MissingTenantID - NonsupportedAccountID Code = original.NonsupportedAccountID - NotSpecified Code = original.NotSpecified - NotSupportedCountry Code = original.NotSupportedCountry - NoValidReservationsToReRate Code = original.NoValidReservationsToReRate - OperationCannotBePerformedInCurrentState Code = original.OperationCannotBePerformedInCurrentState - OperationFailed Code = original.OperationFailed - PaymentInstrumentNotFound Code = original.PaymentInstrumentNotFound - PurchaseError Code = original.PurchaseError - ReRateOnlyAllowedForEA Code = original.ReRateOnlyAllowedForEA - ReservationIDNotInReservationOrder Code = original.ReservationIDNotInReservationOrder - ReservationOrderCreationFailed Code = original.ReservationOrderCreationFailed - ReservationOrderIDAlreadyExists Code = original.ReservationOrderIDAlreadyExists - ReservationOrderNotEnabled Code = original.ReservationOrderNotEnabled - ReservationOrderNotFound Code = original.ReservationOrderNotFound - RiskCheckFailed Code = original.RiskCheckFailed - RoleAssignmentCreationFailed Code = original.RoleAssignmentCreationFailed - ServerTimeout Code = original.ServerTimeout - UnauthenticatedRequestsThrottled Code = original.UnauthenticatedRequestsThrottled - UnsupportedReservationTerm Code = original.UnsupportedReservationTerm + CreatedByTypeApplication CreatedByType = original.CreatedByTypeApplication + CreatedByTypeKey CreatedByType = original.CreatedByTypeKey + CreatedByTypeManagedIdentity CreatedByType = original.CreatedByTypeManagedIdentity + CreatedByTypeUser CreatedByType = original.CreatedByTypeUser +) + +type ErrorResponseCode = original.ErrorResponseCode + +const ( + ErrorResponseCodeActivateQuoteFailed ErrorResponseCode = original.ErrorResponseCodeActivateQuoteFailed + ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount ErrorResponseCode = original.ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount + ErrorResponseCodeAppliedScopesSameAsExisting ErrorResponseCode = original.ErrorResponseCodeAppliedScopesSameAsExisting + ErrorResponseCodeAuthorizationFailed ErrorResponseCode = original.ErrorResponseCodeAuthorizationFailed + ErrorResponseCodeBadRequest ErrorResponseCode = original.ErrorResponseCodeBadRequest + ErrorResponseCodeBillingCustomerInputError ErrorResponseCode = original.ErrorResponseCodeBillingCustomerInputError + ErrorResponseCodeBillingError ErrorResponseCode = original.ErrorResponseCodeBillingError + ErrorResponseCodeBillingPaymentInstrumentHardError ErrorResponseCode = original.ErrorResponseCodeBillingPaymentInstrumentHardError + ErrorResponseCodeBillingPaymentInstrumentSoftError ErrorResponseCode = original.ErrorResponseCodeBillingPaymentInstrumentSoftError + ErrorResponseCodeBillingScopeIDCannotBeChanged ErrorResponseCode = original.ErrorResponseCodeBillingScopeIDCannotBeChanged + ErrorResponseCodeBillingTransientError ErrorResponseCode = original.ErrorResponseCodeBillingTransientError + ErrorResponseCodeCalculatePriceFailed ErrorResponseCode = original.ErrorResponseCodeCalculatePriceFailed + ErrorResponseCodeCapacityUpdateScopesFailed ErrorResponseCode = original.ErrorResponseCodeCapacityUpdateScopesFailed + ErrorResponseCodeClientCertificateThumbprintNotSet ErrorResponseCode = original.ErrorResponseCodeClientCertificateThumbprintNotSet + ErrorResponseCodeCreateQuoteFailed ErrorResponseCode = original.ErrorResponseCodeCreateQuoteFailed + ErrorResponseCodeForbidden ErrorResponseCode = original.ErrorResponseCodeForbidden + ErrorResponseCodeFulfillmentConfigurationError ErrorResponseCode = original.ErrorResponseCodeFulfillmentConfigurationError + ErrorResponseCodeFulfillmentError ErrorResponseCode = original.ErrorResponseCodeFulfillmentError + ErrorResponseCodeFulfillmentOutOfStockError ErrorResponseCode = original.ErrorResponseCodeFulfillmentOutOfStockError + ErrorResponseCodeFulfillmentTransientError ErrorResponseCode = original.ErrorResponseCodeFulfillmentTransientError + ErrorResponseCodeHTTPMethodNotSupported ErrorResponseCode = original.ErrorResponseCodeHTTPMethodNotSupported + ErrorResponseCodeInternalServerError ErrorResponseCode = original.ErrorResponseCodeInternalServerError + ErrorResponseCodeInvalidAccessToken ErrorResponseCode = original.ErrorResponseCodeInvalidAccessToken + ErrorResponseCodeInvalidFulfillmentRequestParameters ErrorResponseCode = original.ErrorResponseCodeInvalidFulfillmentRequestParameters + ErrorResponseCodeInvalidHealthCheckType ErrorResponseCode = original.ErrorResponseCodeInvalidHealthCheckType + ErrorResponseCodeInvalidLocationID ErrorResponseCode = original.ErrorResponseCodeInvalidLocationID + ErrorResponseCodeInvalidRefundQuantity ErrorResponseCode = original.ErrorResponseCodeInvalidRefundQuantity + ErrorResponseCodeInvalidRequestContent ErrorResponseCode = original.ErrorResponseCodeInvalidRequestContent + ErrorResponseCodeInvalidRequestURI ErrorResponseCode = original.ErrorResponseCodeInvalidRequestURI + ErrorResponseCodeInvalidReservationID ErrorResponseCode = original.ErrorResponseCodeInvalidReservationID + ErrorResponseCodeInvalidReservationOrderID ErrorResponseCode = original.ErrorResponseCodeInvalidReservationOrderID + ErrorResponseCodeInvalidSingleAppliedScopesCount ErrorResponseCode = original.ErrorResponseCodeInvalidSingleAppliedScopesCount + ErrorResponseCodeInvalidSubscriptionID ErrorResponseCode = original.ErrorResponseCodeInvalidSubscriptionID + ErrorResponseCodeInvalidTenantID ErrorResponseCode = original.ErrorResponseCodeInvalidTenantID + ErrorResponseCodeMissingAppliedScopesForSingle ErrorResponseCode = original.ErrorResponseCodeMissingAppliedScopesForSingle + ErrorResponseCodeMissingTenantID ErrorResponseCode = original.ErrorResponseCodeMissingTenantID + ErrorResponseCodeNonsupportedAccountID ErrorResponseCode = original.ErrorResponseCodeNonsupportedAccountID + ErrorResponseCodeNotSpecified ErrorResponseCode = original.ErrorResponseCodeNotSpecified + ErrorResponseCodeNotSupportedCountry ErrorResponseCode = original.ErrorResponseCodeNotSupportedCountry + ErrorResponseCodeNoValidReservationsToReRate ErrorResponseCode = original.ErrorResponseCodeNoValidReservationsToReRate + ErrorResponseCodeOperationCannotBePerformedInCurrentState ErrorResponseCode = original.ErrorResponseCodeOperationCannotBePerformedInCurrentState + ErrorResponseCodeOperationFailed ErrorResponseCode = original.ErrorResponseCodeOperationFailed + ErrorResponseCodePatchValuesSameAsExisting ErrorResponseCode = original.ErrorResponseCodePatchValuesSameAsExisting + ErrorResponseCodePaymentInstrumentNotFound ErrorResponseCode = original.ErrorResponseCodePaymentInstrumentNotFound + ErrorResponseCodePurchaseError ErrorResponseCode = original.ErrorResponseCodePurchaseError + ErrorResponseCodeReRateOnlyAllowedForEA ErrorResponseCode = original.ErrorResponseCodeReRateOnlyAllowedForEA + ErrorResponseCodeReservationIDNotInReservationOrder ErrorResponseCode = original.ErrorResponseCodeReservationIDNotInReservationOrder + ErrorResponseCodeReservationOrderCreationFailed ErrorResponseCode = original.ErrorResponseCodeReservationOrderCreationFailed + ErrorResponseCodeReservationOrderIDAlreadyExists ErrorResponseCode = original.ErrorResponseCodeReservationOrderIDAlreadyExists + ErrorResponseCodeReservationOrderNotEnabled ErrorResponseCode = original.ErrorResponseCodeReservationOrderNotEnabled + ErrorResponseCodeReservationOrderNotFound ErrorResponseCode = original.ErrorResponseCodeReservationOrderNotFound + ErrorResponseCodeRiskCheckFailed ErrorResponseCode = original.ErrorResponseCodeRiskCheckFailed + ErrorResponseCodeRoleAssignmentCreationFailed ErrorResponseCode = original.ErrorResponseCodeRoleAssignmentCreationFailed + ErrorResponseCodeServerTimeout ErrorResponseCode = original.ErrorResponseCodeServerTimeout + ErrorResponseCodeUnauthenticatedRequestsThrottled ErrorResponseCode = original.ErrorResponseCodeUnauthenticatedRequestsThrottled + ErrorResponseCodeUnsupportedReservationTerm ErrorResponseCode = original.ErrorResponseCodeUnsupportedReservationTerm +) + +type ExchangeOperationResultStatus = original.ExchangeOperationResultStatus + +const ( + ExchangeOperationResultStatusCancelled ExchangeOperationResultStatus = original.ExchangeOperationResultStatusCancelled + ExchangeOperationResultStatusFailed ExchangeOperationResultStatus = original.ExchangeOperationResultStatusFailed + ExchangeOperationResultStatusPendingPurchases ExchangeOperationResultStatus = original.ExchangeOperationResultStatusPendingPurchases + ExchangeOperationResultStatusPendingRefunds ExchangeOperationResultStatus = original.ExchangeOperationResultStatusPendingRefunds + ExchangeOperationResultStatusSucceeded ExchangeOperationResultStatus = original.ExchangeOperationResultStatusSucceeded +) + +type InstanceFlexibility = original.InstanceFlexibility + +const ( + InstanceFlexibilityOff InstanceFlexibility = original.InstanceFlexibilityOff + InstanceFlexibilityOn InstanceFlexibility = original.InstanceFlexibilityOn ) type Kind = original.Kind const ( - MicrosoftCompute Kind = original.MicrosoftCompute + KindMicrosoftCompute Kind = original.KindMicrosoftCompute +) + +type OperationStatus = original.OperationStatus + +const ( + OperationStatusCancelled OperationStatus = original.OperationStatusCancelled + OperationStatusFailed OperationStatus = original.OperationStatusFailed + OperationStatusPending OperationStatus = original.OperationStatusPending + OperationStatusSucceeded OperationStatus = original.OperationStatusSucceeded ) -type Location = original.Location +type PaymentStatus = original.PaymentStatus const ( - Australiaeast Location = original.Australiaeast - Australiasoutheast Location = original.Australiasoutheast - Brazilsouth Location = original.Brazilsouth - Canadacentral Location = original.Canadacentral - Canadaeast Location = original.Canadaeast - Centralindia Location = original.Centralindia - Centralus Location = original.Centralus - Eastasia Location = original.Eastasia - Eastus Location = original.Eastus - Eastus2 Location = original.Eastus2 - Japaneast Location = original.Japaneast - Japanwest Location = original.Japanwest - Northcentralus Location = original.Northcentralus - Northeurope Location = original.Northeurope - Southcentralus Location = original.Southcentralus - Southeastasia Location = original.Southeastasia - Southindia Location = original.Southindia - Uksouth Location = original.Uksouth - Ukwest Location = original.Ukwest - Westcentralus Location = original.Westcentralus - Westeurope Location = original.Westeurope - Westindia Location = original.Westindia - Westus Location = original.Westus - Westus2 Location = original.Westus2 + PaymentStatusCancelled PaymentStatus = original.PaymentStatusCancelled + PaymentStatusFailed PaymentStatus = original.PaymentStatusFailed + PaymentStatusScheduled PaymentStatus = original.PaymentStatusScheduled + PaymentStatusSucceeded PaymentStatus = original.PaymentStatusSucceeded ) type ProvisioningState = original.ProvisioningState const ( - BillingFailed ProvisioningState = original.BillingFailed - Cancelled ProvisioningState = original.Cancelled - ConfirmedBilling ProvisioningState = original.ConfirmedBilling - ConfirmedResourceHold ProvisioningState = original.ConfirmedResourceHold - Created ProvisioningState = original.Created - Creating ProvisioningState = original.Creating - Expired ProvisioningState = original.Expired - Failed ProvisioningState = original.Failed - Merged ProvisioningState = original.Merged - PendingBilling ProvisioningState = original.PendingBilling - PendingResourceHold ProvisioningState = original.PendingResourceHold - Split ProvisioningState = original.Split - Succeeded ProvisioningState = original.Succeeded + ProvisioningStateBillingFailed ProvisioningState = original.ProvisioningStateBillingFailed + ProvisioningStateCancelled ProvisioningState = original.ProvisioningStateCancelled + ProvisioningStateConfirmedBilling ProvisioningState = original.ProvisioningStateConfirmedBilling + ProvisioningStateConfirmedResourceHold ProvisioningState = original.ProvisioningStateConfirmedResourceHold + ProvisioningStateCreated ProvisioningState = original.ProvisioningStateCreated + ProvisioningStateCreating ProvisioningState = original.ProvisioningStateCreating + ProvisioningStateExpired ProvisioningState = original.ProvisioningStateExpired + ProvisioningStateFailed ProvisioningState = original.ProvisioningStateFailed + ProvisioningStateMerged ProvisioningState = original.ProvisioningStateMerged + ProvisioningStatePendingBilling ProvisioningState = original.ProvisioningStatePendingBilling + ProvisioningStatePendingResourceHold ProvisioningState = original.ProvisioningStatePendingResourceHold + ProvisioningStateSplit ProvisioningState = original.ProvisioningStateSplit + ProvisioningStateSucceeded ProvisioningState = original.ProvisioningStateSucceeded ) type ProvisioningState1 = original.ProvisioningState1 @@ -164,6 +182,72 @@ const ( ProvisioningState1Succeeded ProvisioningState1 = original.ProvisioningState1Succeeded ) +type QuotaRequestState = original.QuotaRequestState + +const ( + QuotaRequestStateAccepted QuotaRequestState = original.QuotaRequestStateAccepted + QuotaRequestStateFailed QuotaRequestState = original.QuotaRequestStateFailed + QuotaRequestStateInProgress QuotaRequestState = original.QuotaRequestStateInProgress + QuotaRequestStateInvalid QuotaRequestState = original.QuotaRequestStateInvalid + QuotaRequestStateSucceeded QuotaRequestState = original.QuotaRequestStateSucceeded +) + +type ReservationBillingPlan = original.ReservationBillingPlan + +const ( + ReservationBillingPlanMonthly ReservationBillingPlan = original.ReservationBillingPlanMonthly + ReservationBillingPlanUpfront ReservationBillingPlan = original.ReservationBillingPlanUpfront +) + +type ReservationTerm = original.ReservationTerm + +const ( + ReservationTermP1Y ReservationTerm = original.ReservationTermP1Y + ReservationTermP3Y ReservationTerm = original.ReservationTermP3Y + ReservationTermP5Y ReservationTerm = original.ReservationTermP5Y +) + +type ReservedResourceType = original.ReservedResourceType + +const ( + ReservedResourceTypeAppService ReservedResourceType = original.ReservedResourceTypeAppService + ReservedResourceTypeAVS ReservedResourceType = original.ReservedResourceTypeAVS + ReservedResourceTypeAzureDataExplorer ReservedResourceType = original.ReservedResourceTypeAzureDataExplorer + ReservedResourceTypeAzureFiles ReservedResourceType = original.ReservedResourceTypeAzureFiles + ReservedResourceTypeBlockBlob ReservedResourceType = original.ReservedResourceTypeBlockBlob + ReservedResourceTypeCosmosDb ReservedResourceType = original.ReservedResourceTypeCosmosDb + ReservedResourceTypeDatabricks ReservedResourceType = original.ReservedResourceTypeDatabricks + ReservedResourceTypeDataFactory ReservedResourceType = original.ReservedResourceTypeDataFactory + ReservedResourceTypeDedicatedHost ReservedResourceType = original.ReservedResourceTypeDedicatedHost + ReservedResourceTypeManagedDisk ReservedResourceType = original.ReservedResourceTypeManagedDisk + ReservedResourceTypeMariaDb ReservedResourceType = original.ReservedResourceTypeMariaDb + ReservedResourceTypeMySQL ReservedResourceType = original.ReservedResourceTypeMySQL + ReservedResourceTypeNetAppStorage ReservedResourceType = original.ReservedResourceTypeNetAppStorage + ReservedResourceTypePostgreSQL ReservedResourceType = original.ReservedResourceTypePostgreSQL + ReservedResourceTypeRedHat ReservedResourceType = original.ReservedResourceTypeRedHat + ReservedResourceTypeRedHatOsa ReservedResourceType = original.ReservedResourceTypeRedHatOsa + ReservedResourceTypeRedisCache ReservedResourceType = original.ReservedResourceTypeRedisCache + ReservedResourceTypeSapHana ReservedResourceType = original.ReservedResourceTypeSapHana + ReservedResourceTypeSQLAzureHybridBenefit ReservedResourceType = original.ReservedResourceTypeSQLAzureHybridBenefit + ReservedResourceTypeSQLDatabases ReservedResourceType = original.ReservedResourceTypeSQLDatabases + ReservedResourceTypeSQLDataWarehouse ReservedResourceType = original.ReservedResourceTypeSQLDataWarehouse + ReservedResourceTypeSQLEdge ReservedResourceType = original.ReservedResourceTypeSQLEdge + ReservedResourceTypeSuseLinux ReservedResourceType = original.ReservedResourceTypeSuseLinux + ReservedResourceTypeVirtualMachines ReservedResourceType = original.ReservedResourceTypeVirtualMachines + ReservedResourceTypeVirtualMachineSoftware ReservedResourceType = original.ReservedResourceTypeVirtualMachineSoftware + ReservedResourceTypeVMwareCloudSimple ReservedResourceType = original.ReservedResourceTypeVMwareCloudSimple +) + +type ResourceType = original.ResourceType + +const ( + ResourceTypeDedicated ResourceType = original.ResourceTypeDedicated + ResourceTypeLowPriority ResourceType = original.ResourceTypeLowPriority + ResourceTypeServiceSpecific ResourceType = original.ResourceTypeServiceSpecific + ResourceTypeShared ResourceType = original.ResourceTypeShared + ResourceTypeStandard ResourceType = original.ResourceTypeStandard +) + type StatusCode = original.StatusCode const ( @@ -173,25 +257,51 @@ const ( StatusCodeNone StatusCode = original.StatusCodeNone StatusCodePaymentInstrumentError StatusCode = original.StatusCodePaymentInstrumentError StatusCodePending StatusCode = original.StatusCodePending + StatusCodeProcessing StatusCode = original.StatusCodeProcessing StatusCodePurchaseError StatusCode = original.StatusCodePurchaseError StatusCodeSplit StatusCode = original.StatusCodeSplit StatusCodeSucceeded StatusCode = original.StatusCodeSucceeded ) -type Term = original.Term - -const ( - P1Y Term = original.P1Y - P3Y Term = original.P3Y -) - type AppliedReservationList = original.AppliedReservationList type AppliedReservations = original.AppliedReservations type AppliedReservationsProperties = original.AppliedReservationsProperties +type AvailableScopeProperties = original.AvailableScopeProperties +type AvailableScopeRequest = original.AvailableScopeRequest +type AvailableScopeRequestProperties = original.AvailableScopeRequestProperties type BaseClient = original.BaseClient +type BillingInformation = original.BillingInformation +type CalculateExchangeClient = original.CalculateExchangeClient +type CalculateExchangeOperationResultResponse = original.CalculateExchangeOperationResultResponse +type CalculateExchangePostFuture = original.CalculateExchangePostFuture +type CalculateExchangeRequest = original.CalculateExchangeRequest +type CalculateExchangeRequestProperties = original.CalculateExchangeRequestProperties +type CalculateExchangeResponseProperties = original.CalculateExchangeResponseProperties +type CalculatePriceResponse = original.CalculatePriceResponse +type CalculatePriceResponseProperties = original.CalculatePriceResponseProperties +type CalculatePriceResponsePropertiesBillingCurrencyTotal = original.CalculatePriceResponsePropertiesBillingCurrencyTotal +type CalculatePriceResponsePropertiesPricingCurrencyTotal = original.CalculatePriceResponsePropertiesPricingCurrencyTotal type Catalog = original.Catalog +type CatalogMsrp = original.CatalogMsrp +type ChangeDirectoryRequest = original.ChangeDirectoryRequest +type ChangeDirectoryResponse = original.ChangeDirectoryResponse +type ChangeDirectoryResult = original.ChangeDirectoryResult type Client = original.Client +type CreateGenericQuotaRequestParameters = original.CreateGenericQuotaRequestParameters +type CurrentQuotaLimit = original.CurrentQuotaLimit +type CurrentQuotaLimitBase = original.CurrentQuotaLimitBase type Error = original.Error +type ErrorDetails = original.ErrorDetails +type ErrorResponse = original.ErrorResponse +type ExceptionResponse = original.ExceptionResponse +type ExchangeClient = original.ExchangeClient +type ExchangeOperationResultResponse = original.ExchangeOperationResultResponse +type ExchangePolicyError = original.ExchangePolicyError +type ExchangePolicyErrors = original.ExchangePolicyErrors +type ExchangePostFuture = original.ExchangePostFuture +type ExchangeRequest = original.ExchangeRequest +type ExchangeRequestProperties = original.ExchangeRequestProperties +type ExchangeResponseProperties = original.ExchangeResponseProperties type ExtendedErrorInfo = original.ExtendedErrorInfo type ExtendedStatusInfo = original.ExtendedStatusInfo type List = original.List @@ -199,6 +309,9 @@ type ListCatalog = original.ListCatalog type ListIterator = original.ListIterator type ListPage = original.ListPage type ListResponse = original.ListResponse +type ListResult = original.ListResult +type ListResultIterator = original.ListResultIterator +type ListResultPage = original.ListResultPage type MergeProperties = original.MergeProperties type MergePropertiesType = original.MergePropertiesType type MergeRequest = original.MergeRequest @@ -208,41 +321,108 @@ type OperationList = original.OperationList type OperationListIterator = original.OperationListIterator type OperationListPage = original.OperationListPage type OperationResponse = original.OperationResponse +type OperationResultError = original.OperationResultError +type OrderBillingPlanInformation = original.OrderBillingPlanInformation type OrderClient = original.OrderClient type OrderList = original.OrderList type OrderListIterator = original.OrderListIterator type OrderListPage = original.OrderListPage type OrderProperties = original.OrderProperties +type OrderPurchaseFuture = original.OrderPurchaseFuture type OrderResponse = original.OrderResponse type Patch = original.Patch type PatchProperties = original.PatchProperties +type PatchPropertiesRenewProperties = original.PatchPropertiesRenewProperties +type PaymentDetail = original.PaymentDetail +type Price = original.Price type Properties = original.Properties +type PropertiesUtilization = original.PropertiesUtilization +type PurchaseRequest = original.PurchaseRequest +type PurchaseRequestProperties = original.PurchaseRequestProperties +type PurchaseRequestPropertiesReservedResourceProperties = original.PurchaseRequestPropertiesReservedResourceProperties +type QuotaClient = original.QuotaClient +type QuotaCreateOrUpdateFuture = original.QuotaCreateOrUpdateFuture +type QuotaLimits = original.QuotaLimits +type QuotaLimitsIterator = original.QuotaLimitsIterator +type QuotaLimitsPage = original.QuotaLimitsPage +type QuotaLimitsResponse = original.QuotaLimitsResponse +type QuotaProperties = original.QuotaProperties +type QuotaRequestDetails = original.QuotaRequestDetails +type QuotaRequestDetailsList = original.QuotaRequestDetailsList +type QuotaRequestDetailsListIterator = original.QuotaRequestDetailsListIterator +type QuotaRequestDetailsListPage = original.QuotaRequestDetailsListPage +type QuotaRequestOneResourceProperties = original.QuotaRequestOneResourceProperties +type QuotaRequestOneResourceSubmitResponse = original.QuotaRequestOneResourceSubmitResponse +type QuotaRequestProperties = original.QuotaRequestProperties +type QuotaRequestStatusClient = original.QuotaRequestStatusClient +type QuotaRequestStatusDetails = original.QuotaRequestStatusDetails +type QuotaRequestSubmitResponse = original.QuotaRequestSubmitResponse +type QuotaRequestSubmitResponse201 = original.QuotaRequestSubmitResponse201 +type QuotaUpdateFuture = original.QuotaUpdateFuture +type RenewPropertiesResponse = original.RenewPropertiesResponse +type RenewPropertiesResponseBillingCurrencyTotal = original.RenewPropertiesResponseBillingCurrencyTotal +type RenewPropertiesResponsePricingCurrencyTotal = original.RenewPropertiesResponsePricingCurrencyTotal +type ReservationAvailableScopesFuture = original.ReservationAvailableScopesFuture type ReservationMergeFuture = original.ReservationMergeFuture type ReservationUpdateFuture = original.ReservationUpdateFuture +type ResourceName = original.ResourceName type Response = original.Response +type ScopeProperties = original.ScopeProperties +type ServiceError = original.ServiceError +type ServiceErrorDetail = original.ServiceErrorDetail +type SetObject = original.SetObject type SkuCapability = original.SkuCapability type SkuName = original.SkuName +type SkuProperty = original.SkuProperty type SkuRestriction = original.SkuRestriction type SplitFuture = original.SplitFuture type SplitProperties = original.SplitProperties type SplitPropertiesType = original.SplitPropertiesType type SplitRequest = original.SplitRequest +type SubRequest = original.SubRequest +type SubscriptionScopeProperties = original.SubscriptionScopeProperties +type Summary = original.Summary +type SystemData = original.SystemData +type ToExchange = original.ToExchange +type ToPurchaseCalculateExchange = original.ToPurchaseCalculateExchange +type ToPurchaseExchange = original.ToPurchaseExchange +type ToReturn = original.ToReturn +type ToReturnForExchange = original.ToReturnForExchange +type UtilizationAggregates = original.UtilizationAggregates func New() BaseClient { return original.New() } +func NewCalculateExchangeClient() CalculateExchangeClient { + return original.NewCalculateExchangeClient() +} +func NewCalculateExchangeClientWithBaseURI(baseURI string) CalculateExchangeClient { + return original.NewCalculateExchangeClientWithBaseURI(baseURI) +} func NewClient() Client { return original.NewClient() } func NewClientWithBaseURI(baseURI string) Client { return original.NewClientWithBaseURI(baseURI) } +func NewExchangeClient() ExchangeClient { + return original.NewExchangeClient() +} +func NewExchangeClientWithBaseURI(baseURI string) ExchangeClient { + return original.NewExchangeClientWithBaseURI(baseURI) +} func NewListIterator(page ListPage) ListIterator { return original.NewListIterator(page) } func NewListPage(cur List, getNextPage func(context.Context, List) (List, error)) ListPage { return original.NewListPage(cur, getNextPage) } +func NewListResultIterator(page ListResultPage) ListResultIterator { + return original.NewListResultIterator(page) +} +func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { + return original.NewListResultPage(cur, getNextPage) +} func NewOperationClient() OperationClient { return original.NewOperationClient() } @@ -267,23 +447,59 @@ func NewOrderListIterator(page OrderListPage) OrderListIterator { func NewOrderListPage(cur OrderList, getNextPage func(context.Context, OrderList) (OrderList, error)) OrderListPage { return original.NewOrderListPage(cur, getNextPage) } +func NewQuotaClient() QuotaClient { + return original.NewQuotaClient() +} +func NewQuotaClientWithBaseURI(baseURI string) QuotaClient { + return original.NewQuotaClientWithBaseURI(baseURI) +} +func NewQuotaLimitsIterator(page QuotaLimitsPage) QuotaLimitsIterator { + return original.NewQuotaLimitsIterator(page) +} +func NewQuotaLimitsPage(cur QuotaLimits, getNextPage func(context.Context, QuotaLimits) (QuotaLimits, error)) QuotaLimitsPage { + return original.NewQuotaLimitsPage(cur, getNextPage) +} +func NewQuotaRequestDetailsListIterator(page QuotaRequestDetailsListPage) QuotaRequestDetailsListIterator { + return original.NewQuotaRequestDetailsListIterator(page) +} +func NewQuotaRequestDetailsListPage(cur QuotaRequestDetailsList, getNextPage func(context.Context, QuotaRequestDetailsList) (QuotaRequestDetailsList, error)) QuotaRequestDetailsListPage { + return original.NewQuotaRequestDetailsListPage(cur, getNextPage) +} +func NewQuotaRequestStatusClient() QuotaRequestStatusClient { + return original.NewQuotaRequestStatusClient() +} +func NewQuotaRequestStatusClientWithBaseURI(baseURI string) QuotaRequestStatusClient { + return original.NewQuotaRequestStatusClientWithBaseURI(baseURI) +} func NewWithBaseURI(baseURI string) BaseClient { return original.NewWithBaseURI(baseURI) } -func PossibleAppliedScopeType1Values() []AppliedScopeType1 { - return original.PossibleAppliedScopeType1Values() -} func PossibleAppliedScopeTypeValues() []AppliedScopeType { return original.PossibleAppliedScopeTypeValues() } -func PossibleCodeValues() []Code { - return original.PossibleCodeValues() +func PossibleCalculateExchangeOperationResultStatusValues() []CalculateExchangeOperationResultStatus { + return original.PossibleCalculateExchangeOperationResultStatusValues() +} +func PossibleCreatedByTypeValues() []CreatedByType { + return original.PossibleCreatedByTypeValues() +} +func PossibleErrorResponseCodeValues() []ErrorResponseCode { + return original.PossibleErrorResponseCodeValues() +} +func PossibleExchangeOperationResultStatusValues() []ExchangeOperationResultStatus { + return original.PossibleExchangeOperationResultStatusValues() +} +func PossibleInstanceFlexibilityValues() []InstanceFlexibility { + return original.PossibleInstanceFlexibilityValues() } func PossibleKindValues() []Kind { return original.PossibleKindValues() } -func PossibleLocationValues() []Location { - return original.PossibleLocationValues() +func PossibleOperationStatusValues() []OperationStatus { + return original.PossibleOperationStatusValues() +} +func PossiblePaymentStatusValues() []PaymentStatus { + return original.PossiblePaymentStatusValues() } func PossibleProvisioningState1Values() []ProvisioningState1 { return original.PossibleProvisioningState1Values() @@ -291,12 +507,24 @@ func PossibleProvisioningState1Values() []ProvisioningState1 { func PossibleProvisioningStateValues() []ProvisioningState { return original.PossibleProvisioningStateValues() } +func PossibleQuotaRequestStateValues() []QuotaRequestState { + return original.PossibleQuotaRequestStateValues() +} +func PossibleReservationBillingPlanValues() []ReservationBillingPlan { + return original.PossibleReservationBillingPlanValues() +} +func PossibleReservationTermValues() []ReservationTerm { + return original.PossibleReservationTermValues() +} +func PossibleReservedResourceTypeValues() []ReservedResourceType { + return original.PossibleReservedResourceTypeValues() +} +func PossibleResourceTypeValues() []ResourceType { + return original.PossibleResourceTypeValues() +} func PossibleStatusCodeValues() []StatusCode { return original.PossibleStatusCodeValues() } -func PossibleTermValues() []Term { - return original.PossibleTermValues() -} func UserAgent() string { return original.UserAgent() + " profiles/preview" } diff --git a/profiles/preview/reservations/mgmt/reservations/reservationsapi/models.go b/profiles/preview/reservations/mgmt/reservations/reservationsapi/models.go index 3ba16f68e6b3..821f0cd6f37a 100644 --- a/profiles/preview/reservations/mgmt/reservations/reservationsapi/models.go +++ b/profiles/preview/reservations/mgmt/reservations/reservationsapi/models.go @@ -9,9 +9,13 @@ package reservationsapi -import original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2017-11-01/reservations/reservationsapi" +import original "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations/reservationsapi" type BaseClientAPI = original.BaseClientAPI +type CalculateExchangeClientAPI = original.CalculateExchangeClientAPI type ClientAPI = original.ClientAPI +type ExchangeClientAPI = original.ExchangeClientAPI type OperationClientAPI = original.OperationClientAPI type OrderClientAPI = original.OrderClientAPI +type QuotaClientAPI = original.QuotaClientAPI +type QuotaRequestStatusClientAPI = original.QuotaRequestStatusClientAPI diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/CHANGELOG.md b/services/containerservice/mgmt/2022-03-01/containerservice/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/_meta.json b/services/containerservice/mgmt/2022-03-01/containerservice/_meta.json new file mode 100644 index 000000000000..ea0983fffdab --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", + "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "tag": "package-2022-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/agentpools.go b/services/containerservice/mgmt/2022-03-01/containerservice/agentpools.go new file mode 100644 index 000000000000..e92a815c9938 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/agentpools.go @@ -0,0 +1,729 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AgentPoolsClient is the the Container Service Client. +type AgentPoolsClient struct { + BaseClient +} + +// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. +func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { + return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { + return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +// parameters - the agent pool to create or update. +func (client AgentPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (result AgentPoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, agentPoolName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AgentPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) CreateOrUpdateSender(req *http.Request) (future AgentPoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAvailableAgentPoolVersions see [supported Kubernetes +// versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version +// lifecycle. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolAvailableVersions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetAvailableAgentPoolVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", err.Error()) + } + + req, err := client.GetAvailableAgentPoolVersionsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableAgentPoolVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableAgentPoolVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure responding to request") + return + } + + return +} + +// GetAvailableAgentPoolVersionsPreparer prepares the GetAvailableAgentPoolVersions request. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAvailableAgentPoolVersionsSender sends the GetAvailableAgentPoolVersions request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAvailableAgentPoolVersionsResponder handles the response to the GetAvailableAgentPoolVersions request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsResponder(resp *http.Response) (result AgentPoolAvailableVersions, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetUpgradeProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client AgentPoolsClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetUpgradeProfileResponder(resp *http.Response) (result AgentPoolUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.aplr.Response.Response != nil { + sc = result.aplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure sending request") + return + } + + result.aplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure responding to request") + return + } + if result.aplr.hasNextLink() && result.aplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { + req, err := lastResults.agentPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// UpgradeNodeImageVersion upgrading the node image version of an agent pool applies the newest OS and runtime updates +// to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, +// see: https://docs.microsoft.com/azure/aks/node-image-upgrade +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsUpgradeNodeImageVersionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.UpgradeNodeImageVersion") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", err.Error()) + } + + req, err := client.UpgradeNodeImageVersionPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") + return + } + + result, err = client.UpgradeNodeImageVersionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", result.Response(), "Failure sending request") + return + } + + return +} + +// UpgradeNodeImageVersionPreparer prepares the UpgradeNodeImageVersion request. +func (client AgentPoolsClient) UpgradeNodeImageVersionPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpgradeNodeImageVersionSender sends the UpgradeNodeImageVersion request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) UpgradeNodeImageVersionSender(req *http.Request) (future AgentPoolsUpgradeNodeImageVersionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpgradeNodeImageVersionResponder handles the response to the UpgradeNodeImageVersion request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) UpgradeNodeImageVersionResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/client.go b/services/containerservice/mgmt/2022-03-01/containerservice/client.go new file mode 100644 index 000000000000..27d2831d7d1f --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/client.go @@ -0,0 +1,41 @@ +// Package containerservice implements the Azure ARM Containerservice service API version 2022-03-01. +// +// The Container Service Client. +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerservice. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/containerserviceapi/interfaces.go b/services/containerservice/mgmt/2022-03-01/containerservice/containerserviceapi/interfaces.go new file mode 100644 index 000000000000..d9fe15ae8586 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/containerserviceapi/interfaces.go @@ -0,0 +1,112 @@ +package containerserviceapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result containerservice.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*containerservice.OperationsClient)(nil) + +// ManagedClustersClientAPI contains the set of methods on the ManagedClustersClient type. +type ManagedClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedCluster) (result containerservice.ManagedClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedCluster, err error) + GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result containerservice.ManagedClusterAccessProfile, err error) + GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result containerservice.RunCommandResult, err error) + GetOSOptions(ctx context.Context, location string, resourceType string) (result containerservice.OSOptionProfile, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClusterUpgradeProfile, err error) + List(ctx context.Context) (result containerservice.ManagedClusterListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.ManagedClusterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultIterator, err error) + ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter containerservice.Format) (result containerservice.CredentialResults, err error) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionPage, err error) + ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionIterator, err error) + ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterAADProfile) (result containerservice.ManagedClustersResetAADProfileFuture, err error) + ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterServicePrincipalProfile) (result containerservice.ManagedClustersResetServicePrincipalProfileFuture, err error) + RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersRotateClusterCertificatesFuture, err error) + RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload containerservice.RunCommandRequest) (result containerservice.ManagedClustersRunCommandFuture, err error) + Start(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStopFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.ManagedClustersUpdateTagsFuture, err error) +} + +var _ ManagedClustersClientAPI = (*containerservice.ManagedClustersClient)(nil) + +// MaintenanceConfigurationsClientAPI contains the set of methods on the MaintenanceConfigurationsClient type. +type MaintenanceConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters containerservice.MaintenanceConfiguration) (result containerservice.MaintenanceConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result containerservice.MaintenanceConfiguration, err error) + ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultPage, err error) + ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultIterator, err error) +} + +var _ MaintenanceConfigurationsClientAPI = (*containerservice.MaintenanceConfigurationsClient)(nil) + +// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. +type AgentPoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters containerservice.AgentPool) (result containerservice.AgentPoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPool, err error) + GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolAvailableVersions, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolUpgradeProfile, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultIterator, err error) + UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolsUpgradeNodeImageVersionFuture, err error) +} + +var _ AgentPoolsClientAPI = (*containerservice.AgentPoolsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateEndpointConnectionListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters containerservice.PrivateEndpointConnection) (result containerservice.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*containerservice.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateLinkResourcesListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*containerservice.PrivateLinkResourcesClient)(nil) + +// ResolvePrivateLinkServiceIDClientAPI contains the set of methods on the ResolvePrivateLinkServiceIDClient type. +type ResolvePrivateLinkServiceIDClientAPI interface { + POST(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.PrivateLinkResource) (result containerservice.PrivateLinkResource, err error) +} + +var _ ResolvePrivateLinkServiceIDClientAPI = (*containerservice.ResolvePrivateLinkServiceIDClient)(nil) + +// SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. +type SnapshotsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.Snapshot) (result containerservice.Snapshot, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.Snapshot, err error) + List(ctx context.Context) (result containerservice.SnapshotListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.SnapshotListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.Snapshot, err error) +} + +var _ SnapshotsClientAPI = (*containerservice.SnapshotsClient)(nil) diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/enums.go b/services/containerservice/mgmt/2022-03-01/containerservice/enums.go new file mode 100644 index 000000000000..7b4dad1a3714 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/enums.go @@ -0,0 +1,979 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AgentPoolMode enumerates the values for agent pool mode. +type AgentPoolMode string + +const ( + // AgentPoolModeSystem System agent pools are primarily for hosting critical system pods such as CoreDNS + // and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + // least 2vCPUs and 4GB of memory. + AgentPoolModeSystem AgentPoolMode = "System" + // AgentPoolModeUser User agent pools are primarily for hosting your application pods. + AgentPoolModeUser AgentPoolMode = "User" +) + +// PossibleAgentPoolModeValues returns an array of possible values for the AgentPoolMode const type. +func PossibleAgentPoolModeValues() []AgentPoolMode { + return []AgentPoolMode{AgentPoolModeSystem, AgentPoolModeUser} +} + +// AgentPoolType enumerates the values for agent pool type. +type AgentPoolType string + +const ( + // AgentPoolTypeAvailabilitySet Use of this is strongly discouraged. + AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" + // AgentPoolTypeVirtualMachineScaleSets Create an Agent Pool backed by a Virtual Machine Scale Set. + AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" +) + +// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. +func PossibleAgentPoolTypeValues() []AgentPoolType { + return []AgentPoolType{AgentPoolTypeAvailabilitySet, AgentPoolTypeVirtualMachineScaleSets} +} + +// Code enumerates the values for code. +type Code string + +const ( + // CodeRunning The cluster is running. + CodeRunning Code = "Running" + // CodeStopped The cluster is stopped. + CodeStopped Code = "Stopped" +) + +// PossibleCodeValues returns an array of possible values for the Code const type. +func PossibleCodeValues() []Code { + return []Code{CodeRunning, CodeStopped} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusApproved ... + ConnectionStatusApproved ConnectionStatus = "Approved" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusPending ... + ConnectionStatusPending ConnectionStatus = "Pending" + // ConnectionStatusRejected ... + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// Expander enumerates the values for expander. +type Expander string + +const ( + // ExpanderLeastWaste Selects the node group that will have the least idle CPU (if tied, unused memory) + // after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high + // memory nodes, and only want to expand those when there are pending pods that need a lot of those + // resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods Selects the node group that would be able to schedule the most pods when scaling up. + // This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + // that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller + // nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority Selects the node group that has the highest priority assigned by the user. It's + // configuration is described in more details + // [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns an array of possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ExpanderLeastWaste, ExpanderMostPods, ExpanderPriority, ExpanderRandom} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// Format enumerates the values for format. +type Format string + +const ( + // FormatAzure Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + // removed in 1.25. + FormatAzure Format = "azure" + // FormatExec Return exec format kubeconfig. This format requires kubelogin binary in the path. + FormatExec Format = "exec" +) + +// PossibleFormatValues returns an array of possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{FormatAzure, FormatExec} +} + +// GPUInstanceProfile enumerates the values for gpu instance profile. +type GPUInstanceProfile string + +const ( + // GPUInstanceProfileMIG1g ... + GPUInstanceProfileMIG1g GPUInstanceProfile = "MIG1g" + // GPUInstanceProfileMIG2g ... + GPUInstanceProfileMIG2g GPUInstanceProfile = "MIG2g" + // GPUInstanceProfileMIG3g ... + GPUInstanceProfileMIG3g GPUInstanceProfile = "MIG3g" + // GPUInstanceProfileMIG4g ... + GPUInstanceProfileMIG4g GPUInstanceProfile = "MIG4g" + // GPUInstanceProfileMIG7g ... + GPUInstanceProfileMIG7g GPUInstanceProfile = "MIG7g" +) + +// PossibleGPUInstanceProfileValues returns an array of possible values for the GPUInstanceProfile const type. +func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { + return []GPUInstanceProfile{GPUInstanceProfileMIG1g, GPUInstanceProfileMIG2g, GPUInstanceProfileMIG3g, GPUInstanceProfileMIG4g, GPUInstanceProfileMIG7g} +} + +// IPFamily enumerates the values for ip family. +type IPFamily string + +const ( + // IPFamilyIPv4 ... + IPFamilyIPv4 IPFamily = "IPv4" + // IPFamilyIPv6 ... + IPFamilyIPv6 IPFamily = "IPv6" +) + +// PossibleIPFamilyValues returns an array of possible values for the IPFamily const type. +func PossibleIPFamilyValues() []IPFamily { + return []IPFamily{IPFamilyIPv4, IPFamilyIPv6} +} + +// KubeletDiskType enumerates the values for kubelet disk type. +type KubeletDiskType string + +const ( + // KubeletDiskTypeOS Kubelet will use the OS disk for its data. + KubeletDiskTypeOS KubeletDiskType = "OS" + // KubeletDiskTypeTemporary Kubelet will use the temporary disk for its data. + KubeletDiskTypeTemporary KubeletDiskType = "Temporary" +) + +// PossibleKubeletDiskTypeValues returns an array of possible values for the KubeletDiskType const type. +func PossibleKubeletDiskTypeValues() []KubeletDiskType { + return []KubeletDiskType{KubeletDiskTypeOS, KubeletDiskTypeTemporary} +} + +// LicenseType enumerates the values for license type. +type LicenseType string + +const ( + // LicenseTypeNone No additional licensing is applied. + LicenseTypeNone LicenseType = "None" + // LicenseTypeWindowsServer Enables Azure Hybrid User Benefits for Windows VMs. + LicenseTypeWindowsServer LicenseType = "Windows_Server" +) + +// PossibleLicenseTypeValues returns an array of possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{LicenseTypeNone, LicenseTypeWindowsServer} +} + +// LoadBalancerSku enumerates the values for load balancer sku. +type LoadBalancerSku string + +const ( + // LoadBalancerSkuBasic Use a basic Load Balancer with limited functionality. + LoadBalancerSkuBasic LoadBalancerSku = "basic" + // LoadBalancerSkuStandard Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For + // more information about on working with the load balancer in the managed cluster, see the [standard Load + // Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. + LoadBalancerSkuStandard LoadBalancerSku = "standard" +) + +// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. +func PossibleLoadBalancerSkuValues() []LoadBalancerSku { + return []LoadBalancerSku{LoadBalancerSkuBasic, LoadBalancerSkuStandard} +} + +// ManagedClusterPodIdentityProvisioningState enumerates the values for managed cluster pod identity +// provisioning state. +type ManagedClusterPodIdentityProvisioningState string + +const ( + // ManagedClusterPodIdentityProvisioningStateAssigned ... + ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" + // ManagedClusterPodIdentityProvisioningStateDeleting ... + ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" + // ManagedClusterPodIdentityProvisioningStateFailed ... + ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" + // ManagedClusterPodIdentityProvisioningStateUpdating ... + ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" +) + +// PossibleManagedClusterPodIdentityProvisioningStateValues returns an array of possible values for the ManagedClusterPodIdentityProvisioningState const type. +func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { + return []ManagedClusterPodIdentityProvisioningState{ManagedClusterPodIdentityProvisioningStateAssigned, ManagedClusterPodIdentityProvisioningStateDeleting, ManagedClusterPodIdentityProvisioningStateFailed, ManagedClusterPodIdentityProvisioningStateUpdating} +} + +// ManagedClusterSKUName enumerates the values for managed cluster sku name. +type ManagedClusterSKUName string + +const ( + // ManagedClusterSKUNameBasic ... + ManagedClusterSKUNameBasic ManagedClusterSKUName = "Basic" +) + +// PossibleManagedClusterSKUNameValues returns an array of possible values for the ManagedClusterSKUName const type. +func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { + return []ManagedClusterSKUName{ManagedClusterSKUNameBasic} +} + +// ManagedClusterSKUTier enumerates the values for managed cluster sku tier. +type ManagedClusterSKUTier string + +const ( + // ManagedClusterSKUTierFree No guaranteed SLA, no additional charges. Free tier clusters have an SLO of + // 99.5%. + ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" + // ManagedClusterSKUTierPaid Guarantees 99.95% availability of the Kubernetes API server endpoint for + // clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability + // Zones. + ManagedClusterSKUTierPaid ManagedClusterSKUTier = "Paid" +) + +// PossibleManagedClusterSKUTierValues returns an array of possible values for the ManagedClusterSKUTier const type. +func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { + return []ManagedClusterSKUTier{ManagedClusterSKUTierFree, ManagedClusterSKUTierPaid} +} + +// NetworkMode enumerates the values for network mode. +type NetworkMode string + +const ( + // NetworkModeBridge This is no longer supported + NetworkModeBridge NetworkMode = "bridge" + // NetworkModeTransparent No bridge is created. Intra-VM Pod to Pod communication is through IP routes + // created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) + // for more information. + NetworkModeTransparent NetworkMode = "transparent" +) + +// PossibleNetworkModeValues returns an array of possible values for the NetworkMode const type. +func PossibleNetworkModeValues() []NetworkMode { + return []NetworkMode{NetworkModeBridge, NetworkModeTransparent} +} + +// NetworkPlugin enumerates the values for network plugin. +type NetworkPlugin string + +const ( + // NetworkPluginAzure Use the Azure CNI network plugin. See [Azure CNI (advanced) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for + // more information. + NetworkPluginAzure NetworkPlugin = "azure" + // NetworkPluginKubenet Use the Kubenet network plugin. See [Kubenet (basic) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more + // information. + NetworkPluginKubenet NetworkPlugin = "kubenet" +) + +// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. +func PossibleNetworkPluginValues() []NetworkPlugin { + return []NetworkPlugin{NetworkPluginAzure, NetworkPluginKubenet} +} + +// NetworkPolicy enumerates the values for network policy. +type NetworkPolicy string + +const ( + // NetworkPolicyAzure Use Azure network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyAzure NetworkPolicy = "azure" + // NetworkPolicyCalico Use Calico network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyCalico NetworkPolicy = "calico" +) + +// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} +} + +// OSDiskType enumerates the values for os disk type. +type OSDiskType string + +const ( + // OSDiskTypeEphemeral Ephemeral OS disks are stored only on the host machine, just like a temporary disk. + // This provides lower read/write latency, along with faster node scaling and cluster upgrades. + OSDiskTypeEphemeral OSDiskType = "Ephemeral" + // OSDiskTypeManaged Azure replicates the operating system disk for a virtual machine to Azure storage to + // avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to + // have local state persisted, this behavior offers limited value while providing some drawbacks, including + // slower node provisioning and higher read/write latency. + OSDiskTypeManaged OSDiskType = "Managed" +) + +// PossibleOSDiskTypeValues returns an array of possible values for the OSDiskType const type. +func PossibleOSDiskTypeValues() []OSDiskType { + return []OSDiskType{OSDiskTypeEphemeral, OSDiskTypeManaged} +} + +// OSSKU enumerates the values for ossku. +type OSSKU string + +const ( + // OSSKUCBLMariner ... + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUUbuntu ... + OSSKUUbuntu OSSKU = "Ubuntu" +) + +// PossibleOSSKUValues returns an array of possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{OSSKUCBLMariner, OSSKUUbuntu} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // OSTypeLinux Use Linux. + OSTypeLinux OSType = "Linux" + // OSTypeWindows Use Windows. + OSTypeWindows OSType = "Windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{OSTypeLinux, OSTypeWindows} +} + +// OutboundType enumerates the values for outbound type. +type OutboundType string + +const ( + // OutboundTypeLoadBalancer The load balancer is used for egress through an AKS assigned public IP. This + // supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type + // loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). + OutboundTypeLoadBalancer OutboundType = "loadBalancer" + // OutboundTypeManagedNATGateway The AKS-managed NAT gateway is used for egress. + OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" + // OutboundTypeUserAssignedNATGateway The user-assigned NAT gateway associated to the cluster subnet is + // used for egress. This is an advanced scenario and requires proper network configuration. + OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" + // OutboundTypeUserDefinedRouting Egress paths must be defined by the user. This is an advanced scenario + // and requires proper network configuration. For more information see [outbound type + // userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). + OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" +) + +// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{OutboundTypeLoadBalancer, OutboundTypeManagedNATGateway, OutboundTypeUserAssignedNATGateway, OutboundTypeUserDefinedRouting} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Do not use a managed identity for the Managed Cluster, service principal will + // be used instead. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Use an implicitly created system assigned managed identity to manage + // cluster resources. Master components in the control plane such as kube-controller-manager will use the + // system assigned managed identity to manipulate Azure resources. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Use a user-specified identity to manage cluster resources. Master + // components in the control plane such as kube-controller-manager will use the specified user assigned + // managed identity to manipulate Azure resources. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// ScaleDownMode enumerates the values for scale down mode. +type ScaleDownMode string + +const ( + // ScaleDownModeDeallocate Attempt to start deallocated instances (if they exist) during scale up and + // deallocate instances during scale down. + ScaleDownModeDeallocate ScaleDownMode = "Deallocate" + // ScaleDownModeDelete Create new instances during scale up and remove instances during scale down. + ScaleDownModeDelete ScaleDownMode = "Delete" +) + +// PossibleScaleDownModeValues returns an array of possible values for the ScaleDownMode const type. +func PossibleScaleDownModeValues() []ScaleDownMode { + return []ScaleDownMode{ScaleDownModeDeallocate, ScaleDownModeDelete} +} + +// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. +type ScaleSetEvictionPolicy string + +const ( + // ScaleSetEvictionPolicyDeallocate Nodes in the underlying Scale Set of the node pool are set to the + // stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your + // compute quota and can cause issues with cluster scaling or upgrading. + ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" + // ScaleSetEvictionPolicyDelete Nodes in the underlying Scale Set of the node pool are deleted when they're + // evicted. + ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" +) + +// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. +func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { + return []ScaleSetEvictionPolicy{ScaleSetEvictionPolicyDeallocate, ScaleSetEvictionPolicyDelete} +} + +// ScaleSetPriority enumerates the values for scale set priority. +type ScaleSetPriority string + +const ( + // ScaleSetPriorityRegular Regular VMs will be used. + ScaleSetPriorityRegular ScaleSetPriority = "Regular" + // ScaleSetPrioritySpot Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on + // AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. + ScaleSetPrioritySpot ScaleSetPriority = "Spot" +) + +// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. +func PossibleScaleSetPriorityValues() []ScaleSetPriority { + return []ScaleSetPriority{ScaleSetPriorityRegular, ScaleSetPrioritySpot} +} + +// SnapshotType enumerates the values for snapshot type. +type SnapshotType string + +const ( + // SnapshotTypeNodePool The snapshot is a snapshot of a node pool. + SnapshotTypeNodePool SnapshotType = "NodePool" +) + +// PossibleSnapshotTypeValues returns an array of possible values for the SnapshotType const type. +func PossibleSnapshotTypeValues() []SnapshotType { + return []SnapshotType{SnapshotTypeNodePool} +} + +// StorageProfileTypes enumerates the values for storage profile types. +type StorageProfileTypes string + +const ( + // StorageProfileTypesManagedDisks ... + StorageProfileTypesManagedDisks StorageProfileTypes = "ManagedDisks" + // StorageProfileTypesStorageAccount ... + StorageProfileTypesStorageAccount StorageProfileTypes = "StorageAccount" +) + +// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. +func PossibleStorageProfileTypesValues() []StorageProfileTypes { + return []StorageProfileTypes{StorageProfileTypesManagedDisks, StorageProfileTypesStorageAccount} +} + +// UpgradeChannel enumerates the values for upgrade channel. +type UpgradeChannel string + +const ( + // UpgradeChannelNodeImage Automatically upgrade the node image to the latest version available. Microsoft + // provides patches and new images for image nodes frequently (usually weekly), but your running nodes + // won't get the new images unless you do a node image upgrade. Turning on the node-image channel will + // automatically update your node images whenever a new version is available. + UpgradeChannelNodeImage UpgradeChannel = "node-image" + // UpgradeChannelNone Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + UpgradeChannelNone UpgradeChannel = "none" + // UpgradeChannelPatch Automatically upgrade the cluster to the latest supported patch version when it + // becomes available while keeping the minor version the same. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.17.9. + UpgradeChannelPatch UpgradeChannel = "patch" + // UpgradeChannelRapid Automatically upgrade the cluster to the latest supported patch release on the + // latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an + // N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the + // latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 + // and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, + // then is upgraded to 1.19.1. + UpgradeChannelRapid UpgradeChannel = "rapid" + // UpgradeChannelStable Automatically upgrade the cluster to the latest supported patch release on minor + // version N-1, where N is the latest supported minor version. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.18.6. + UpgradeChannelStable UpgradeChannel = "stable" +) + +// PossibleUpgradeChannelValues returns an array of possible values for the UpgradeChannel const type. +func PossibleUpgradeChannelValues() []UpgradeChannel { + return []UpgradeChannel{UpgradeChannelNodeImage, UpgradeChannelNone, UpgradeChannelPatch, UpgradeChannelRapid, UpgradeChannelStable} +} + +// VMSizeTypes enumerates the values for vm size types. +type VMSizeTypes string + +const ( + // VMSizeTypesStandardA1 ... + VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" + // VMSizeTypesStandardA10 ... + VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" + // VMSizeTypesStandardA11 ... + VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" + // VMSizeTypesStandardA1V2 ... + VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" + // VMSizeTypesStandardA2 ... + VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" + // VMSizeTypesStandardA2mV2 ... + VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" + // VMSizeTypesStandardA2V2 ... + VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" + // VMSizeTypesStandardA3 ... + VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" + // VMSizeTypesStandardA4 ... + VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" + // VMSizeTypesStandardA4mV2 ... + VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" + // VMSizeTypesStandardA4V2 ... + VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" + // VMSizeTypesStandardA5 ... + VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" + // VMSizeTypesStandardA6 ... + VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" + // VMSizeTypesStandardA7 ... + VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" + // VMSizeTypesStandardA8 ... + VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" + // VMSizeTypesStandardA8mV2 ... + VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" + // VMSizeTypesStandardA8V2 ... + VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" + // VMSizeTypesStandardA9 ... + VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" + // VMSizeTypesStandardB2ms ... + VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" + // VMSizeTypesStandardB2s ... + VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" + // VMSizeTypesStandardB4ms ... + VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" + // VMSizeTypesStandardB8ms ... + VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" + // VMSizeTypesStandardD1 ... + VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" + // VMSizeTypesStandardD11 ... + VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" + // VMSizeTypesStandardD11V2 ... + VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" + // VMSizeTypesStandardD11V2Promo ... + VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" + // VMSizeTypesStandardD12 ... + VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" + // VMSizeTypesStandardD12V2 ... + VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" + // VMSizeTypesStandardD12V2Promo ... + VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" + // VMSizeTypesStandardD13 ... + VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" + // VMSizeTypesStandardD13V2 ... + VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" + // VMSizeTypesStandardD13V2Promo ... + VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" + // VMSizeTypesStandardD14 ... + VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" + // VMSizeTypesStandardD14V2 ... + VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" + // VMSizeTypesStandardD14V2Promo ... + VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" + // VMSizeTypesStandardD15V2 ... + VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" + // VMSizeTypesStandardD16sV3 ... + VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" + // VMSizeTypesStandardD16V3 ... + VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" + // VMSizeTypesStandardD1V2 ... + VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" + // VMSizeTypesStandardD2 ... + VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" + // VMSizeTypesStandardD2sV3 ... + VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" + // VMSizeTypesStandardD2V2 ... + VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" + // VMSizeTypesStandardD2V2Promo ... + VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" + // VMSizeTypesStandardD2V3 ... + VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" + // VMSizeTypesStandardD3 ... + VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" + // VMSizeTypesStandardD32sV3 ... + VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" + // VMSizeTypesStandardD32V3 ... + VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" + // VMSizeTypesStandardD3V2 ... + VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" + // VMSizeTypesStandardD3V2Promo ... + VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" + // VMSizeTypesStandardD4 ... + VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" + // VMSizeTypesStandardD4sV3 ... + VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" + // VMSizeTypesStandardD4V2 ... + VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" + // VMSizeTypesStandardD4V2Promo ... + VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" + // VMSizeTypesStandardD4V3 ... + VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" + // VMSizeTypesStandardD5V2 ... + VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" + // VMSizeTypesStandardD5V2Promo ... + VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" + // VMSizeTypesStandardD64sV3 ... + VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" + // VMSizeTypesStandardD64V3 ... + VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" + // VMSizeTypesStandardD8sV3 ... + VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" + // VMSizeTypesStandardD8V3 ... + VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" + // VMSizeTypesStandardDS1 ... + VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" + // VMSizeTypesStandardDS11 ... + VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" + // VMSizeTypesStandardDS11V2 ... + VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" + // VMSizeTypesStandardDS11V2Promo ... + VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" + // VMSizeTypesStandardDS12 ... + VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" + // VMSizeTypesStandardDS12V2 ... + VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" + // VMSizeTypesStandardDS12V2Promo ... + VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" + // VMSizeTypesStandardDS13 ... + VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" + // VMSizeTypesStandardDS132V2 ... + VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" + // VMSizeTypesStandardDS134V2 ... + VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" + // VMSizeTypesStandardDS13V2 ... + VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" + // VMSizeTypesStandardDS13V2Promo ... + VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" + // VMSizeTypesStandardDS14 ... + VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" + // VMSizeTypesStandardDS144V2 ... + VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" + // VMSizeTypesStandardDS148V2 ... + VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" + // VMSizeTypesStandardDS14V2 ... + VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" + // VMSizeTypesStandardDS14V2Promo ... + VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" + // VMSizeTypesStandardDS15V2 ... + VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" + // VMSizeTypesStandardDS1V2 ... + VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" + // VMSizeTypesStandardDS2 ... + VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" + // VMSizeTypesStandardDS2V2 ... + VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" + // VMSizeTypesStandardDS2V2Promo ... + VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" + // VMSizeTypesStandardDS3 ... + VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" + // VMSizeTypesStandardDS3V2 ... + VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" + // VMSizeTypesStandardDS3V2Promo ... + VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" + // VMSizeTypesStandardDS4 ... + VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" + // VMSizeTypesStandardDS4V2 ... + VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" + // VMSizeTypesStandardDS4V2Promo ... + VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" + // VMSizeTypesStandardDS5V2 ... + VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" + // VMSizeTypesStandardDS5V2Promo ... + VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" + // VMSizeTypesStandardE16sV3 ... + VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" + // VMSizeTypesStandardE16V3 ... + VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" + // VMSizeTypesStandardE2sV3 ... + VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" + // VMSizeTypesStandardE2V3 ... + VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" + // VMSizeTypesStandardE3216sV3 ... + VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" + // VMSizeTypesStandardE328sV3 ... + VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" + // VMSizeTypesStandardE32sV3 ... + VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" + // VMSizeTypesStandardE32V3 ... + VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" + // VMSizeTypesStandardE4sV3 ... + VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" + // VMSizeTypesStandardE4V3 ... + VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" + // VMSizeTypesStandardE6416sV3 ... + VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" + // VMSizeTypesStandardE6432sV3 ... + VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" + // VMSizeTypesStandardE64sV3 ... + VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" + // VMSizeTypesStandardE64V3 ... + VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" + // VMSizeTypesStandardE8sV3 ... + VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" + // VMSizeTypesStandardE8V3 ... + VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" + // VMSizeTypesStandardF1 ... + VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" + // VMSizeTypesStandardF16 ... + VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" + // VMSizeTypesStandardF16s ... + VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" + // VMSizeTypesStandardF16sV2 ... + VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" + // VMSizeTypesStandardF1s ... + VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" + // VMSizeTypesStandardF2 ... + VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" + // VMSizeTypesStandardF2s ... + VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" + // VMSizeTypesStandardF2sV2 ... + VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" + // VMSizeTypesStandardF32sV2 ... + VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" + // VMSizeTypesStandardF4 ... + VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" + // VMSizeTypesStandardF4s ... + VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" + // VMSizeTypesStandardF4sV2 ... + VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" + // VMSizeTypesStandardF64sV2 ... + VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" + // VMSizeTypesStandardF72sV2 ... + VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" + // VMSizeTypesStandardF8 ... + VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" + // VMSizeTypesStandardF8s ... + VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" + // VMSizeTypesStandardF8sV2 ... + VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" + // VMSizeTypesStandardG1 ... + VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" + // VMSizeTypesStandardG2 ... + VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" + // VMSizeTypesStandardG3 ... + VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" + // VMSizeTypesStandardG4 ... + VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" + // VMSizeTypesStandardG5 ... + VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" + // VMSizeTypesStandardGS1 ... + VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" + // VMSizeTypesStandardGS2 ... + VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" + // VMSizeTypesStandardGS3 ... + VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" + // VMSizeTypesStandardGS4 ... + VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" + // VMSizeTypesStandardGS44 ... + VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" + // VMSizeTypesStandardGS48 ... + VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" + // VMSizeTypesStandardGS5 ... + VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" + // VMSizeTypesStandardGS516 ... + VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" + // VMSizeTypesStandardGS58 ... + VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" + // VMSizeTypesStandardH16 ... + VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" + // VMSizeTypesStandardH16m ... + VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" + // VMSizeTypesStandardH16mr ... + VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" + // VMSizeTypesStandardH16r ... + VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" + // VMSizeTypesStandardH8 ... + VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" + // VMSizeTypesStandardH8m ... + VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" + // VMSizeTypesStandardL16s ... + VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" + // VMSizeTypesStandardL32s ... + VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" + // VMSizeTypesStandardL4s ... + VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" + // VMSizeTypesStandardL8s ... + VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" + // VMSizeTypesStandardM12832ms ... + VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" + // VMSizeTypesStandardM12864ms ... + VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" + // VMSizeTypesStandardM128ms ... + VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" + // VMSizeTypesStandardM128s ... + VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" + // VMSizeTypesStandardM6416ms ... + VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" + // VMSizeTypesStandardM6432ms ... + VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" + // VMSizeTypesStandardM64ms ... + VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" + // VMSizeTypesStandardM64s ... + VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" + // VMSizeTypesStandardNC12 ... + VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" + // VMSizeTypesStandardNC12sV2 ... + VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" + // VMSizeTypesStandardNC12sV3 ... + VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" + // VMSizeTypesStandardNC24 ... + VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" + // VMSizeTypesStandardNC24r ... + VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" + // VMSizeTypesStandardNC24rsV2 ... + VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" + // VMSizeTypesStandardNC24rsV3 ... + VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" + // VMSizeTypesStandardNC24sV2 ... + VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" + // VMSizeTypesStandardNC24sV3 ... + VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" + // VMSizeTypesStandardNC6 ... + VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" + // VMSizeTypesStandardNC6sV2 ... + VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" + // VMSizeTypesStandardNC6sV3 ... + VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" + // VMSizeTypesStandardND12s ... + VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" + // VMSizeTypesStandardND24rs ... + VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" + // VMSizeTypesStandardND24s ... + VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" + // VMSizeTypesStandardND6s ... + VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" + // VMSizeTypesStandardNV12 ... + VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" + // VMSizeTypesStandardNV24 ... + VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" + // VMSizeTypesStandardNV6 ... + VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" +) + +// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. +func PossibleVMSizeTypesValues() []VMSizeTypes { + return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} +} + +// WeekDay enumerates the values for week day. +type WeekDay string + +const ( + // WeekDayFriday ... + WeekDayFriday WeekDay = "Friday" + // WeekDayMonday ... + WeekDayMonday WeekDay = "Monday" + // WeekDaySaturday ... + WeekDaySaturday WeekDay = "Saturday" + // WeekDaySunday ... + WeekDaySunday WeekDay = "Sunday" + // WeekDayThursday ... + WeekDayThursday WeekDay = "Thursday" + // WeekDayTuesday ... + WeekDayTuesday WeekDay = "Tuesday" + // WeekDayWednesday ... + WeekDayWednesday WeekDay = "Wednesday" +) + +// PossibleWeekDayValues returns an array of possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{WeekDayFriday, WeekDayMonday, WeekDaySaturday, WeekDaySunday, WeekDayThursday, WeekDayTuesday, WeekDayWednesday} +} + +// WorkloadRuntime enumerates the values for workload runtime. +type WorkloadRuntime string + +const ( + // WorkloadRuntimeOCIContainer Nodes will use Kubelet to run standard OCI container workloads. + WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" + // WorkloadRuntimeWasmWasi Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" +) + +// PossibleWorkloadRuntimeValues returns an array of possible values for the WorkloadRuntime const type. +func PossibleWorkloadRuntimeValues() []WorkloadRuntime { + return []WorkloadRuntime{WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi} +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/maintenanceconfigurations.go b/services/containerservice/mgmt/2022-03-01/containerservice/maintenanceconfigurations.go new file mode 100644 index 000000000000..b3f2d72ecb94 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/maintenanceconfigurations.go @@ -0,0 +1,440 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MaintenanceConfigurationsClient is the the Container Service Client. +type MaintenanceConfigurationsClient struct { + BaseClient +} + +// NewMaintenanceConfigurationsClient creates an instance of the MaintenanceConfigurationsClient client. +func NewMaintenanceConfigurationsClient(subscriptionID string) MaintenanceConfigurationsClient { + return NewMaintenanceConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMaintenanceConfigurationsClientWithBaseURI creates an instance of the MaintenanceConfigurationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewMaintenanceConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) MaintenanceConfigurationsClient { + return MaintenanceConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +// parameters - the maintenance configuration to create or update. +func (client MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, configName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MaintenanceConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MaintenanceConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MaintenanceConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) GetResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagedCluster sends the list by managed cluster request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", err.Error()) + } + + result.fn = client.listByManagedClusterNextResults + req, err := client.ListByManagedClusterPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedClusterPreparer prepares the ListByManagedCluster request. +func (client MaintenanceConfigurationsClient) ListByManagedClusterPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedClusterSender sends the ListByManagedCluster request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) ListByManagedClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedClusterResponder handles the response to the ListByManagedCluster request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) ListByManagedClusterResponder(resp *http.Response) (result MaintenanceConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedClusterNextResults retrieves the next set of results, if any. +func (client MaintenanceConfigurationsClient) listByManagedClusterNextResults(ctx context.Context, lastResults MaintenanceConfigurationListResult) (result MaintenanceConfigurationListResult, err error) { + req, err := lastResults.maintenanceConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByManagedCluster(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/managedclusters.go b/services/containerservice/mgmt/2022-03-01/containerservice/managedclusters.go new file mode 100644 index 000000000000..4005d41e56eb --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/managedclusters.go @@ -0,0 +1,2043 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedClustersClient is the the Container Service Client. +type ManagedClustersClient struct { + BaseClient +} + +// NewManagedClustersClient creates an instance of the ManagedClustersClient client. +func NewManagedClustersClient(subscriptionID string) ManagedClustersClient { + return NewManagedClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedClustersClientWithBaseURI creates an instance of the ManagedClustersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) ManagedClustersClient { + return ManagedClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the managed cluster to create or update. +func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (result ManagedClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[A-Za-z][-A-Za-z0-9_]*$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.ManagedClusterProperties.WindowsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Pattern, Rule: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMaximum, Rule: int64(16), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) CreateOrUpdateSender(req *http.Request) (future ManagedClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) DeleteSender(req *http.Request) (future ManagedClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedCluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAccessProfile **WARNING**: This API will be deprecated. Instead use +// [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or +// [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// roleName - the name of the role for managed cluster accessProfile resource. +func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result ManagedClusterAccessProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetAccessProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetAccessProfile", err.Error()) + } + + req, err := client.GetAccessProfilePreparer(ctx, resourceGroupName, resourceName, roleName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetAccessProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure sending request") + return + } + + result, err = client.GetAccessProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetAccessProfilePreparer prepares the GetAccessProfile request. +func (client ManagedClustersClient) GetAccessProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAccessProfileSender sends the GetAccessProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetAccessProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAccessProfileResponder handles the response to the GetAccessProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Response) (result ManagedClusterAccessProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCommandResult sends the get command result request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// commandID - id of the command. +func (client ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result RunCommandResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetCommandResult") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetCommandResult", err.Error()) + } + + req, err := client.GetCommandResultPreparer(ctx, resourceGroupName, resourceName, commandID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetCommandResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure sending request") + return + } + + result, err = client.GetCommandResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure responding to request") + return + } + + return +} + +// GetCommandResultPreparer prepares the GetCommandResult request. +func (client ManagedClustersClient) GetCommandResultPreparer(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commandId": autorest.Encode("path", commandID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCommandResultSender sends the GetCommandResult request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetCommandResultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCommandResultResponder handles the response to the GetCommandResult request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetCommandResultResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOSOptions sends the get os options request. +// Parameters: +// location - the name of Azure region. +// resourceType - the resource type for which the OS options needs to be returned +func (client ManagedClustersClient) GetOSOptions(ctx context.Context, location string, resourceType string) (result OSOptionProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetOSOptions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetOSOptions", err.Error()) + } + + req, err := client.GetOSOptionsPreparer(ctx, location, resourceType) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") + return + } + + resp, err := client.GetOSOptionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure sending request") + return + } + + result, err = client.GetOSOptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure responding to request") + return + } + + return +} + +// GetOSOptionsPreparer prepares the GetOSOptions request. +func (client ManagedClustersClient) GetOSOptionsPreparer(ctx context.Context, location string, resourceType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(resourceType) > 0 { + queryParameters["resource-type"] = autorest.Encode("query", resourceType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOSOptionsSender sends the GetOSOptions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetOSOptionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOSOptionsResponder handles the response to the GetOSOptions request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetOSOptionsResponder(resp *http.Response) (result OSOptionProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetUpgradeProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client ManagedClustersClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetUpgradeProfileResponder(resp *http.Response) (result ManagedClusterUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client ManagedClustersClient) List(ctx context.Context) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListResponder(resp *http.Response) (result ManagedClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListComplete(ctx context.Context) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListClusterAdminCredentials sends the list cluster admin credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterAdminCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterAdminCredentials", err.Error()) + } + + req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterAdminCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterAdminCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterAdminCredentialsPreparer prepares the ListClusterAdminCredentials request. +func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterAdminCredentialsSender sends the ListClusterAdminCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterAdminCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterAdminCredentialsResponder handles the response to the ListClusterAdminCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterAdminCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterMonitoringUserCredentials sends the list cluster monitoring user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterMonitoringUserCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", err.Error()) + } + + req, err := client.ListClusterMonitoringUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterMonitoringUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterMonitoringUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterMonitoringUserCredentialsPreparer prepares the ListClusterMonitoringUserCredentials request. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterMonitoringUserCredentialsSender sends the ListClusterMonitoringUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterMonitoringUserCredentialsResponder handles the response to the ListClusterMonitoringUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterUserCredentials sends the list cluster user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +// formatParameter - only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' +// will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires +// kubelogin binary in the path. +func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterUserCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterUserCredentials", err.Error()) + } + + req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn, formatParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterUserCredentialsPreparer prepares the ListClusterUserCredentials request. +func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + if len(string(formatParameter)) > 0 { + queryParameters["format"] = autorest.Encode("query", formatParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterUserCredentialsSender sends the ListClusterUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterUserCredentialsResponder handles the response to the ListClusterUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOutboundNetworkDependenciesEndpoints gets a list of egress endpoints (network endpoints of all outbound +// dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.oeec.Response.Response != nil { + sc = result.oeec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.oeec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.oeec.hasNextLink() && result.oeec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, resourceName) + return +} + +// ResetAADProfile sends the reset aad profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the AAD profile to set on the Managed Cluster +func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (result ManagedClustersResetAADProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetAADProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetAADProfile", err.Error()) + } + + req, err := client.ResetAADProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetAADProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetAADProfilePreparer prepares the ResetAADProfile request. +func (client ManagedClustersClient) ResetAADProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-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.ContainerService/managedClusters/{resourceName}/resetAADProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAADProfileSender sends the ResetAADProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetAADProfileSender(req *http.Request) (future ManagedClustersResetAADProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetAADProfileResponder handles the response to the ResetAADProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetAADProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetServicePrincipalProfile this action cannot be performed on a cluster that is not using a service principal +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the service principal profile to set on the managed cluster. +func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (result ManagedClustersResetServicePrincipalProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetServicePrincipalProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", err.Error()) + } + + req, err := client.ResetServicePrincipalProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetServicePrincipalProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetServicePrincipalProfilePreparer prepares the ResetServicePrincipalProfile request. +func (client ManagedClustersClient) ResetServicePrincipalProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-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.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetServicePrincipalProfileSender sends the ResetServicePrincipalProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetServicePrincipalProfileSender(req *http.Request) (future ManagedClustersResetServicePrincipalProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetServicePrincipalProfileResponder handles the response to the ResetServicePrincipalProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetServicePrincipalProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RotateClusterCertificates see [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for +// more details about rotating managed cluster certificates. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateClusterCertificatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateClusterCertificates") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RotateClusterCertificates", err.Error()) + } + + req, err := client.RotateClusterCertificatesPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") + return + } + + result, err = client.RotateClusterCertificatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateClusterCertificatesPreparer prepares the RotateClusterCertificates request. +func (client ManagedClustersClient) RotateClusterCertificatesPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateClusterCertificatesSender sends the RotateClusterCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RotateClusterCertificatesSender(req *http.Request) (future ManagedClustersRotateClusterCertificatesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RotateClusterCertificatesResponder handles the response to the RotateClusterCertificates request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RotateClusterCertificatesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunCommand AKS will create a pod to run the command. This is primarily useful for private clusters. For more +// information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// requestPayload - the run command request +func (client ManagedClustersClient) RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (result ManagedClustersRunCommandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RunCommand") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: requestPayload, + Constraints: []validation.Constraint{{Target: "requestPayload.Command", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RunCommand", err.Error()) + } + + req, err := client.RunCommandPreparer(ctx, resourceGroupName, resourceName, requestPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") + return + } + + result, err = client.RunCommandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", result.Response(), "Failure sending request") + return + } + + return +} + +// RunCommandPreparer prepares the RunCommand request. +func (client ManagedClustersClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-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.ContainerService/managedClusters/{resourceName}/runCommand", pathParameters), + autorest.WithJSON(requestPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunCommandSender sends the RunCommand request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RunCommandSender(req *http.Request) (future ManagedClustersRunCommandFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RunCommandResponder handles the response to the RunCommand request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start see [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about +// starting a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Start(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ManagedClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StartSender(req *http.Request) (future ManagedClustersStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop this can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the +// control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue +// charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for +// more details about stopping a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Stop(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ManagedClustersClient) StopPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StopSender(req *http.Request) (future ManagedClustersStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update Managed Cluster Tags operation. +func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClustersUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ManagedClustersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) UpdateTagsSender(req *http.Request) (future ManagedClustersUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) UpdateTagsResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/models.go b/services/containerservice/mgmt/2022-03-01/containerservice/models.go new file mode 100644 index 000000000000..d01b0166e860 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/models.go @@ -0,0 +1,4093 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2022-03-01/containerservice" + +// AccessProfile profile for enabling a user to access a managed cluster. +type AccessProfile struct { + // KubeConfig - Base64-encoded Kubernetes configuration file. + KubeConfig *[]byte `json:"kubeConfig,omitempty"` +} + +// AgentPool agent Pool. +type AgentPool struct { + autorest.Response `json:"-"` + // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. + *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPool. +func (ap AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ManagedClusterAgentPoolProfileProperties != nil { + objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPool struct. +func (ap *AgentPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties + err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) + if err != nil { + return err + } + ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + } + } + + return nil +} + +// AgentPoolAvailableVersions the list of available versions for an agent pool. +type AgentPoolAvailableVersions struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool version list. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool version list. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the agent pool version list. + Type *string `json:"type,omitempty"` + // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. + *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. +func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apav.AgentPoolAvailableVersionsProperties != nil { + objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. +func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apav.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apav.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apav.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties + err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) + if err != nil { + return err + } + apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties + } + } + } + + return nil +} + +// AgentPoolAvailableVersionsProperties the list of available agent pool versions. +type AgentPoolAvailableVersionsProperties struct { + // AgentPoolVersions - List of versions available for agent pool. + AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` +} + +// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... +type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { + // Default - Whether this version is the default agent pool version. + Default *bool `json:"default,omitempty"` + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolListResult the response from the List Agent Pools operation. +type AgentPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of agent pools. + Value *[]AgentPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of agent pool results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolListResult. +func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aplr.Value != nil { + objectMap["value"] = aplr.Value + } + return json.Marshal(objectMap) +} + +// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. +type AgentPoolListResultIterator struct { + i int + page AgentPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AgentPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgentPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AgentPoolListResultIterator) Value() AgentPool { + if !iter.page.NotDone() { + return AgentPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgentPoolListResultIterator type. +func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { + return AgentPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aplr AgentPoolListResult) IsEmpty() bool { + return aplr.Value == nil || len(*aplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aplr AgentPoolListResult) hasNextLink() bool { + return aplr.NextLink != nil && len(*aplr.NextLink) != 0 +} + +// agentPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aplr.NextLink))) +} + +// AgentPoolListResultPage contains a page of AgentPool values. +type AgentPoolListResultPage struct { + fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) + aplr AgentPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aplr) + if err != nil { + return err + } + page.aplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AgentPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgentPoolListResultPage) NotDone() bool { + return !page.aplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgentPoolListResultPage) Response() AgentPoolListResult { + return page.aplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgentPoolListResultPage) Values() []AgentPool { + if page.aplr.IsEmpty() { + return nil + } + return *page.aplr.Value +} + +// Creates a new instance of the AgentPoolListResultPage type. +func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { + return AgentPoolListResultPage{ + fn: getNextPage, + aplr: cur, + } +} + +// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsCreateOrUpdateFuture.Result. +func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.CreateOrUpdateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsDeleteFuture.Result. +func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AgentPoolsUpgradeNodeImageVersionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsUpgradeNodeImageVersionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsUpgradeNodeImageVersionFuture.Result. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsUpgradeNodeImageVersionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.UpgradeNodeImageVersionResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. +type AgentPoolUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the agent pool upgrade profile. + Type *string `json:"type,omitempty"` + // AgentPoolUpgradeProfileProperties - The properties of the agent pool upgrade profile. + *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. +func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apup.AgentPoolUpgradeProfileProperties != nil { + objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. +func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apup.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties + err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) + if err != nil { + return err + } + apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties + } + } + } + + return nil +} + +// AgentPoolUpgradeProfileProperties the list of available upgrade versions. +type AgentPoolUpgradeProfileProperties struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` + // LatestNodeImageVersion - The latest AKS supported node image version. + LatestNodeImageVersion *string `json:"latestNodeImageVersion,omitempty"` +} + +// AgentPoolUpgradeProfilePropertiesUpgradesItem ... +type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolUpgradeSettings settings for upgrading an agentpool +type AgentPoolUpgradeSettings struct { + // MaxSurge - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade + MaxSurge *string `json:"maxSurge,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CloudError an error response from the Container service. +type CloudError struct { + // Error - Details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Container service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CommandResultProperties the results of a run command +type CommandResultProperties struct { + // ProvisioningState - READ-ONLY; provisioning State + ProvisioningState *string `json:"provisioningState,omitempty"` + // ExitCode - READ-ONLY; The exit code of the command + ExitCode *int32 `json:"exitCode,omitempty"` + // StartedAt - READ-ONLY; The time when the command started. + StartedAt *date.Time `json:"startedAt,omitempty"` + // FinishedAt - READ-ONLY; The time when the command finished. + FinishedAt *date.Time `json:"finishedAt,omitempty"` + // Logs - READ-ONLY; The command output. + Logs *string `json:"logs,omitempty"` + // Reason - READ-ONLY; An explanation of why provisioningState is set to failed (if so). + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandResultProperties. +func (crp CommandResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CreationData data used when creating a target resource from a source resource. +type CreationData struct { + // SourceResourceID - This is the ARM ID of the source object to be used to create the target object. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// CredentialResult the credential result response. +type CredentialResult struct { + // Name - READ-ONLY; The name of the credential. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. + Value *[]byte `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResult. +func (cr CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CredentialResults the list credential result response. +type CredentialResults struct { + autorest.Response `json:"-"` + // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResults. +func (cr CredentialResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnosticsProfile profile for diagnostics on the container service cluster. +type DiagnosticsProfile struct { + // VMDiagnostics - Profile for diagnostics on the container service VMs. + VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// EndpointDependency a domain name that AKS agent nodes are reaching at. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The Ports and Protocols used when connecting to domainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail connect information from the AKS agent nodes to a single endpoint. +type EndpointDetail struct { + // IPAddress - An IP Address that Domain Name currently resolves to. + IPAddress *string `json:"ipAddress,omitempty"` + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used for connection + Protocol *string `json:"protocol,omitempty"` + // Description - Description of the detail + Description *string `json:"description,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// KubeletConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type KubeletConfig struct { + // CPUManagerPolicy - The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. + CPUManagerPolicy *string `json:"cpuManagerPolicy,omitempty"` + // CPUCfsQuota - The default is true. + CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` + // CPUCfsQuotaPeriod - The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` + // ImageGcHighThreshold - To disable image garbage collection, set to 100. The default is 85% + ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` + // ImageGcLowThreshold - This cannot be set higher than imageGcHighThreshold. The default is 80% + ImageGcLowThreshold *int32 `json:"imageGcLowThreshold,omitempty"` + // TopologyManagerPolicy - For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + TopologyManagerPolicy *string `json:"topologyManagerPolicy,omitempty"` + // AllowedUnsafeSysctls - Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). + AllowedUnsafeSysctls *[]string `json:"allowedUnsafeSysctls,omitempty"` + // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. + FailSwapOn *bool `json:"failSwapOn,omitempty"` + // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. + ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` + // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. + ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` + // PodMaxPids - The maximum number of processes per pod. + PodMaxPids *int32 `json:"podMaxPids,omitempty"` +} + +// LinuxOSConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type LinuxOSConfig struct { + // Sysctls - Sysctl settings for Linux agent nodes. + Sysctls *SysctlConfig `json:"sysctls,omitempty"` + // TransparentHugePageEnabled - Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageEnabled *string `json:"transparentHugePageEnabled,omitempty"` + // TransparentHugePageDefrag - Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageDefrag *string `json:"transparentHugePageDefrag,omitempty"` + // SwapFileSizeMB - The size in MB of a swap file that will be created on each node. + SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` +} + +// LinuxProfile profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + // AdminUsername - The administrator username to use for Linux VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // SSH - The SSH configuration for Linux-based VMs running on Azure. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// MaintenanceConfiguration see [planned +// maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about +// planned maintenance. +type MaintenanceConfiguration struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // MaintenanceConfigurationProperties - Properties of a default maintenance configuration. + *MaintenanceConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfiguration. +func (mc MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.MaintenanceConfigurationProperties != nil { + objectMap["properties"] = mc.MaintenanceConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MaintenanceConfiguration struct. +func (mc *MaintenanceConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + case "properties": + if v != nil { + var maintenanceConfigurationProperties MaintenanceConfigurationProperties + err = json.Unmarshal(*v, &maintenanceConfigurationProperties) + if err != nil { + return err + } + mc.MaintenanceConfigurationProperties = &maintenanceConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + } + } + + return nil +} + +// MaintenanceConfigurationListResult the response from the List maintenance configurations operation. +type MaintenanceConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of maintenance configurations. + Value *[]MaintenanceConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of maintenance configuration results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfigurationListResult. +func (mclr MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// MaintenanceConfigurationListResultIterator provides access to a complete listing of +// MaintenanceConfiguration values. +type MaintenanceConfigurationListResultIterator struct { + i int + page MaintenanceConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MaintenanceConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MaintenanceConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MaintenanceConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MaintenanceConfigurationListResultIterator) Response() MaintenanceConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MaintenanceConfigurationListResultIterator) Value() MaintenanceConfiguration { + if !iter.page.NotDone() { + return MaintenanceConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MaintenanceConfigurationListResultIterator type. +func NewMaintenanceConfigurationListResultIterator(page MaintenanceConfigurationListResultPage) MaintenanceConfigurationListResultIterator { + return MaintenanceConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr MaintenanceConfigurationListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr MaintenanceConfigurationListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// maintenanceConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr MaintenanceConfigurationListResult) maintenanceConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// MaintenanceConfigurationListResultPage contains a page of MaintenanceConfiguration values. +type MaintenanceConfigurationListResultPage struct { + fn func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error) + mclr MaintenanceConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MaintenanceConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MaintenanceConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MaintenanceConfigurationListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MaintenanceConfigurationListResultPage) Response() MaintenanceConfigurationListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MaintenanceConfigurationListResultPage) Values() []MaintenanceConfiguration { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the MaintenanceConfigurationListResultPage type. +func NewMaintenanceConfigurationListResultPage(cur MaintenanceConfigurationListResult, getNextPage func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error)) MaintenanceConfigurationListResultPage { + return MaintenanceConfigurationListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// MaintenanceConfigurationProperties properties used to configure planned maintenance for a Managed +// Cluster. +type MaintenanceConfigurationProperties struct { + // TimeInWeek - If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. + TimeInWeek *[]TimeInWeek `json:"timeInWeek,omitempty"` + // NotAllowedTime - Time slots on which upgrade is not allowed. + NotAllowedTime *[]TimeSpan `json:"notAllowedTime,omitempty"` +} + +// ManagedCluster managed cluster. +type ManagedCluster struct { + autorest.Response `json:"-"` + // Sku - The managed cluster SKU. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // ExtendedLocation - The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Identity - The identity of the managed cluster, if configured. + Identity *ManagedClusterIdentity `json:"identity,omitempty"` + // ManagedClusterProperties - Properties of a managed cluster. + *ManagedClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCluster. +func (mc ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Sku != nil { + objectMap["sku"] = mc.Sku + } + if mc.ExtendedLocation != nil { + objectMap["extendedLocation"] = mc.ExtendedLocation + } + if mc.Identity != nil { + objectMap["identity"] = mc.Identity + } + if mc.ManagedClusterProperties != nil { + objectMap["properties"] = mc.ManagedClusterProperties + } + if mc.Tags != nil { + objectMap["tags"] = mc.Tags + } + if mc.Location != nil { + objectMap["location"] = mc.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. +func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ManagedClusterSKU + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mc.Sku = &sku + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + mc.ExtendedLocation = &extendedLocation + } + case "identity": + if v != nil { + var identity ManagedClusterIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mc.Identity = &identity + } + case "properties": + if v != nil { + var managedClusterProperties ManagedClusterProperties + err = json.Unmarshal(*v, &managedClusterProperties) + if err != nil { + return err + } + mc.ManagedClusterProperties = &managedClusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mc.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mc.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAADProfile for more details see [managed AAD on +// AKS](https://docs.microsoft.com/azure/aks/managed-aad). +type ManagedClusterAADProfile struct { + // Managed - Whether to enable managed AAD. + Managed *bool `json:"managed,omitempty"` + // EnableAzureRBAC - Whether to enable Azure RBAC for Kubernetes authorization. + EnableAzureRBAC *bool `json:"enableAzureRBAC,omitempty"` + // AdminGroupObjectIDs - The list of AAD group object IDs that will have admin role of the cluster. + AdminGroupObjectIDs *[]string `json:"adminGroupObjectIDs,omitempty"` + // ClientAppID - The client AAD application ID. + ClientAppID *string `json:"clientAppID,omitempty"` + // ServerAppID - The server AAD application ID. + ServerAppID *string `json:"serverAppID,omitempty"` + // ServerAppSecret - The server AAD application secret. + ServerAppSecret *string `json:"serverAppSecret,omitempty"` + // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + TenantID *string `json:"tenantID,omitempty"` +} + +// ManagedClusterAccessProfile managed cluster Access Profile. +type ManagedClusterAccessProfile struct { + autorest.Response `json:"-"` + // AccessProfile - AccessProfile of a managed cluster. + *AccessProfile `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. +func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.AccessProfile != nil { + objectMap["properties"] = mcap.AccessProfile + } + if mcap.Tags != nil { + objectMap["tags"] = mcap.Tags + } + if mcap.Location != nil { + objectMap["location"] = mcap.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. +func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accessProfile AccessProfile + err = json.Unmarshal(*v, &accessProfile) + if err != nil { + return err + } + mcap.AccessProfile = &accessProfile + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcap.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcap.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcap.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mcap.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. +type ManagedClusterAddonProfile struct { + // Enabled - Whether the add-on is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // Config - Key-value pairs for configuring an add-on. + Config map[string]*string `json:"config"` + // Identity - READ-ONLY; Information of user assigned identity used by this add-on. + Identity *ManagedClusterAddonProfileIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. +func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.Enabled != nil { + objectMap["enabled"] = mcap.Enabled + } + if mcap.Config != nil { + objectMap["config"] = mcap.Config + } + return json.Marshal(objectMap) +} + +// ManagedClusterAddonProfileIdentity information of user assigned identity used by this add-on. +type ManagedClusterAddonProfileIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// ManagedClusterAgentPoolProfile profile for the container service agent pool. +type ManagedClusterAgentPoolProfile struct { + // Name - Windows agent pool names must be 6 characters or less. + Name *string `json:"name,omitempty"` + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. +func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcapp.Name != nil { + objectMap["name"] = mcapp.Name + } + if mcapp.Count != nil { + objectMap["count"] = mcapp.Count + } + if mcapp.VMSize != nil { + objectMap["vmSize"] = mcapp.VMSize + } + if mcapp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB + } + if mcapp.OsDiskType != "" { + objectMap["osDiskType"] = mcapp.OsDiskType + } + if mcapp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcapp.KubeletDiskType + } + if mcapp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcapp.WorkloadRuntime + } + if mcapp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcapp.VnetSubnetID + } + if mcapp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcapp.PodSubnetID + } + if mcapp.MaxPods != nil { + objectMap["maxPods"] = mcapp.MaxPods + } + if mcapp.OsType != "" { + objectMap["osType"] = mcapp.OsType + } + if mcapp.OsSKU != "" { + objectMap["osSKU"] = mcapp.OsSKU + } + if mcapp.MaxCount != nil { + objectMap["maxCount"] = mcapp.MaxCount + } + if mcapp.MinCount != nil { + objectMap["minCount"] = mcapp.MinCount + } + if mcapp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling + } + if mcapp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcapp.ScaleDownMode + } + if mcapp.Type != "" { + objectMap["type"] = mcapp.Type + } + if mcapp.Mode != "" { + objectMap["mode"] = mcapp.Mode + } + if mcapp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion + } + if mcapp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcapp.UpgradeSettings + } + if mcapp.PowerState != nil { + objectMap["powerState"] = mcapp.PowerState + } + if mcapp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcapp.AvailabilityZones + } + if mcapp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP + } + if mcapp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcapp.NodePublicIPPrefixID + } + if mcapp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority + } + if mcapp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy + } + if mcapp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcapp.SpotMaxPrice + } + if mcapp.Tags != nil { + objectMap["tags"] = mcapp.Tags + } + if mcapp.NodeLabels != nil { + objectMap["nodeLabels"] = mcapp.NodeLabels + } + if mcapp.NodeTaints != nil { + objectMap["nodeTaints"] = mcapp.NodeTaints + } + if mcapp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcapp.ProximityPlacementGroupID + } + if mcapp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcapp.KubeletConfig + } + if mcapp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcapp.LinuxOSConfig + } + if mcapp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcapp.EnableEncryptionAtHost + } + if mcapp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcapp.EnableUltraSSD + } + if mcapp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcapp.EnableFIPS + } + if mcapp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcapp.GpuInstanceProfile + } + if mcapp.CreationData != nil { + objectMap["creationData"] = mcapp.CreationData + } + return json.Marshal(objectMap) +} + +// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. +type ManagedClusterAgentPoolProfileProperties struct { + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. +func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcappp.Count != nil { + objectMap["count"] = mcappp.Count + } + if mcappp.VMSize != nil { + objectMap["vmSize"] = mcappp.VMSize + } + if mcappp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB + } + if mcappp.OsDiskType != "" { + objectMap["osDiskType"] = mcappp.OsDiskType + } + if mcappp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcappp.KubeletDiskType + } + if mcappp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcappp.WorkloadRuntime + } + if mcappp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcappp.VnetSubnetID + } + if mcappp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcappp.PodSubnetID + } + if mcappp.MaxPods != nil { + objectMap["maxPods"] = mcappp.MaxPods + } + if mcappp.OsType != "" { + objectMap["osType"] = mcappp.OsType + } + if mcappp.OsSKU != "" { + objectMap["osSKU"] = mcappp.OsSKU + } + if mcappp.MaxCount != nil { + objectMap["maxCount"] = mcappp.MaxCount + } + if mcappp.MinCount != nil { + objectMap["minCount"] = mcappp.MinCount + } + if mcappp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling + } + if mcappp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcappp.ScaleDownMode + } + if mcappp.Type != "" { + objectMap["type"] = mcappp.Type + } + if mcappp.Mode != "" { + objectMap["mode"] = mcappp.Mode + } + if mcappp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion + } + if mcappp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcappp.UpgradeSettings + } + if mcappp.PowerState != nil { + objectMap["powerState"] = mcappp.PowerState + } + if mcappp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcappp.AvailabilityZones + } + if mcappp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP + } + if mcappp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcappp.NodePublicIPPrefixID + } + if mcappp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority + } + if mcappp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy + } + if mcappp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcappp.SpotMaxPrice + } + if mcappp.Tags != nil { + objectMap["tags"] = mcappp.Tags + } + if mcappp.NodeLabels != nil { + objectMap["nodeLabels"] = mcappp.NodeLabels + } + if mcappp.NodeTaints != nil { + objectMap["nodeTaints"] = mcappp.NodeTaints + } + if mcappp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcappp.ProximityPlacementGroupID + } + if mcappp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcappp.KubeletConfig + } + if mcappp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcappp.LinuxOSConfig + } + if mcappp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcappp.EnableEncryptionAtHost + } + if mcappp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcappp.EnableUltraSSD + } + if mcappp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcappp.EnableFIPS + } + if mcappp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcappp.GpuInstanceProfile + } + if mcappp.CreationData != nil { + objectMap["creationData"] = mcappp.CreationData + } + return json.Marshal(objectMap) +} + +// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. +type ManagedClusterAPIServerAccessProfile struct { + // AuthorizedIPRanges - IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). + AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` + // EnablePrivateCluster - For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). + EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` + // PrivateDNSZone - The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. + PrivateDNSZone *string `json:"privateDNSZone,omitempty"` + // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. + EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` + // DisableRunCommand - Whether to disable run command for the cluster or not. + DisableRunCommand *bool `json:"disableRunCommand,omitempty"` +} + +// ManagedClusterAutoUpgradeProfile auto upgrade profile for a managed cluster. +type ManagedClusterAutoUpgradeProfile struct { + // UpgradeChannel - For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). Possible values include: 'UpgradeChannelRapid', 'UpgradeChannelStable', 'UpgradeChannelPatch', 'UpgradeChannelNodeImage', 'UpgradeChannelNone' + UpgradeChannel UpgradeChannel `json:"upgradeChannel,omitempty"` +} + +// ManagedClusterHTTPProxyConfig cluster HTTP proxy configuration. +type ManagedClusterHTTPProxyConfig struct { + // HTTPProxy - The HTTP proxy server endpoint to use. + HTTPProxy *string `json:"httpProxy,omitempty"` + // HTTPSProxy - The HTTPS proxy server endpoint to use. + HTTPSProxy *string `json:"httpsProxy,omitempty"` + // NoProxy - The endpoints that should not go through proxy. + NoProxy *[]string `json:"noProxy,omitempty"` + // TrustedCa - Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string `json:"trustedCa,omitempty"` +} + +// ManagedClusterIdentity identity for the managed cluster. +type ManagedClusterIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. + TenantID *string `json:"tenantId,omitempty"` + // Type - For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity). Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentity. +func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mci.Type != "" { + objectMap["type"] = mci.Type + } + if mci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentityUserAssignedIdentitiesValue ... +type ManagedClusterIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentityUserAssignedIdentitiesValue. +func (mciAiv ManagedClusterIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedClusterListResult the response from the List Managed Clusters operation. +type ManagedClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed clusters. + Value *[]ManagedCluster `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterListResult. +func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. +type ManagedClusterListResultIterator struct { + i int + page ManagedClusterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedClusterListResultIterator) Value() ManagedCluster { + if !iter.page.NotDone() { + return ManagedCluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterListResultIterator type. +func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { + return ManagedClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr ManagedClusterListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr ManagedClusterListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// managedClusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// ManagedClusterListResultPage contains a page of ManagedCluster values. +type ManagedClusterListResultPage struct { + fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) + mclr ManagedClusterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterListResultPage) Values() []ManagedCluster { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the ManagedClusterListResultPage type. +func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { + return ManagedClusterListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer. +type ManagedClusterLoadBalancerProfile struct { + // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. + ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` + // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` + // OutboundIPs - Desired outbound IP resources for the cluster load balancer. + OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableMultipleStandardLoadBalancers - Enable multiple standard load balancers per AKS cluster or not. + EnableMultipleStandardLoadBalancers *bool `json:"enableMultipleStandardLoadBalancers,omitempty"` +} + +// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { + // Count - The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` + // CountIPv6 - The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. + CountIPv6 *int32 `json:"countIPv6,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster +// load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { + // PublicIPPrefixes - A list of public IP prefix resources. + PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileOutboundIPs struct { + // PublicIPs - A list of public IP resources. + PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` +} + +// ManagedClusterManagedOutboundIPProfile profile of the managed outbound IP resources of the managed +// cluster. +type ManagedClusterManagedOutboundIPProfile struct { + // Count - The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// ManagedClusterNATGatewayProfile profile of the managed cluster NAT gateway. +type ManagedClusterNATGatewayProfile struct { + // ManagedOutboundIPProfile - Profile of the managed outbound IP resources of the cluster NAT gateway. + ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster NAT gateway. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// ManagedClusterPodIdentity details about the pod identity assigned to the Managed Cluster. +type ManagedClusterPodIdentity struct { + // Name - The name of the pod identity. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity. + Namespace *string `json:"namespace,omitempty"` + // BindingSelector - The binding selector to use for the AzureIdentityBinding resource. + BindingSelector *string `json:"bindingSelector,omitempty"` + // Identity - The user assigned identity details. + Identity *UserAssignedIdentity `json:"identity,omitempty"` + // ProvisioningState - READ-ONLY; The current provisioning state of the pod identity. Possible values include: 'ManagedClusterPodIdentityProvisioningStateAssigned', 'ManagedClusterPodIdentityProvisioningStateUpdating', 'ManagedClusterPodIdentityProvisioningStateDeleting', 'ManagedClusterPodIdentityProvisioningStateFailed' + ProvisioningState ManagedClusterPodIdentityProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningInfo - READ-ONLY + ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo `json:"provisioningInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentity. +func (mcpi ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpi.Name != nil { + objectMap["name"] = mcpi.Name + } + if mcpi.Namespace != nil { + objectMap["namespace"] = mcpi.Namespace + } + if mcpi.BindingSelector != nil { + objectMap["bindingSelector"] = mcpi.BindingSelector + } + if mcpi.Identity != nil { + objectMap["identity"] = mcpi.Identity + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityException see [disable AAD Pod Identity for a specific +// Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for +// more details. +type ManagedClusterPodIdentityException struct { + // Name - The name of the pod identity exception. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity exception. + Namespace *string `json:"namespace,omitempty"` + // PodLabels - The pod labels to match. + PodLabels map[string]*string `json:"podLabels"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentityException. +func (mcpie ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpie.Name != nil { + objectMap["name"] = mcpie.Name + } + if mcpie.Namespace != nil { + objectMap["namespace"] = mcpie.Namespace + } + if mcpie.PodLabels != nil { + objectMap["podLabels"] = mcpie.PodLabels + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityProfile see [use AAD pod +// identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod +// identity integration. +type ManagedClusterPodIdentityProfile struct { + // Enabled - Whether the pod identity addon is enabled. + Enabled *bool `json:"enabled,omitempty"` + // AllowNetworkPluginKubenet - Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. + AllowNetworkPluginKubenet *bool `json:"allowNetworkPluginKubenet,omitempty"` + // UserAssignedIdentities - The pod identities to use in the cluster. + UserAssignedIdentities *[]ManagedClusterPodIdentity `json:"userAssignedIdentities,omitempty"` + // UserAssignedIdentityExceptions - The pod identity exceptions to allow. + UserAssignedIdentityExceptions *[]ManagedClusterPodIdentityException `json:"userAssignedIdentityExceptions,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningError an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningError struct { + // Error - Details about the error. + Error *ManagedClusterPodIdentityProvisioningErrorBody `json:"error,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningErrorBody an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]ManagedClusterPodIdentityProvisioningErrorBody `json:"details,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningInfo ... +type ManagedClusterPodIdentityProvisioningInfo struct { + // Error - Pod identity assignment error (if any). + Error *ManagedClusterPodIdentityProvisioningError `json:"error,omitempty"` +} + +// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. +type ManagedClusterPoolUpgradeProfile struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Name - The Agent Pool name. + Name *string `json:"name,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` +} + +// ManagedClusterPoolUpgradeProfileUpgradesItem ... +type ManagedClusterPoolUpgradeProfileUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// ManagedClusterProperties properties of the managed cluster. +type ManagedClusterProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - READ-ONLY; The Power State of the cluster. + PowerState *PowerState `json:"powerState,omitempty"` + // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. + MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` + // KubernetesVersion - When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // DNSPrefix - This cannot be updated once the Managed Cluster has been created. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // FqdnSubdomain - This cannot be updated once the Managed Cluster has been created. + FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` + // Fqdn - READ-ONLY; The FQDN of the master pool. + Fqdn *string `json:"fqdn,omitempty"` + // PrivateFQDN - READ-ONLY; The FQDN of private cluster. + PrivateFQDN *string `json:"privateFQDN,omitempty"` + // AzurePortalFQDN - READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. + AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty"` + // AgentPoolProfiles - The agent pool properties. + AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + // LinuxProfile - The profile for Linux VMs in the Managed Cluster. + LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` + // WindowsProfile - The profile for Windows VMs in the Managed Cluster. + WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` + // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. + ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // AddonProfiles - The profile of managed cluster add-on. + AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` + // PodIdentityProfile - See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. + PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` + // NodeResourceGroup - The name of the resource group containing agent pool nodes. + NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. + EnableRBAC *bool `json:"enableRBAC,omitempty"` + // EnablePodSecurityPolicy - (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy. + EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` + // NetworkProfile - The network configuration profile. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // AadProfile - The Azure Active Directory configuration. + AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` + // AutoUpgradeProfile - The auto upgrade configuration. + AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` + // AutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled + AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` + // APIServerAccessProfile - The access profile for managed cluster API server. + APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` + // DiskEncryptionSetID - This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' + DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` + // IdentityProfile - Identities associated with the cluster. + IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile"` + // PrivateLinkResources - Private link resources associated with the cluster. + PrivateLinkResources *[]PrivateLinkResource `json:"privateLinkResources,omitempty"` + // DisableLocalAccounts - If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). + DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"` + // HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. + HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` + // SecurityProfile - Security profile for the managed cluster. + SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"` + // PublicNetworkAccess - Allow or deny public network access for AKS. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterProperties. +func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.KubernetesVersion != nil { + objectMap["kubernetesVersion"] = mcp.KubernetesVersion + } + if mcp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mcp.DNSPrefix + } + if mcp.FqdnSubdomain != nil { + objectMap["fqdnSubdomain"] = mcp.FqdnSubdomain + } + if mcp.AgentPoolProfiles != nil { + objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles + } + if mcp.LinuxProfile != nil { + objectMap["linuxProfile"] = mcp.LinuxProfile + } + if mcp.WindowsProfile != nil { + objectMap["windowsProfile"] = mcp.WindowsProfile + } + if mcp.ServicePrincipalProfile != nil { + objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile + } + if mcp.AddonProfiles != nil { + objectMap["addonProfiles"] = mcp.AddonProfiles + } + if mcp.PodIdentityProfile != nil { + objectMap["podIdentityProfile"] = mcp.PodIdentityProfile + } + if mcp.NodeResourceGroup != nil { + objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup + } + if mcp.EnableRBAC != nil { + objectMap["enableRBAC"] = mcp.EnableRBAC + } + if mcp.EnablePodSecurityPolicy != nil { + objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy + } + if mcp.NetworkProfile != nil { + objectMap["networkProfile"] = mcp.NetworkProfile + } + if mcp.AadProfile != nil { + objectMap["aadProfile"] = mcp.AadProfile + } + if mcp.AutoUpgradeProfile != nil { + objectMap["autoUpgradeProfile"] = mcp.AutoUpgradeProfile + } + if mcp.AutoScalerProfile != nil { + objectMap["autoScalerProfile"] = mcp.AutoScalerProfile + } + if mcp.APIServerAccessProfile != nil { + objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile + } + if mcp.DiskEncryptionSetID != nil { + objectMap["diskEncryptionSetID"] = mcp.DiskEncryptionSetID + } + if mcp.IdentityProfile != nil { + objectMap["identityProfile"] = mcp.IdentityProfile + } + if mcp.PrivateLinkResources != nil { + objectMap["privateLinkResources"] = mcp.PrivateLinkResources + } + if mcp.DisableLocalAccounts != nil { + objectMap["disableLocalAccounts"] = mcp.DisableLocalAccounts + } + if mcp.HTTPProxyConfig != nil { + objectMap["httpProxyConfig"] = mcp.HTTPProxyConfig + } + if mcp.SecurityProfile != nil { + objectMap["securityProfile"] = mcp.SecurityProfile + } + if mcp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = mcp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// ManagedClusterPropertiesAutoScalerProfile parameters to be applied to the cluster-autoscaler when +// enabled +type ManagedClusterPropertiesAutoScalerProfile struct { + // BalanceSimilarNodeGroups - Valid values are 'true' and 'false' + BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` + // Expander - If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. Possible values include: 'ExpanderLeastWaste', 'ExpanderMostPods', 'ExpanderPriority', 'ExpanderRandom' + Expander Expander `json:"expander,omitempty"` + // MaxEmptyBulkDelete - The default is 10. + MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` + // MaxGracefulTerminationSec - The default is 600. + MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` + // MaxNodeProvisionTime - The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` + // MaxTotalUnreadyPercentage - The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` + // NewPodScaleUpDelay - For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` + // OkTotalUnreadyCount - This must be an integer. The default is 3. + OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` + // ScanInterval - The default is '10'. Values must be an integer number of seconds. + ScanInterval *string `json:"scan-interval,omitempty"` + // ScaleDownDelayAfterAdd - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` + // ScaleDownDelayAfterDelete - The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` + // ScaleDownDelayAfterFailure - The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` + // ScaleDownUnneededTime - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` + // ScaleDownUnreadyTime - The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` + // ScaleDownUtilizationThreshold - The default is '0.5'. + ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` + // SkipNodesWithLocalStorage - The default is true. + SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` + // SkipNodesWithSystemPods - The default is true. + SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` +} + +// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersCreateOrUpdateFuture.Result. +func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.CreateOrUpdateResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersDeleteFuture.Result. +func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterSecurityProfile security profile for the container service cluster. +type ManagedClusterSecurityProfile struct { + // AzureDefender - Azure Defender settings for the security profile. + AzureDefender *ManagedClusterSecurityProfileAzureDefender `json:"azureDefender,omitempty"` +} + +// ManagedClusterSecurityProfileAzureDefender azure Defender settings for the security profile. +type ManagedClusterSecurityProfileAzureDefender struct { + // Enabled - Whether to enable Azure Defender + Enabled *bool `json:"enabled,omitempty"` + // LogAnalyticsWorkspaceResourceID - Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. + LogAnalyticsWorkspaceResourceID *string `json:"logAnalyticsWorkspaceResourceId,omitempty"` +} + +// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to +// use for manipulating Azure APIs. +type ManagedClusterServicePrincipalProfile struct { + // ClientID - The ID for the service principal. + ClientID *string `json:"clientId,omitempty"` + // Secret - The secret password associated with the service principal in plain text. + Secret *string `json:"secret,omitempty"` +} + +// ManagedClusterSKU the SKU of a Managed Cluster. +type ManagedClusterSKU struct { + // Name - The name of a managed cluster SKU. Possible values include: 'ManagedClusterSKUNameBasic' + Name ManagedClusterSKUName `json:"name,omitempty"` + // Tier - If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. Possible values include: 'ManagedClusterSKUTierPaid', 'ManagedClusterSKUTierFree' + Tier ManagedClusterSKUTier `json:"tier,omitempty"` +} + +// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersResetAADProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetAADProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetAADProfileFuture.Result. +func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersResetServicePrincipalProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetServicePrincipalProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetServicePrincipalProfileFuture.Result. +func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ManagedClustersRotateClusterCertificatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateClusterCertificatesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRotateClusterCertificatesFuture.Result. +func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersRunCommandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (RunCommandResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRunCommandFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRunCommandFuture.Result. +func (future *ManagedClustersRunCommandFuture) result(client ManagedClustersClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStartFuture.Result. +func (future *ManagedClustersStartFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStopFuture.Result. +func (future *ManagedClustersStopFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterStorageProfile storage profile for the container service cluster. +type ManagedClusterStorageProfile struct { + // DiskCSIDriver - AzureDisk CSI Driver settings for the storage profile. + DiskCSIDriver *ManagedClusterStorageProfileDiskCSIDriver `json:"diskCSIDriver,omitempty"` + // FileCSIDriver - AzureFile CSI Driver settings for the storage profile. + FileCSIDriver *ManagedClusterStorageProfileFileCSIDriver `json:"fileCSIDriver,omitempty"` + // SnapshotController - Snapshot Controller settings for the storage profile. + SnapshotController *ManagedClusterStorageProfileSnapshotController `json:"snapshotController,omitempty"` +} + +// ManagedClusterStorageProfileDiskCSIDriver azureDisk CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileDiskCSIDriver struct { + // Enabled - Whether to enable AzureDisk CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterStorageProfileFileCSIDriver azureFile CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileFileCSIDriver struct { + // Enabled - Whether to enable AzureFile CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterStorageProfileSnapshotController snapshot Controller settings for the storage profile. +type ManagedClusterStorageProfileSnapshotController struct { + // Enabled - Whether to enable Snapshot Controller. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersUpdateTagsFuture.Result. +func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.UpdateTagsResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. +type ManagedClusterUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the upgrade profile. + Type *string `json:"type,omitempty"` + // ManagedClusterUpgradeProfileProperties - The properties of the upgrade profile. + *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. +func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcup.ManagedClusterUpgradeProfileProperties != nil { + objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. +func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcup.Type = &typeVar + } + case "properties": + if v != nil { + var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties + err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) + if err != nil { + return err + } + mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties + } + } + } + + return nil +} + +// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. +type ManagedClusterUpgradeProfileProperties struct { + // ControlPlaneProfile - The list of available upgrade versions for the control plane. + ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` + // AgentPoolProfiles - The list of available upgrade versions for agent pools. + AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` +} + +// ManagedClusterWindowsProfile profile for Windows VMs in the managed cluster. +type ManagedClusterWindowsProfile struct { + // AdminUsername - Specifies the name of the administrator account.

**Restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length:** 1 character

**Max-length:** 20 characters + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + AdminPassword *string `json:"adminPassword,omitempty"` + // LicenseType - The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. Possible values include: 'LicenseTypeNone', 'LicenseTypeWindowsServer' + LicenseType LicenseType `json:"licenseType,omitempty"` + // EnableCSIProxy - For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). + EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` + // GmsaProfile - The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` +} + +// MasterProfile profile for the container service master. +type MasterProfile struct { + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + Count *int32 `json:"count,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' + VMSize VMSizeTypes `json:"vmSize,omitempty"` + // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. + FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` + // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageProfileTypesStorageAccount', 'StorageProfileTypesManagedDisks' + StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` + // Fqdn - READ-ONLY; FQDN for the master pool. + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MasterProfile. +func (mp MasterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.Count != nil { + objectMap["count"] = mp.Count + } + if mp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mp.DNSPrefix + } + if mp.VMSize != "" { + objectMap["vmSize"] = mp.VMSize + } + if mp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB + } + if mp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mp.VnetSubnetID + } + if mp.FirstConsecutiveStaticIP != nil { + objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP + } + if mp.StorageProfile != "" { + objectMap["storageProfile"] = mp.StorageProfile + } + return json.Marshal(objectMap) +} + +// NetworkProfile profile of network configuration. +type NetworkProfile struct { + // NetworkPlugin - Network plugin used for building the Kubernetes network. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - Network policy used for building the Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. + PodCidr *string `json:"podCidr,omitempty"` + // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + DNSServiceIP *string `json:"dnsServiceIP,omitempty"` + // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + // OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). Possible values include: 'OutboundTypeLoadBalancer', 'OutboundTypeUserDefinedRouting', 'OutboundTypeManagedNATGateway', 'OutboundTypeUserAssignedNATGateway' + OutboundType OutboundType `json:"outboundType,omitempty"` + // LoadBalancerSku - The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` + // LoadBalancerProfile - Profile of the cluster load balancer. + LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + // NatGatewayProfile - Profile of the cluster NAT gateway. + NatGatewayProfile *ManagedClusterNATGatewayProfile `json:"natGatewayProfile,omitempty"` + // PodCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. + PodCidrs *[]string `json:"podCidrs,omitempty"` + // ServiceCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. + ServiceCidrs *[]string `json:"serviceCidrs,omitempty"` + // IPFamilies - IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. + IPFamilies *[]IPFamily `json:"ipFamilies,omitempty"` +} + +// OperationListResult the List Operation response. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of operations + Value *[]OperationValue `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationValue describes the properties of a Operation value. +type OperationValue struct { + // Origin - READ-ONLY; The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the operation. + Name *string `json:"name,omitempty"` + // OperationValueDisplay - Describes the properties of a Operation Value Display. + *OperationValueDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValue. +func (ov OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ov.OperationValueDisplay != nil { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationValue struct. +func (ov *OperationValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil +} + +// OperationValueDisplay describes the properties of a Operation Value Display. +type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValueDisplay. +func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OSOptionProfile the OS option profile. +type OSOptionProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the OS option resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the OS option resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the OS option resource. + Type *string `json:"type,omitempty"` + // OSOptionPropertyList - The list of OS options. + *OSOptionPropertyList `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OSOptionProfile. +func (oop OSOptionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oop.OSOptionPropertyList != nil { + objectMap["properties"] = oop.OSOptionPropertyList + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OSOptionProfile struct. +func (oop *OSOptionProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oop.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oop.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oop.Type = &typeVar + } + case "properties": + if v != nil { + var oSOptionPropertyList OSOptionPropertyList + err = json.Unmarshal(*v, &oSOptionPropertyList) + if err != nil { + return err + } + oop.OSOptionPropertyList = &oSOptionPropertyList + } + } + } + + return nil +} + +// OSOptionProperty OS option property. +type OSOptionProperty struct { + // OsType - The OS type. + OsType *string `json:"os-type,omitempty"` + // EnableFipsImage - Whether the image is FIPS-enabled. + EnableFipsImage *bool `json:"enable-fips-image,omitempty"` +} + +// OSOptionPropertyList the list of OS option properties. +type OSOptionPropertyList struct { + // OsOptionPropertyList - The list of OS options. + OsOptionPropertyList *[]OSOptionProperty `json:"osOptionPropertyList,omitempty"` +} + +// OutboundEnvironmentEndpoint egress endpoints which AKS agent nodes connect to for common purpose. +type OutboundEnvironmentEndpoint struct { + // Category - The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that AKS agent nodes connect to + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// OutboundEnvironmentEndpointCollection collection of OutboundEnvironmentEndpoint +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.Value != nil { + objectMap["value"] = oeec.Value + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oeec) + if err != nil { + return err + } + page.oeec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// PowerState describes the Power State of the cluster +type PowerState struct { + // Code - Tells whether the cluster is Running or Stopped. Possible values include: 'CodeRunning', 'CodeStopped' + Code Code `json:"code,omitempty"` +} + +// PrivateEndpoint private endpoint which a connection belongs to. +type PrivateEndpoint struct { + // ID - The resource ID of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the private endpoint connection. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the private endpoint connection. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // ID - The ID of the private link resource. + ID *string `json:"id,omitempty"` + // Name - The name of the private link resource. + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` + // GroupID - The group ID of the resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The RequiredMembers of the resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // PrivateLinkServiceID - READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. + PrivateLinkServiceID *string `json:"privateLinkServiceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + if plr.GroupID != nil { + objectMap["groupId"] = plr.GroupID + } + if plr.RequiredMembers != nil { + objectMap["requiredMembers"] = plr.RequiredMembers + } + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesListResult a list of private link resources +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkServiceConnectionState the state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // Status - The private link service connection status. Possible values include: 'ConnectionStatusPending', 'ConnectionStatusApproved', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' + Status ConnectionStatus `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceReference a reference to an Azure resource. +type ResourceReference struct { + // ID - The fully qualified Azure resource id. + ID *string `json:"id,omitempty"` +} + +// RunCommandRequest a run command request +type RunCommandRequest struct { + // Command - The command to run. + Command *string `json:"command,omitempty"` + // Context - A base64 encoded zip file containing the files required by the command. + Context *string `json:"context,omitempty"` + // ClusterToken - AuthToken issued for AKS AAD Server App. + ClusterToken *string `json:"clusterToken,omitempty"` +} + +// RunCommandResult run command result. +type RunCommandResult struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The command id. + ID *string `json:"id,omitempty"` + // CommandResultProperties - Properties of command result. + *CommandResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunCommandResult. +func (rcr RunCommandResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcr.CommandResultProperties != nil { + objectMap["properties"] = rcr.CommandResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RunCommandResult struct. +func (rcr *RunCommandResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcr.ID = &ID + } + case "properties": + if v != nil { + var commandResultProperties CommandResultProperties + err = json.Unmarshal(*v, &commandResultProperties) + if err != nil { + return err + } + rcr.CommandResultProperties = &commandResultProperties + } + } + } + + return nil +} + +// Snapshot a node pool snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + // SnapshotProperties - Properties of a snapshot. + *SnapshotProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + if s.Location != nil { + objectMap["location"] = s.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SnapshotListResult the response from the List Snapshots operation. +type SnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotListResult. +func (slr SnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.Value != nil { + objectMap["value"] = slr.Value + } + return json.Marshal(objectMap) +} + +// SnapshotListResultIterator provides access to a complete listing of Snapshot values. +type SnapshotListResultIterator struct { + i int + page SnapshotListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SnapshotListResultIterator) Response() SnapshotListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SnapshotListResultIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotListResultIterator type. +func NewSnapshotListResultIterator(page SnapshotListResultPage) SnapshotListResultIterator { + return SnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SnapshotListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SnapshotListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// snapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SnapshotListResult) snapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SnapshotListResultPage contains a page of Snapshot values. +type SnapshotListResultPage struct { + fn func(context.Context, SnapshotListResult) (SnapshotListResult, error) + slr SnapshotListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotListResultPage) Response() SnapshotListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotListResultPage) Values() []Snapshot { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SnapshotListResultPage type. +func NewSnapshotListResultPage(cur SnapshotListResult, getNextPage func(context.Context, SnapshotListResult) (SnapshotListResult, error)) SnapshotListResultPage { + return SnapshotListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SnapshotProperties properties used to configure a node pool snapshot. +type SnapshotProperties struct { + // CreationData - CreationData to be used to specify the source agent pool resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // KubernetesVersion - READ-ONLY; The version of Kubernetes. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image. + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // OsType - READ-ONLY; Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSku - READ-ONLY; Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSku OSSKU `json:"osSku,omitempty"` + // VMSize - READ-ONLY; The size of the VM. + VMSize *string `json:"vmSize,omitempty"` + // EnableFIPS - READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool `json:"enableFIPS,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.CreationData != nil { + objectMap["creationData"] = sp.CreationData + } + if sp.SnapshotType != "" { + objectMap["snapshotType"] = sp.SnapshotType + } + return json.Marshal(objectMap) +} + +// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey contains information about SSH certificate public key data. +type SSHPublicKey struct { + // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + KeyData *string `json:"keyData,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SysctlConfig sysctl settings for Linux agent nodes. +type SysctlConfig struct { + // NetCoreSomaxconn - Sysctl setting net.core.somaxconn. + NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` + // NetCoreNetdevMaxBacklog - Sysctl setting net.core.netdev_max_backlog. + NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"` + // NetCoreRmemDefault - Sysctl setting net.core.rmem_default. + NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` + // NetCoreRmemMax - Sysctl setting net.core.rmem_max. + NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"` + // NetCoreWmemDefault - Sysctl setting net.core.wmem_default. + NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` + // NetCoreWmemMax - Sysctl setting net.core.wmem_max. + NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"` + // NetCoreOptmemMax - Sysctl setting net.core.optmem_max. + NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` + // NetIpv4TCPMaxSynBacklog - Sysctl setting net.ipv4.tcp_max_syn_backlog. + NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TcpMaxSynBacklog,omitempty"` + // NetIpv4TCPMaxTwBuckets - Sysctl setting net.ipv4.tcp_max_tw_buckets. + NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TcpMaxTwBuckets,omitempty"` + // NetIpv4TCPFinTimeout - Sysctl setting net.ipv4.tcp_fin_timeout. + NetIpv4TCPFinTimeout *int32 `json:"netIpv4TcpFinTimeout,omitempty"` + // NetIpv4TCPKeepaliveTime - Sysctl setting net.ipv4.tcp_keepalive_time. + NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TcpKeepaliveTime,omitempty"` + // NetIpv4TCPKeepaliveProbes - Sysctl setting net.ipv4.tcp_keepalive_probes. + NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TcpKeepaliveProbes,omitempty"` + // NetIpv4TcpkeepaliveIntvl - Sysctl setting net.ipv4.tcp_keepalive_intvl. + NetIpv4TcpkeepaliveIntvl *int32 `json:"netIpv4TcpkeepaliveIntvl,omitempty"` + // NetIpv4TCPTwReuse - Sysctl setting net.ipv4.tcp_tw_reuse. + NetIpv4TCPTwReuse *bool `json:"netIpv4TcpTwReuse,omitempty"` + // NetIpv4IPLocalPortRange - Sysctl setting net.ipv4.ip_local_port_range. + NetIpv4IPLocalPortRange *string `json:"netIpv4IpLocalPortRange,omitempty"` + // NetIpv4NeighDefaultGcThresh1 - Sysctl setting net.ipv4.neigh.default.gc_thresh1. + NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"` + // NetIpv4NeighDefaultGcThresh2 - Sysctl setting net.ipv4.neigh.default.gc_thresh2. + NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` + // NetIpv4NeighDefaultGcThresh3 - Sysctl setting net.ipv4.neigh.default.gc_thresh3. + NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` + // NetNetfilterNfConntrackMax - Sysctl setting net.netfilter.nf_conntrack_max. + NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"` + // NetNetfilterNfConntrackBuckets - Sysctl setting net.netfilter.nf_conntrack_buckets. + NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` + // FsInotifyMaxUserWatches - Sysctl setting fs.inotify.max_user_watches. + FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` + // FsFileMax - Sysctl setting fs.file-max. + FsFileMax *int32 `json:"fsFileMax,omitempty"` + // FsAioMaxNr - Sysctl setting fs.aio-max-nr. + FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` + // FsNrOpen - Sysctl setting fs.nr_open. + FsNrOpen *int32 `json:"fsNrOpen,omitempty"` + // KernelThreadsMax - Sysctl setting kernel.threads-max. + KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` + // VMMaxMapCount - Sysctl setting vm.max_map_count. + VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"` + // VMSwappiness - Sysctl setting vm.swappiness. + VMSwappiness *int32 `json:"vmSwappiness,omitempty"` + // VMVfsCachePressure - Sysctl setting vm.vfs_cache_pressure. + VMVfsCachePressure *int32 `json:"vmVfsCachePressure,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// TimeInWeek time in a week. +type TimeInWeek struct { + // Day - The day of the week. Possible values include: 'WeekDaySunday', 'WeekDayMonday', 'WeekDayTuesday', 'WeekDayWednesday', 'WeekDayThursday', 'WeekDayFriday', 'WeekDaySaturday' + Day WeekDay `json:"day,omitempty"` + // HourSlots - Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + HourSlots *[]int32 `json:"hourSlots,omitempty"` +} + +// TimeSpan for example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. +type TimeSpan struct { + // Start - The start of a time span + Start *date.Time `json:"start,omitempty"` + // End - The end of a time span + End *date.Time `json:"end,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentity details about a user assigned identity. +type UserAssignedIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// VMDiagnostics profile for diagnostics on the container service VMs. +type VMDiagnostics struct { + // Enabled - Whether the VM diagnostic agent is provisioned on the VM. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. + StorageURI *string `json:"storageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMDiagnostics. +func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vd.Enabled != nil { + objectMap["enabled"] = vd.Enabled + } + return json.Marshal(objectMap) +} + +// WindowsGmsaProfile windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Enabled - Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool `json:"enabled,omitempty"` + // DNSServer - Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string `json:"dnsServer,omitempty"` + // RootDomainName - Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string `json:"rootDomainName,omitempty"` +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/operations.go b/services/containerservice/mgmt/2022-03-01/containerservice/operations.go new file mode 100644 index 000000000000..7392c58bdd77 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/operations.go @@ -0,0 +1,98 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Container Service Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/privateendpointconnections.go b/services/containerservice/mgmt/2022-03-01/containerservice/privateendpointconnections.go new file mode 100644 index 000000000000..47d8f8785618 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/privateendpointconnections.go @@ -0,0 +1,406 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Container Service Client. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +// parameters - the updated private endpoint connection. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/privatelinkresources.go b/services/containerservice/mgmt/2022-03-01/containerservice/privatelinkresources.go new file mode 100644 index 000000000000..b39681bf2d1d --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/privatelinkresources.go @@ -0,0 +1,122 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Container Service Client. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourcesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/resolveprivatelinkserviceid.go b/services/containerservice/mgmt/2022-03-01/containerservice/resolveprivatelinkserviceid.go new file mode 100644 index 000000000000..b52ce679c375 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/resolveprivatelinkserviceid.go @@ -0,0 +1,126 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResolvePrivateLinkServiceIDClient is the the Container Service Client. +type ResolvePrivateLinkServiceIDClient struct { + BaseClient +} + +// NewResolvePrivateLinkServiceIDClient creates an instance of the ResolvePrivateLinkServiceIDClient client. +func NewResolvePrivateLinkServiceIDClient(subscriptionID string) ResolvePrivateLinkServiceIDClient { + return NewResolvePrivateLinkServiceIDClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResolvePrivateLinkServiceIDClientWithBaseURI creates an instance of the ResolvePrivateLinkServiceIDClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewResolvePrivateLinkServiceIDClientWithBaseURI(baseURI string, subscriptionID string) ResolvePrivateLinkServiceIDClient { + return ResolvePrivateLinkServiceIDClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// POST sends the post request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters required in order to resolve a private link service ID. +func (client ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResolvePrivateLinkServiceIDClient.POST") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ResolvePrivateLinkServiceIDClient", "POST", err.Error()) + } + + req, err := client.POSTPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", nil, "Failure preparing request") + return + } + + resp, err := client.POSTSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure sending request") + return + } + + result, err = client.POSTResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure responding to request") + return + } + + return +} + +// POSTPreparer prepares the POST request. +func (client ResolvePrivateLinkServiceIDClient) POSTPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.PrivateLinkServiceID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// POSTSender sends the POST request. The method will close the +// http.Response Body if it receives an error. +func (client ResolvePrivateLinkServiceIDClient) POSTSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// POSTResponder handles the response to the POST request. The method always +// closes the http.Response Body. +func (client ResolvePrivateLinkServiceIDClient) POSTResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/snapshots.go b/services/containerservice/mgmt/2022-03-01/containerservice/snapshots.go new file mode 100644 index 000000000000..58ad02bce196 --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/snapshots.go @@ -0,0 +1,637 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the the Container Service Client. +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the snapshot to create or update. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update snapshot Tags operation. +func (client SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateTagsResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/containerservice/mgmt/2022-03-01/containerservice/version.go b/services/containerservice/mgmt/2022-03-01/containerservice/version.go new file mode 100644 index 000000000000..7acb3d7ac15c --- /dev/null +++ b/services/containerservice/mgmt/2022-03-01/containerservice/version.go @@ -0,0 +1,19 @@ +package containerservice + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " containerservice/2022-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/network/mgmt/2021-05-01/network/_meta.json b/services/network/mgmt/2021-05-01/network/_meta.json index a480b84f7231..8e289e8cb6cf 100644 --- a/services/network/mgmt/2021-05-01/network/_meta.json +++ b/services/network/mgmt/2021-05-01/network/_meta.json @@ -1,5 +1,5 @@ { - "commit": "ad6f098218e4f5eab87e784f1b6fc8a713147cab", + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", "readme": "/_/azure-rest-api-specs/specification/network/resource-manager/readme.md", "tag": "package-2021-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/network/mgmt/2021-05-01/network/models.go b/services/network/mgmt/2021-05-01/network/models.go index e69cd2682c8d..5dbaff5a7ede 100644 --- a/services/network/mgmt/2021-05-01/network/models.go +++ b/services/network/mgmt/2021-05-01/network/models.go @@ -15653,7 +15653,7 @@ type ExpressRouteGatewayList struct { type ExpressRouteGatewayProperties struct { // AutoScaleConfiguration - Configuration for auto scaling. AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration `json:"autoScaleConfiguration,omitempty"` - // ExpressRouteConnections - READ-ONLY; List of ExpressRoute connections to the ExpressRoute gateway. + // ExpressRouteConnections - List of ExpressRoute connections to the ExpressRoute gateway. ExpressRouteConnections *[]ExpressRouteConnection `json:"expressRouteConnections,omitempty"` // ProvisioningState - READ-ONLY; The provisioning state of the express route gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` @@ -15667,6 +15667,9 @@ func (ergp ExpressRouteGatewayProperties) MarshalJSON() ([]byte, error) { if ergp.AutoScaleConfiguration != nil { objectMap["autoScaleConfiguration"] = ergp.AutoScaleConfiguration } + if ergp.ExpressRouteConnections != nil { + objectMap["expressRouteConnections"] = ergp.ExpressRouteConnections + } if ergp.VirtualHub != nil { objectMap["virtualHub"] = ergp.VirtualHub } diff --git a/services/network/mgmt/2021-08-01/network/CHANGELOG.md b/services/network/mgmt/2021-08-01/network/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/network/mgmt/2021-08-01/network/_meta.json b/services/network/mgmt/2021-08-01/network/_meta.json new file mode 100644 index 000000000000..8a1fac8f5106 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", + "readme": "/_/azure-rest-api-specs/specification/network/resource-manager/readme.md", + "tag": "package-2021-08", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-08 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/network/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/network/mgmt/2021-08-01/network/applicationgatewayprivateendpointconnections.go b/services/network/mgmt/2021-08-01/network/applicationgatewayprivateendpointconnections.go new file mode 100644 index 000000000000..2e1a4a6839b9 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/applicationgatewayprivateendpointconnections.go @@ -0,0 +1,395 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationGatewayPrivateEndpointConnectionsClient is the network Client +type ApplicationGatewayPrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewApplicationGatewayPrivateEndpointConnectionsClient creates an instance of the +// ApplicationGatewayPrivateEndpointConnectionsClient client. +func NewApplicationGatewayPrivateEndpointConnectionsClient(subscriptionID string) ApplicationGatewayPrivateEndpointConnectionsClient { + return NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI creates an instance of the +// ApplicationGatewayPrivateEndpointConnectionsClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewApplicationGatewayPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewayPrivateEndpointConnectionsClient { + return ApplicationGatewayPrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete deletes the specified private endpoint connection on application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// connectionName - the name of the application gateway private endpoint connection. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (result ApplicationGatewayPrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future ApplicationGatewayPrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private endpoint connection on application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// connectionName - the name of the application gateway private endpoint connection. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (result ApplicationGatewayPrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result ApplicationGatewayPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all private endpoint connections on an application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewayPrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.agpeclr.Response.Response != nil { + sc = result.agpeclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.agpeclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.agpeclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.agpeclr.hasNextLink() && result.agpeclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result ApplicationGatewayPrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayPrivateEndpointConnectionListResult) (result ApplicationGatewayPrivateEndpointConnectionListResult, err error) { + req, err := lastResults.applicationGatewayPrivateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewayPrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, applicationGatewayName) + return +} + +// Update updates the specified private endpoint connection on application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// connectionName - the name of the application gateway private endpoint connection. +// parameters - parameters supplied to update application gateway private endpoint connection operation. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection) (result ApplicationGatewayPrivateEndpointConnectionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationGatewayName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters ApplicationGatewayPrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateEndpointConnections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (future ApplicationGatewayPrivateEndpointConnectionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ApplicationGatewayPrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result ApplicationGatewayPrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/applicationgatewayprivatelinkresources.go b/services/network/mgmt/2021-08-01/network/applicationgatewayprivatelinkresources.go new file mode 100644 index 000000000000..b3c4a19361d6 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/applicationgatewayprivatelinkresources.go @@ -0,0 +1,151 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationGatewayPrivateLinkResourcesClient is the network Client +type ApplicationGatewayPrivateLinkResourcesClient struct { + BaseClient +} + +// NewApplicationGatewayPrivateLinkResourcesClient creates an instance of the +// ApplicationGatewayPrivateLinkResourcesClient client. +func NewApplicationGatewayPrivateLinkResourcesClient(subscriptionID string) ApplicationGatewayPrivateLinkResourcesClient { + return NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI creates an instance of the +// ApplicationGatewayPrivateLinkResourcesClient client using a custom endpoint. Use this when interacting with an +// Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewApplicationGatewayPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewayPrivateLinkResourcesClient { + return ApplicationGatewayPrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all private link resources on an application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewayPrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewayPrivateLinkResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.agplrlr.Response.Response != nil { + sc = result.agplrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.agplrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result.agplrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.agplrlr.hasNextLink() && result.agplrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationGatewayPrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewayPrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationGatewayPrivateLinkResourcesClient) ListResponder(resp *http.Response) (result ApplicationGatewayPrivateLinkResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationGatewayPrivateLinkResourcesClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayPrivateLinkResourceListResult) (result ApplicationGatewayPrivateLinkResourceListResult, err error) { + req, err := lastResults.applicationGatewayPrivateLinkResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateLinkResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationGatewayPrivateLinkResourcesClient) ListComplete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewayPrivateLinkResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, applicationGatewayName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/applicationgateways.go b/services/network/mgmt/2021-08-01/network/applicationgateways.go new file mode 100644 index 000000000000..08eed6176d25 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/applicationgateways.go @@ -0,0 +1,1474 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationGatewaysClient is the network Client +type ApplicationGatewaysClient struct { + BaseClient +} + +// NewApplicationGatewaysClient creates an instance of the ApplicationGatewaysClient client. +func NewApplicationGatewaysClient(subscriptionID string) ApplicationGatewaysClient { + return NewApplicationGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationGatewaysClientWithBaseURI creates an instance of the ApplicationGatewaysClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewApplicationGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ApplicationGatewaysClient { + return ApplicationGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// BackendHealth gets the backend health of the specified application gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. +func (client ApplicationGatewaysClient) BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result ApplicationGatewaysBackendHealthFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealth") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.BackendHealthPreparer(ctx, resourceGroupName, applicationGatewayName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", nil, "Failure preparing request") + return + } + + result, err = client.BackendHealthSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealth", result.Response(), "Failure sending request") + return + } + + return +} + +// BackendHealthPreparer prepares the BackendHealth request. +func (client ApplicationGatewaysClient) BackendHealthPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendhealth", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackendHealthSender sends the BackendHealth request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) BackendHealthSender(req *http.Request) (future ApplicationGatewaysBackendHealthFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// BackendHealthResponder handles the response to the BackendHealth request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) BackendHealthResponder(resp *http.Response) (result ApplicationGatewayBackendHealth, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// BackendHealthOnDemand gets the backend health for given combination of backend pool and http setting of the +// specified application gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// probeRequest - request body for on-demand test probe operation. +// expand - expands BackendAddressPool and BackendHttpSettings referenced in backend health. +func (client ApplicationGatewaysClient) BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (result ApplicationGatewaysBackendHealthOnDemandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.BackendHealthOnDemand") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.BackendHealthOnDemandPreparer(ctx, resourceGroupName, applicationGatewayName, probeRequest, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", nil, "Failure preparing request") + return + } + + result, err = client.BackendHealthOnDemandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "BackendHealthOnDemand", result.Response(), "Failure sending request") + return + } + + return +} + +// BackendHealthOnDemandPreparer prepares the BackendHealthOnDemand request. +func (client ApplicationGatewaysClient) BackendHealthOnDemandPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest ApplicationGatewayOnDemandProbe, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + 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/applicationGateways/{applicationGatewayName}/getBackendHealthOnDemand", pathParameters), + autorest.WithJSON(probeRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// BackendHealthOnDemandSender sends the BackendHealthOnDemand request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) BackendHealthOnDemandSender(req *http.Request) (future ApplicationGatewaysBackendHealthOnDemandFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// BackendHealthOnDemandResponder handles the response to the BackendHealthOnDemand request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) BackendHealthOnDemandResponder(resp *http.Response) (result ApplicationGatewayBackendHealthOnDemand, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates the specified application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// parameters - parameters supplied to the create or update application gateway operation. +func (client ApplicationGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (result ApplicationGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.Enabled", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.RuleSetVersion", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySize", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}, + }}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}, + }}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.WebApplicationFirewallConfiguration.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + }}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MinCapacity", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + {Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ApplicationGatewayPropertiesFormat.AutoscaleConfiguration.MaxCapacity", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ApplicationGatewaysClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewaysClient) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewaysClient) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) GetResponder(resp *http.Response) (result ApplicationGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSslPredefinedPolicy gets Ssl predefined policy with the specified policy name. +// Parameters: +// predefinedPolicyName - name of Ssl predefined policy. +func (client ApplicationGatewaysClient) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result ApplicationGatewaySslPredefinedPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.GetSslPredefinedPolicy") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSslPredefinedPolicyPreparer(ctx, predefinedPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", nil, "Failure preparing request") + return + } + + resp, err := client.GetSslPredefinedPolicySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure sending request") + return + } + + result, err = client.GetSslPredefinedPolicyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "GetSslPredefinedPolicy", resp, "Failure responding to request") + return + } + + return +} + +// GetSslPredefinedPolicyPreparer prepares the GetSslPredefinedPolicy request. +func (client ApplicationGatewaysClient) GetSslPredefinedPolicyPreparer(ctx context.Context, predefinedPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "predefinedPolicyName": autorest.Encode("path", predefinedPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSslPredefinedPolicySender sends the GetSslPredefinedPolicy request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) GetSslPredefinedPolicySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSslPredefinedPolicyResponder handles the response to the GetSslPredefinedPolicy request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) GetSslPredefinedPolicyResponder(resp *http.Response) (result ApplicationGatewaySslPredefinedPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all application gateways in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ApplicationGatewaysClient) List(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List") + defer func() { + sc := -1 + if result.aglr.Response.Response != nil { + sc = result.aglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.aglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.aglr.hasNextLink() && result.aglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationGatewaysClient) listNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { + req, err := lastResults.applicationGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the application gateways in a subscription. +func (client ApplicationGatewaysClient) ListAll(ctx context.Context) (result ApplicationGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll") + defer func() { + sc := -1 + if result.aglr.Response.Response != nil { + sc = result.aglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.aglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure sending request") + return + } + + result.aglr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAll", resp, "Failure responding to request") + return + } + if result.aglr.hasNextLink() && result.aglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAllResponder(resp *http.Response) (result ApplicationGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client ApplicationGatewaysClient) listAllNextResults(ctx context.Context, lastResults ApplicationGatewayListResult) (result ApplicationGatewayListResult, err error) { + req, err := lastResults.applicationGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationGatewaysClient) ListAllComplete(ctx context.Context) (result ApplicationGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListAvailableRequestHeaders lists all available request headers. +func (client ApplicationGatewaysClient) ListAvailableRequestHeaders(ctx context.Context) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableRequestHeaders") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableRequestHeadersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableRequestHeadersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableRequestHeadersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableRequestHeaders", resp, "Failure responding to request") + return + } + + return +} + +// ListAvailableRequestHeadersPreparer prepares the ListAvailableRequestHeaders request. +func (client ApplicationGatewaysClient) ListAvailableRequestHeadersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableRequestHeaders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableRequestHeadersSender sends the ListAvailableRequestHeaders request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableRequestHeadersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableRequestHeadersResponder handles the response to the ListAvailableRequestHeaders request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableRequestHeadersResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableResponseHeaders lists all available response headers. +func (client ApplicationGatewaysClient) ListAvailableResponseHeaders(ctx context.Context) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableResponseHeaders") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableResponseHeadersPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableResponseHeadersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableResponseHeadersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableResponseHeaders", resp, "Failure responding to request") + return + } + + return +} + +// ListAvailableResponseHeadersPreparer prepares the ListAvailableResponseHeaders request. +func (client ApplicationGatewaysClient) ListAvailableResponseHeadersPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableResponseHeaders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableResponseHeadersSender sends the ListAvailableResponseHeaders request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableResponseHeadersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableResponseHeadersResponder handles the response to the ListAvailableResponseHeaders request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableResponseHeadersResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableServerVariables lists all available server variables. +func (client ApplicationGatewaysClient) ListAvailableServerVariables(ctx context.Context) (result ListString, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableServerVariables") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableServerVariablesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableServerVariablesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableServerVariablesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableServerVariables", resp, "Failure responding to request") + return + } + + return +} + +// ListAvailableServerVariablesPreparer prepares the ListAvailableServerVariables request. +func (client ApplicationGatewaysClient) ListAvailableServerVariablesPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableServerVariables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableServerVariablesSender sends the ListAvailableServerVariables request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableServerVariablesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableServerVariablesResponder handles the response to the ListAvailableServerVariables request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableServerVariablesResponder(resp *http.Response) (result ListString, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableSslOptions lists available Ssl options for configuring Ssl policy. +func (client ApplicationGatewaysClient) ListAvailableSslOptions(ctx context.Context) (result ApplicationGatewayAvailableSslOptions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslOptions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableSslOptionsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSslOptionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableSslOptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslOptions", resp, "Failure responding to request") + return + } + + return +} + +// ListAvailableSslOptionsPreparer prepares the ListAvailableSslOptions request. +func (client ApplicationGatewaysClient) ListAvailableSslOptionsPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableSslOptionsSender sends the ListAvailableSslOptions request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableSslOptionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableSslOptionsResponder handles the response to the ListAvailableSslOptions request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableSslOptionsResponder(resp *http.Response) (result ApplicationGatewayAvailableSslOptions, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableSslPredefinedPolicies lists all SSL predefined policies for configuring Ssl policy. +func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPolicies(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies") + defer func() { + sc := -1 + if result.agaspp.Response.Response != nil { + sc = result.agaspp.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAvailableSslPredefinedPoliciesNextResults + req, err := client.ListAvailableSslPredefinedPoliciesPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableSslPredefinedPoliciesSender(req) + if err != nil { + result.agaspp.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure sending request") + return + } + + result.agaspp, err = client.ListAvailableSslPredefinedPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableSslPredefinedPolicies", resp, "Failure responding to request") + return + } + if result.agaspp.hasNextLink() && result.agaspp.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAvailableSslPredefinedPoliciesPreparer prepares the ListAvailableSslPredefinedPolicies request. +func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableSslPredefinedPoliciesSender sends the ListAvailableSslPredefinedPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableSslPredefinedPoliciesResponder handles the response to the ListAvailableSslPredefinedPolicies request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesResponder(resp *http.Response) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAvailableSslPredefinedPoliciesNextResults retrieves the next set of results, if any. +func (client ApplicationGatewaysClient) listAvailableSslPredefinedPoliciesNextResults(ctx context.Context, lastResults ApplicationGatewayAvailableSslPredefinedPolicies) (result ApplicationGatewayAvailableSslPredefinedPolicies, err error) { + req, err := lastResults.applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAvailableSslPredefinedPoliciesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAvailableSslPredefinedPoliciesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "listAvailableSslPredefinedPoliciesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAvailableSslPredefinedPoliciesComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationGatewaysClient) ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableSslPredefinedPolicies") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAvailableSslPredefinedPolicies(ctx) + return +} + +// ListAvailableWafRuleSets lists all available web application firewall rule sets. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSets(ctx context.Context) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.ListAvailableWafRuleSets") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableWafRuleSetsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", nil, "Failure preparing request") + return + } + + resp, err := client.ListAvailableWafRuleSetsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure sending request") + return + } + + result, err = client.ListAvailableWafRuleSetsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "ListAvailableWafRuleSets", resp, "Failure responding to request") + return + } + + return +} + +// ListAvailableWafRuleSetsPreparer prepares the ListAvailableWafRuleSets request. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableWafRuleSetsSender sends the ListAvailableWafRuleSets request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAvailableWafRuleSetsResponder handles the response to the ListAvailableWafRuleSets request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) ListAvailableWafRuleSetsResponder(resp *http.Response) (result ApplicationGatewayAvailableWafRuleSetsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts the specified application gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewaysClient) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops the specified application gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +func (client ApplicationGatewaysClient) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result ApplicationGatewaysStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, applicationGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateTags updates the specified application gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationGatewayName - the name of the application gateway. +// parameters - parameters supplied to update application gateway tags. +func (client ApplicationGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (result ApplicationGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ApplicationGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationGatewayName": autorest.Encode("path", applicationGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationGatewaysClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ApplicationGatewaysClient) UpdateTagsResponder(resp *http.Response) (result ApplicationGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/applicationsecuritygroups.go b/services/network/mgmt/2021-08-01/network/applicationsecuritygroups.go new file mode 100644 index 000000000000..062cd381e95b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/applicationsecuritygroups.go @@ -0,0 +1,577 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ApplicationSecurityGroupsClient is the network Client +type ApplicationSecurityGroupsClient struct { + BaseClient +} + +// NewApplicationSecurityGroupsClient creates an instance of the ApplicationSecurityGroupsClient client. +func NewApplicationSecurityGroupsClient(subscriptionID string) ApplicationSecurityGroupsClient { + return NewApplicationSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationSecurityGroupsClientWithBaseURI creates an instance of the ApplicationSecurityGroupsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewApplicationSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationSecurityGroupsClient { + return ApplicationSecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an application security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. +// parameters - parameters supplied to the create or update ApplicationSecurityGroup operation. +func (client ApplicationSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (result ApplicationSecurityGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationSecurityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationSecurityGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationSecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified application security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. +func (client ApplicationSecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, applicationSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (future ApplicationSecurityGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified application security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. +func (client ApplicationSecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, applicationSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ApplicationSecurityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) GetResponder(resp *http.Response) (result ApplicationSecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the application security groups in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ApplicationSecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.List") + defer func() { + sc := -1 + if result.asglr.Response.Response != nil { + sc = result.asglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.asglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure sending request") + return + } + + result.asglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.asglr.hasNextLink() && result.asglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationSecurityGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) ListResponder(resp *http.Response) (result ApplicationSecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ApplicationSecurityGroupsClient) listNextResults(ctx context.Context, lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) { + req, err := lastResults.applicationSecurityGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationSecurityGroupsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all application security groups in a subscription. +func (client ApplicationSecurityGroupsClient) ListAll(ctx context.Context) (result ApplicationSecurityGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.ListAll") + defer func() { + sc := -1 + if result.asglr.Response.Response != nil { + sc = result.asglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.asglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure sending request") + return + } + + result.asglr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.asglr.hasNextLink() && result.asglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ApplicationSecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) ListAllResponder(resp *http.Response) (result ApplicationSecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client ApplicationSecurityGroupsClient) listAllNextResults(ctx context.Context, lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) { + req, err := lastResults.applicationSecurityGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationSecurityGroupsClient) ListAllComplete(ctx context.Context) (result ApplicationSecurityGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates an application security group's tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// applicationSecurityGroupName - the name of the application security group. +// parameters - parameters supplied to update application security group tags. +func (client ApplicationSecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters TagsObject) (result ApplicationSecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, applicationSecurityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ApplicationSecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ApplicationSecurityGroupsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ApplicationSecurityGroupsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationSecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/availabledelegations.go b/services/network/mgmt/2021-08-01/network/availabledelegations.go new file mode 100644 index 000000000000..14c6080dde1d --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/availabledelegations.go @@ -0,0 +1,148 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailableDelegationsClient is the network Client +type AvailableDelegationsClient struct { + BaseClient +} + +// NewAvailableDelegationsClient creates an instance of the AvailableDelegationsClient client. +func NewAvailableDelegationsClient(subscriptionID string) AvailableDelegationsClient { + return NewAvailableDelegationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailableDelegationsClientWithBaseURI creates an instance of the AvailableDelegationsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewAvailableDelegationsClientWithBaseURI(baseURI string, subscriptionID string) AvailableDelegationsClient { + return AvailableDelegationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all of the available subnet delegations for this subscription in this region. +// Parameters: +// location - the location of the subnet. +func (client AvailableDelegationsClient) List(ctx context.Context, location string) (result AvailableDelegationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsClient.List") + defer func() { + sc := -1 + if result.adr.Response.Response != nil { + sc = result.adr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.adr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "List", resp, "Failure sending request") + return + } + + result.adr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "List", resp, "Failure responding to request") + return + } + if result.adr.hasNextLink() && result.adr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableDelegationsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableDelegations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableDelegationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailableDelegationsClient) ListResponder(resp *http.Response) (result AvailableDelegationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableDelegationsClient) listNextResults(ctx context.Context, lastResults AvailableDelegationsResult) (result AvailableDelegationsResult, err error) { + req, err := lastResults.availableDelegationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableDelegationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableDelegationsClient) ListComplete(ctx context.Context, location string) (result AvailableDelegationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/network/mgmt/2021-08-01/network/availableendpointservices.go b/services/network/mgmt/2021-08-01/network/availableendpointservices.go new file mode 100644 index 000000000000..6da78683f7f8 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/availableendpointservices.go @@ -0,0 +1,148 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailableEndpointServicesClient is the network Client +type AvailableEndpointServicesClient struct { + BaseClient +} + +// NewAvailableEndpointServicesClient creates an instance of the AvailableEndpointServicesClient client. +func NewAvailableEndpointServicesClient(subscriptionID string) AvailableEndpointServicesClient { + return NewAvailableEndpointServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailableEndpointServicesClientWithBaseURI creates an instance of the AvailableEndpointServicesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewAvailableEndpointServicesClientWithBaseURI(baseURI string, subscriptionID string) AvailableEndpointServicesClient { + return AvailableEndpointServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list what values of endpoint services are available for use. +// Parameters: +// location - the location to check available endpoint services. +func (client AvailableEndpointServicesClient) List(ctx context.Context, location string) (result EndpointServicesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableEndpointServicesClient.List") + defer func() { + sc := -1 + if result.eslr.Response.Response != nil { + sc = result.eslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.eslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure sending request") + return + } + + result.eslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure responding to request") + return + } + if result.eslr.hasNextLink() && result.eslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableEndpointServicesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableEndpointServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailableEndpointServicesClient) ListResponder(resp *http.Response) (result EndpointServicesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableEndpointServicesClient) listNextResults(ctx context.Context, lastResults EndpointServicesListResult) (result EndpointServicesListResult, err error) { + req, err := lastResults.endpointServicesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableEndpointServicesClient) ListComplete(ctx context.Context, location string) (result EndpointServicesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableEndpointServicesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/network/mgmt/2021-08-01/network/availableprivateendpointtypes.go b/services/network/mgmt/2021-08-01/network/availableprivateendpointtypes.go new file mode 100644 index 000000000000..2a76e1d7f1f0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/availableprivateendpointtypes.go @@ -0,0 +1,267 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailablePrivateEndpointTypesClient is the network Client +type AvailablePrivateEndpointTypesClient struct { + BaseClient +} + +// NewAvailablePrivateEndpointTypesClient creates an instance of the AvailablePrivateEndpointTypesClient client. +func NewAvailablePrivateEndpointTypesClient(subscriptionID string) AvailablePrivateEndpointTypesClient { + return NewAvailablePrivateEndpointTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailablePrivateEndpointTypesClientWithBaseURI creates an instance of the AvailablePrivateEndpointTypesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewAvailablePrivateEndpointTypesClientWithBaseURI(baseURI string, subscriptionID string) AvailablePrivateEndpointTypesClient { + return AvailablePrivateEndpointTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. +// Parameters: +// location - the location of the domain name. +func (client AvailablePrivateEndpointTypesClient) List(ctx context.Context, location string) (result AvailablePrivateEndpointTypesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesClient.List") + defer func() { + sc := -1 + if result.apetr.Response.Response != nil { + sc = result.apetr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.apetr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "List", resp, "Failure sending request") + return + } + + result.apetr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "List", resp, "Failure responding to request") + return + } + if result.apetr.hasNextLink() && result.apetr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailablePrivateEndpointTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailablePrivateEndpointTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailablePrivateEndpointTypesClient) ListResponder(resp *http.Response) (result AvailablePrivateEndpointTypesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailablePrivateEndpointTypesClient) listNextResults(ctx context.Context, lastResults AvailablePrivateEndpointTypesResult) (result AvailablePrivateEndpointTypesResult, err error) { + req, err := lastResults.availablePrivateEndpointTypesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailablePrivateEndpointTypesClient) ListComplete(ctx context.Context, location string) (result AvailablePrivateEndpointTypesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} + +// ListByResourceGroup returns all of the resource types that can be linked to a Private Endpoint in this subscription +// in this region. +// Parameters: +// location - the location of the domain name. +// resourceGroupName - the name of the resource group. +func (client AvailablePrivateEndpointTypesClient) ListByResourceGroup(ctx context.Context, location string, resourceGroupName string) (result AvailablePrivateEndpointTypesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.apetr.Response.Response != nil { + sc = result.apetr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, location, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.apetr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.apetr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.apetr.hasNextLink() && result.apetr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AvailablePrivateEndpointTypesClient) ListByResourceGroupPreparer(ctx context.Context, location string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availablePrivateEndpointTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AvailablePrivateEndpointTypesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AvailablePrivateEndpointTypesClient) ListByResourceGroupResponder(resp *http.Response) (result AvailablePrivateEndpointTypesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AvailablePrivateEndpointTypesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AvailablePrivateEndpointTypesResult) (result AvailablePrivateEndpointTypesResult, err error) { + req, err := lastResults.availablePrivateEndpointTypesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailablePrivateEndpointTypesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailablePrivateEndpointTypesClient) ListByResourceGroupComplete(ctx context.Context, location string, resourceGroupName string) (result AvailablePrivateEndpointTypesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, location, resourceGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/availableresourcegroupdelegations.go b/services/network/mgmt/2021-08-01/network/availableresourcegroupdelegations.go new file mode 100644 index 000000000000..240254d7c7cc --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/availableresourcegroupdelegations.go @@ -0,0 +1,151 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailableResourceGroupDelegationsClient is the network Client +type AvailableResourceGroupDelegationsClient struct { + BaseClient +} + +// NewAvailableResourceGroupDelegationsClient creates an instance of the AvailableResourceGroupDelegationsClient +// client. +func NewAvailableResourceGroupDelegationsClient(subscriptionID string) AvailableResourceGroupDelegationsClient { + return NewAvailableResourceGroupDelegationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailableResourceGroupDelegationsClientWithBaseURI creates an instance of the +// AvailableResourceGroupDelegationsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAvailableResourceGroupDelegationsClientWithBaseURI(baseURI string, subscriptionID string) AvailableResourceGroupDelegationsClient { + return AvailableResourceGroupDelegationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all of the available subnet delegations for this resource group in this region. +// Parameters: +// location - the location of the domain name. +// resourceGroupName - the name of the resource group. +func (client AvailableResourceGroupDelegationsClient) List(ctx context.Context, location string, resourceGroupName string) (result AvailableDelegationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableResourceGroupDelegationsClient.List") + defer func() { + sc := -1 + if result.adr.Response.Response != nil { + sc = result.adr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.adr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "List", resp, "Failure sending request") + return + } + + result.adr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "List", resp, "Failure responding to request") + return + } + if result.adr.hasNextLink() && result.adr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableResourceGroupDelegationsClient) ListPreparer(ctx context.Context, location string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableDelegations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableResourceGroupDelegationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailableResourceGroupDelegationsClient) ListResponder(resp *http.Response) (result AvailableDelegationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableResourceGroupDelegationsClient) listNextResults(ctx context.Context, lastResults AvailableDelegationsResult) (result AvailableDelegationsResult, err error) { + req, err := lastResults.availableDelegationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableResourceGroupDelegationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableResourceGroupDelegationsClient) ListComplete(ctx context.Context, location string, resourceGroupName string) (result AvailableDelegationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableResourceGroupDelegationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, resourceGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/availableservicealiases.go b/services/network/mgmt/2021-08-01/network/availableservicealiases.go new file mode 100644 index 000000000000..439235398ba2 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/availableservicealiases.go @@ -0,0 +1,266 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AvailableServiceAliasesClient is the network Client +type AvailableServiceAliasesClient struct { + BaseClient +} + +// NewAvailableServiceAliasesClient creates an instance of the AvailableServiceAliasesClient client. +func NewAvailableServiceAliasesClient(subscriptionID string) AvailableServiceAliasesClient { + return NewAvailableServiceAliasesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailableServiceAliasesClientWithBaseURI creates an instance of the AvailableServiceAliasesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewAvailableServiceAliasesClientWithBaseURI(baseURI string, subscriptionID string) AvailableServiceAliasesClient { + return AvailableServiceAliasesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all available service aliases for this subscription in this region. +// Parameters: +// location - the location. +func (client AvailableServiceAliasesClient) List(ctx context.Context, location string) (result AvailableServiceAliasesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesClient.List") + defer func() { + sc := -1 + if result.asar.Response.Response != nil { + sc = result.asar.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.asar.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "List", resp, "Failure sending request") + return + } + + result.asar, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "List", resp, "Failure responding to request") + return + } + if result.asar.hasNextLink() && result.asar.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableServiceAliasesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/availableServiceAliases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableServiceAliasesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AvailableServiceAliasesClient) ListResponder(resp *http.Response) (result AvailableServiceAliasesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableServiceAliasesClient) listNextResults(ctx context.Context, lastResults AvailableServiceAliasesResult) (result AvailableServiceAliasesResult, err error) { + req, err := lastResults.availableServiceAliasesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableServiceAliasesClient) ListComplete(ctx context.Context, location string) (result AvailableServiceAliasesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} + +// ListByResourceGroup gets all available service aliases for this resource group in this region. +// Parameters: +// resourceGroupName - the name of the resource group. +// location - the location. +func (client AvailableServiceAliasesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result AvailableServiceAliasesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.asar.Response.Response != nil { + sc = result.asar.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.asar.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.asar, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.asar.hasNextLink() && result.asar.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client AvailableServiceAliasesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/availableServiceAliases", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client AvailableServiceAliasesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client AvailableServiceAliasesClient) ListByResourceGroupResponder(resp *http.Response) (result AvailableServiceAliasesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client AvailableServiceAliasesClient) listByResourceGroupNextResults(ctx context.Context, lastResults AvailableServiceAliasesResult) (result AvailableServiceAliasesResult, err error) { + req, err := lastResults.availableServiceAliasesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AvailableServiceAliasesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableServiceAliasesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string) (result AvailableServiceAliasesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, location) + return +} diff --git a/services/network/mgmt/2021-08-01/network/azurefirewallfqdntags.go b/services/network/mgmt/2021-08-01/network/azurefirewallfqdntags.go new file mode 100644 index 000000000000..d6bc156d54d6 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/azurefirewallfqdntags.go @@ -0,0 +1,145 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AzureFirewallFqdnTagsClient is the network Client +type AzureFirewallFqdnTagsClient struct { + BaseClient +} + +// NewAzureFirewallFqdnTagsClient creates an instance of the AzureFirewallFqdnTagsClient client. +func NewAzureFirewallFqdnTagsClient(subscriptionID string) AzureFirewallFqdnTagsClient { + return NewAzureFirewallFqdnTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAzureFirewallFqdnTagsClientWithBaseURI creates an instance of the AzureFirewallFqdnTagsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewAzureFirewallFqdnTagsClientWithBaseURI(baseURI string, subscriptionID string) AzureFirewallFqdnTagsClient { + return AzureFirewallFqdnTagsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListAll gets all the Azure Firewall FQDN Tags in a subscription. +func (client AzureFirewallFqdnTagsClient) ListAll(ctx context.Context) (result AzureFirewallFqdnTagListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagsClient.ListAll") + defer func() { + sc := -1 + if result.afftlr.Response.Response != nil { + sc = result.afftlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.afftlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "ListAll", resp, "Failure sending request") + return + } + + result.afftlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.afftlr.hasNextLink() && result.afftlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client AzureFirewallFqdnTagsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewallFqdnTags", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallFqdnTagsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client AzureFirewallFqdnTagsClient) ListAllResponder(resp *http.Response) (result AzureFirewallFqdnTagListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client AzureFirewallFqdnTagsClient) listAllNextResults(ctx context.Context, lastResults AzureFirewallFqdnTagListResult) (result AzureFirewallFqdnTagListResult, err error) { + req, err := lastResults.azureFirewallFqdnTagListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallFqdnTagsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client AzureFirewallFqdnTagsClient) ListAllComplete(ctx context.Context) (result AzureFirewallFqdnTagListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/azurefirewalls.go b/services/network/mgmt/2021-08-01/network/azurefirewalls.go new file mode 100644 index 000000000000..df0196dca0e0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/azurefirewalls.go @@ -0,0 +1,587 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AzureFirewallsClient is the network Client +type AzureFirewallsClient struct { + BaseClient +} + +// NewAzureFirewallsClient creates an instance of the AzureFirewallsClient client. +func NewAzureFirewallsClient(subscriptionID string) AzureFirewallsClient { + return NewAzureFirewallsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAzureFirewallsClientWithBaseURI creates an instance of the AzureFirewallsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAzureFirewallsClientWithBaseURI(baseURI string, subscriptionID string) AzureFirewallsClient { + return AzureFirewallsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Azure Firewall. +// Parameters: +// resourceGroupName - the name of the resource group. +// azureFirewallName - the name of the Azure Firewall. +// parameters - parameters supplied to the create or update Azure Firewall operation. +func (client AzureFirewallsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall) (result AzureFirewallsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: azureFirewallName, + Constraints: []validation.Constraint{{Target: "azureFirewallName", Name: validation.MaxLength, Rule: 56, Chain: nil}, + {Target: "azureFirewallName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.AzureFirewallsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, azureFirewallName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AzureFirewallsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters AzureFirewall) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureFirewallName": autorest.Encode("path", azureFirewallName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) CreateOrUpdateSender(req *http.Request) (future AzureFirewallsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) CreateOrUpdateResponder(resp *http.Response) (result AzureFirewall, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Azure Firewall. +// Parameters: +// resourceGroupName - the name of the resource group. +// azureFirewallName - the name of the Azure Firewall. +func (client AzureFirewallsClient) Delete(ctx context.Context, resourceGroupName string, azureFirewallName string) (result AzureFirewallsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, azureFirewallName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AzureFirewallsClient) DeletePreparer(ctx context.Context, resourceGroupName string, azureFirewallName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureFirewallName": autorest.Encode("path", azureFirewallName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) DeleteSender(req *http.Request) (future AzureFirewallsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Azure Firewall. +// Parameters: +// resourceGroupName - the name of the resource group. +// azureFirewallName - the name of the Azure Firewall. +func (client AzureFirewallsClient) Get(ctx context.Context, resourceGroupName string, azureFirewallName string) (result AzureFirewall, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, azureFirewallName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AzureFirewallsClient) GetPreparer(ctx context.Context, resourceGroupName string, azureFirewallName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureFirewallName": autorest.Encode("path", azureFirewallName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) GetResponder(resp *http.Response) (result AzureFirewall, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Azure Firewalls in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client AzureFirewallsClient) List(ctx context.Context, resourceGroupName string) (result AzureFirewallListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.List") + defer func() { + sc := -1 + if result.aflr.Response.Response != nil { + sc = result.aflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "List", resp, "Failure sending request") + return + } + + result.aflr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "List", resp, "Failure responding to request") + return + } + if result.aflr.hasNextLink() && result.aflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AzureFirewallsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) ListResponder(resp *http.Response) (result AzureFirewallListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AzureFirewallsClient) listNextResults(ctx context.Context, lastResults AzureFirewallListResult) (result AzureFirewallListResult, err error) { + req, err := lastResults.azureFirewallListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AzureFirewallsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AzureFirewallListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the Azure Firewalls in a subscription. +func (client AzureFirewallsClient) ListAll(ctx context.Context) (result AzureFirewallListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.ListAll") + defer func() { + sc := -1 + if result.aflr.Response.Response != nil { + sc = result.aflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.aflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "ListAll", resp, "Failure sending request") + return + } + + result.aflr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.aflr.hasNextLink() && result.aflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client AzureFirewallsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureFirewalls", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) ListAllResponder(resp *http.Response) (result AzureFirewallListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client AzureFirewallsClient) listAllNextResults(ctx context.Context, lastResults AzureFirewallListResult) (result AzureFirewallListResult, err error) { + req, err := lastResults.azureFirewallListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client AzureFirewallsClient) ListAllComplete(ctx context.Context) (result AzureFirewallListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates tags of an Azure Firewall resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// azureFirewallName - the name of the Azure Firewall. +// parameters - parameters supplied to update azure firewall tags. +func (client AzureFirewallsClient) UpdateTags(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject) (result AzureFirewallsUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallsClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, azureFirewallName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client AzureFirewallsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "azureFirewallName": autorest.Encode("path", azureFirewallName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/azureFirewalls/{azureFirewallName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client AzureFirewallsClient) UpdateTagsSender(req *http.Request) (future AzureFirewallsUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client AzureFirewallsClient) UpdateTagsResponder(resp *http.Response) (result AzureFirewall, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/bastionhosts.go b/services/network/mgmt/2021-08-01/network/bastionhosts.go new file mode 100644 index 000000000000..79580ade1c35 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/bastionhosts.go @@ -0,0 +1,591 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BastionHostsClient is the network Client +type BastionHostsClient struct { + BaseClient +} + +// NewBastionHostsClient creates an instance of the BastionHostsClient client. +func NewBastionHostsClient(subscriptionID string) BastionHostsClient { + return NewBastionHostsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBastionHostsClientWithBaseURI creates an instance of the BastionHostsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewBastionHostsClientWithBaseURI(baseURI string, subscriptionID string) BastionHostsClient { + return BastionHostsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Bastion Host. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// parameters - parameters supplied to the create or update Bastion Host operation. +func (client BastionHostsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost) (result BastionHostsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BastionHostPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BastionHostPropertiesFormat.ScaleUnits", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BastionHostPropertiesFormat.ScaleUnits", Name: validation.InclusiveMaximum, Rule: int64(50), Chain: nil}, + {Target: "parameters.BastionHostPropertiesFormat.ScaleUnits", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.BastionHostsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, bastionHostName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BastionHostsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, bastionHostName string, parameters BastionHost) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) CreateOrUpdateSender(req *http.Request) (future BastionHostsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) CreateOrUpdateResponder(resp *http.Response) (result BastionHost, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Bastion Host. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +func (client BastionHostsClient) Delete(ctx context.Context, resourceGroupName string, bastionHostName string) (result BastionHostsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, bastionHostName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BastionHostsClient) DeletePreparer(ctx context.Context, resourceGroupName string, bastionHostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) DeleteSender(req *http.Request) (future BastionHostsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Bastion Host. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +func (client BastionHostsClient) Get(ctx context.Context, resourceGroupName string, bastionHostName string) (result BastionHost, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, bastionHostName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BastionHostsClient) GetPreparer(ctx context.Context, resourceGroupName string, bastionHostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) GetResponder(resp *http.Response) (result BastionHost, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Bastion Hosts in a subscription. +func (client BastionHostsClient) List(ctx context.Context) (result BastionHostListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.List") + defer func() { + sc := -1 + if result.bhlr.Response.Response != nil { + sc = result.bhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "List", resp, "Failure sending request") + return + } + + result.bhlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "List", resp, "Failure responding to request") + return + } + if result.bhlr.hasNextLink() && result.bhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BastionHostsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bastionHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) ListResponder(resp *http.Response) (result BastionHostListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BastionHostsClient) listNextResults(ctx context.Context, lastResults BastionHostListResult) (result BastionHostListResult, err error) { + req, err := lastResults.bastionHostListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BastionHostsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BastionHostsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BastionHostsClient) ListComplete(ctx context.Context) (result BastionHostListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all Bastion Hosts in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client BastionHostsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result BastionHostListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.bhlr.Response.Response != nil { + sc = result.bhlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.bhlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.bhlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.bhlr.hasNextLink() && result.bhlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client BastionHostsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) ListByResourceGroupResponder(resp *http.Response) (result BastionHostListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client BastionHostsClient) listByResourceGroupNextResults(ctx context.Context, lastResults BastionHostListResult) (result BastionHostListResult, err error) { + req, err := lastResults.bastionHostListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BastionHostsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BastionHostsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client BastionHostsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result BastionHostListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates Tags for BastionHost resource +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// parameters - parameters supplied to update BastionHost tags. +func (client BastionHostsClient) UpdateTags(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject) (result BastionHostsUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostsClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, bastionHostName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client BastionHostsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client BastionHostsClient) UpdateTagsSender(req *http.Request) (future BastionHostsUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client BastionHostsClient) UpdateTagsResponder(resp *http.Response) (result BastionHost, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/bgpservicecommunities.go b/services/network/mgmt/2021-08-01/network/bgpservicecommunities.go new file mode 100644 index 000000000000..b4898bf21d2d --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/bgpservicecommunities.go @@ -0,0 +1,145 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// BgpServiceCommunitiesClient is the network Client +type BgpServiceCommunitiesClient struct { + BaseClient +} + +// NewBgpServiceCommunitiesClient creates an instance of the BgpServiceCommunitiesClient client. +func NewBgpServiceCommunitiesClient(subscriptionID string) BgpServiceCommunitiesClient { + return NewBgpServiceCommunitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBgpServiceCommunitiesClientWithBaseURI creates an instance of the BgpServiceCommunitiesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID string) BgpServiceCommunitiesClient { + return BgpServiceCommunitiesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all the available bgp service communities. +func (client BgpServiceCommunitiesClient) List(ctx context.Context) (result BgpServiceCommunityListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunitiesClient.List") + defer func() { + sc := -1 + if result.bsclr.Response.Response != nil { + sc = result.bsclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.bsclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request") + return + } + + result.bsclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request") + return + } + if result.bsclr.hasNextLink() && result.bsclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client BgpServiceCommunitiesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client BgpServiceCommunitiesClient) ListResponder(resp *http.Response) (result BgpServiceCommunityListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client BgpServiceCommunitiesClient) listNextResults(ctx context.Context, lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) { + req, err := lastResults.bgpServiceCommunityListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client BgpServiceCommunitiesClient) ListComplete(ctx context.Context) (result BgpServiceCommunityListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunitiesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/client.go b/services/network/mgmt/2021-08-01/network/client.go new file mode 100644 index 000000000000..43ef46f2f709 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/client.go @@ -0,0 +1,847 @@ +// Package network implements the Azure ARM Network service API version . +// +// Network Client +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Network + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Network. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckDNSNameAvailability checks whether a domain name in the cloudapp.azure.com zone is available for use. +// Parameters: +// location - the location of the domain name. +// domainNameLabel - the domain name to be verified. It must conform to the following regular expression: +// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckDNSNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. +func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "domainNameLabel": autorest.Encode("query", domainNameLabel), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteBastionShareableLink deletes the Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) DeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result DeleteBastionShareableLinkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DeleteBastionShareableLink") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", nil, "Failure preparing request") + return + } + + result, err = client.DeleteBastionShareableLinkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DeleteBastionShareableLink", result.Response(), "Failure sending request") + return + } + + return +} + +// DeleteBastionShareableLinkPreparer prepares the DeleteBastionShareableLink request. +func (client BaseClient) DeleteBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/bastionHosts/{bastionHostName}/deleteShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteBastionShareableLinkSender sends the DeleteBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DeleteBastionShareableLinkSender(req *http.Request) (future DeleteBastionShareableLinkFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteBastionShareableLinkResponder handles the response to the DeleteBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) DeleteBastionShareableLinkResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisconnectActiveSessions returns the list of currently active sessions on the Bastion. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// sessionIds - the list of sessionids to disconnect. +func (client BaseClient) DisconnectActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") + defer func() { + sc := -1 + if result.bsdr.Response.Response != nil { + sc = result.bsdr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.disconnectActiveSessionsNextResults + req, err := client.DisconnectActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName, sessionIds) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", nil, "Failure preparing request") + return + } + + resp, err := client.DisconnectActiveSessionsSender(req) + if err != nil { + result.bsdr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure sending request") + return + } + + result.bsdr, err = client.DisconnectActiveSessionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "DisconnectActiveSessions", resp, "Failure responding to request") + return + } + if result.bsdr.hasNextLink() && result.bsdr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// DisconnectActiveSessionsPreparer prepares the DisconnectActiveSessions request. +func (client BaseClient) DisconnectActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/bastionHosts/{bastionHostName}/disconnectActiveSessions", pathParameters), + autorest.WithJSON(sessionIds), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisconnectActiveSessionsSender sends the DisconnectActiveSessions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) DisconnectActiveSessionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DisconnectActiveSessionsResponder handles the response to the DisconnectActiveSessions request. The method always +// closes the http.Response Body. +func (client BaseClient) DisconnectActiveSessionsResponder(resp *http.Response) (result BastionSessionDeleteResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// disconnectActiveSessionsNextResults retrieves the next set of results, if any. +func (client BaseClient) disconnectActiveSessionsNextResults(ctx context.Context, lastResults BastionSessionDeleteResult) (result BastionSessionDeleteResult, err error) { + req, err := lastResults.bastionSessionDeleteResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.DisconnectActiveSessionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure sending next results request") + } + result, err = client.DisconnectActiveSessionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "disconnectActiveSessionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// DisconnectActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) DisconnectActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds SessionIds) (result BastionSessionDeleteResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.DisconnectActiveSessions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.DisconnectActiveSessions(ctx, resourceGroupName, bastionHostName, sessionIds) + return +} + +// Generatevirtualwanvpnserverconfigurationvpnprofile generates a unique VPN profile for P2S clients for VirtualWan and +// associated VpnServerConfiguration combination in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN whose associated VpnServerConfigurations is needed. +// vpnClientParams - parameters supplied to the generate VirtualWan VPN profile generation operation. +func (client BaseClient) Generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (result GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.Generatevirtualwanvpnserverconfigurationvpnprofile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx, resourceGroupName, virtualWANName, vpnClientParams) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", nil, "Failure preparing request") + return + } + + result, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "Generatevirtualwanvpnserverconfigurationvpnprofile", result.Response(), "Failure sending request") + return + } + + return +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer prepares the Generatevirtualwanvpnserverconfigurationvpnprofile request. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofilePreparer(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams VirtualWanVpnProfileParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-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/virtualWans/{virtualWANName}/GenerateVpnProfile", pathParameters), + autorest.WithJSON(vpnClientParams), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileSender sends the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileSender(req *http.Request) (future GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileResponder handles the response to the Generatevirtualwanvpnserverconfigurationvpnprofile request. The method always +// closes the http.Response Body. +func (client BaseClient) GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(resp *http.Response) (result VpnProfileResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetActiveSessions returns the list of currently active sessions on the Bastion. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +func (client BaseClient) GetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetActiveSessionsPreparer(ctx, resourceGroupName, bastionHostName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", nil, "Failure preparing request") + return + } + + result, err = client.GetActiveSessionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetActiveSessions", result.Response(), "Failure sending request") + return + } + + return +} + +// GetActiveSessionsPreparer prepares the GetActiveSessions request. +func (client BaseClient) GetActiveSessionsPreparer(ctx context.Context, resourceGroupName string, bastionHostName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/bastionHosts/{bastionHostName}/getActiveSessions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetActiveSessionsSender sends the GetActiveSessions request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetActiveSessionsSender(req *http.Request) (future GetActiveSessionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetActiveSessionsResponder handles the response to the GetActiveSessions request. The method always +// closes the http.Response Body. +func (client BaseClient) GetActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResultPage, err error) { + result.baslr, err = client.getActiveSessionsResponder(resp) + result.fn = client.getActiveSessionsNextResults + return +} + +func (client BaseClient) getActiveSessionsResponder(resp *http.Response) (result BastionActiveSessionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getActiveSessionsNextResults retrieves the next set of results, if any. +func (client BaseClient) getActiveSessionsNextResults(ctx context.Context, lastResults BastionActiveSessionListResult) (result BastionActiveSessionListResult, err error) { + req, err := lastResults.bastionActiveSessionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getActiveSessionsNextResults", resp, "Failure sending next results request") + } + return client.getActiveSessionsResponder(resp) +} + +// GetActiveSessionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string) (result GetActiveSessionsAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetActiveSessions") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future GetActiveSessionsFuture + future, err = client.GetActiveSessions(ctx, resourceGroupName, bastionHostName) + result.FutureAPI = future.FutureAPI + return +} + +// GetBastionShareableLink return the Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) GetBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") + defer func() { + sc := -1 + if result.bsllr.Response.Response != nil { + sc = result.bsllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getBastionShareableLinkNextResults + req, err := client.GetBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", nil, "Failure preparing request") + return + } + + resp, err := client.GetBastionShareableLinkSender(req) + if err != nil { + result.bsllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure sending request") + return + } + + result.bsllr, err = client.GetBastionShareableLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "GetBastionShareableLink", resp, "Failure responding to request") + return + } + if result.bsllr.hasNextLink() && result.bsllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetBastionShareableLinkPreparer prepares the GetBastionShareableLink request. +func (client BaseClient) GetBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/bastionHosts/{bastionHostName}/getShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBastionShareableLinkSender sends the GetBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetBastionShareableLinkSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetBastionShareableLinkResponder handles the response to the GetBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) GetBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getBastionShareableLinkNextResults retrieves the next set of results, if any. +func (client BaseClient) getBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { + req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetBastionShareableLinkSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure sending next results request") + } + result, err = client.GetBastionShareableLinkResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "getBastionShareableLinkNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) GetBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result BastionShareableLinkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetBastionShareableLink") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.GetBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) + return +} + +// PutBastionShareableLink creates a Bastion Shareable Links for all the VMs specified in the request. +// Parameters: +// resourceGroupName - the name of the resource group. +// bastionHostName - the name of the Bastion Host. +// bslRequest - post request for all the Bastion Shareable Link endpoints. +func (client BaseClient) PutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PutBastionShareableLinkPreparer(ctx, resourceGroupName, bastionHostName, bslRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", nil, "Failure preparing request") + return + } + + result, err = client.PutBastionShareableLinkSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "PutBastionShareableLink", result.Response(), "Failure sending request") + return + } + + return +} + +// PutBastionShareableLinkPreparer prepares the PutBastionShareableLink request. +func (client BaseClient) PutBastionShareableLinkPreparer(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "bastionHostName": autorest.Encode("path", bastionHostName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/bastionHosts/{bastionHostName}/createShareableLinks", pathParameters), + autorest.WithJSON(bslRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutBastionShareableLinkSender sends the PutBastionShareableLink request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) PutBastionShareableLinkSender(req *http.Request) (future PutBastionShareableLinkFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PutBastionShareableLinkResponder handles the response to the PutBastionShareableLink request. The method always +// closes the http.Response Body. +func (client BaseClient) PutBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResultPage, err error) { + result.bsllr, err = client.putBastionShareableLinkResponder(resp) + result.fn = client.putBastionShareableLinkNextResults + return +} + +func (client BaseClient) putBastionShareableLinkResponder(resp *http.Response) (result BastionShareableLinkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// putBastionShareableLinkNextResults retrieves the next set of results, if any. +func (client BaseClient) putBastionShareableLinkNextResults(ctx context.Context, lastResults BastionShareableLinkListResult) (result BastionShareableLinkListResult, err error) { + req, err := lastResults.bastionShareableLinkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + var resp *http.Response + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.BaseClient", "putBastionShareableLinkNextResults", resp, "Failure sending next results request") + } + return client.putBastionShareableLinkResponder(resp) +} + +// PutBastionShareableLinkComplete enumerates all values, automatically crossing page boundaries as required. +func (client BaseClient) PutBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest BastionShareableLinkListRequest) (result PutBastionShareableLinkAllFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.PutBastionShareableLink") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + var future PutBastionShareableLinkFuture + future, err = client.PutBastionShareableLink(ctx, resourceGroupName, bastionHostName, bslRequest) + result.FutureAPI = future.FutureAPI + return +} + +// SupportedSecurityProviders gives the supported security providers for the virtual wan. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN for which supported security providers are needed. +func (client BaseClient) SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string) (result VirtualWanSecurityProviders, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.SupportedSecurityProviders") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SupportedSecurityProvidersPreparer(ctx, resourceGroupName, virtualWANName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", nil, "Failure preparing request") + return + } + + resp, err := client.SupportedSecurityProvidersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure sending request") + return + } + + result, err = client.SupportedSecurityProvidersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "SupportedSecurityProviders", resp, "Failure responding to request") + return + } + + return +} + +// SupportedSecurityProvidersPreparer prepares the SupportedSecurityProviders request. +func (client BaseClient) SupportedSecurityProvidersPreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/supportedSecurityProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SupportedSecurityProvidersSender sends the SupportedSecurityProviders request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) SupportedSecurityProvidersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SupportedSecurityProvidersResponder handles the response to the SupportedSecurityProviders request. The method always +// closes the http.Response Body. +func (client BaseClient) SupportedSecurityProvidersResponder(resp *http.Response) (result VirtualWanSecurityProviders, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/configurationpolicygroups.go b/services/network/mgmt/2021-08-01/network/configurationpolicygroups.go new file mode 100644 index 000000000000..ee4daf6dba50 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/configurationpolicygroups.go @@ -0,0 +1,396 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ConfigurationPolicyGroupsClient is the network Client +type ConfigurationPolicyGroupsClient struct { + BaseClient +} + +// NewConfigurationPolicyGroupsClient creates an instance of the ConfigurationPolicyGroupsClient client. +func NewConfigurationPolicyGroupsClient(subscriptionID string) ConfigurationPolicyGroupsClient { + return NewConfigurationPolicyGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationPolicyGroupsClientWithBaseURI creates an instance of the ConfigurationPolicyGroupsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewConfigurationPolicyGroupsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationPolicyGroupsClient { + return ConfigurationPolicyGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a ConfigurationPolicyGroup if it doesn't exist else updates the existing one. +// Parameters: +// resourceGroupName - the resource group name of the ConfigurationPolicyGroup. +// vpnServerConfigurationName - the name of the VpnServerConfiguration. +// configurationPolicyGroupName - the name of the ConfigurationPolicyGroup. +// vpnServerConfigurationPolicyGroupParameters - parameters supplied to create or update a +// VpnServerConfiguration PolicyGroup. +func (client ConfigurationPolicyGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VpnServerConfigurationPolicyGroup) (result ConfigurationPolicyGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationPolicyGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName, vpnServerConfigurationPolicyGroupParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationPolicyGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters VpnServerConfigurationPolicyGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationPolicyGroupName": autorest.Encode("path", configurationPolicyGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vpnServerConfigurationPolicyGroupParameters.Etag = nil + vpnServerConfigurationPolicyGroupParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", pathParameters), + autorest.WithJSON(vpnServerConfigurationPolicyGroupParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationPolicyGroupsClient) CreateOrUpdateSender(req *http.Request) (future ConfigurationPolicyGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConfigurationPolicyGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result VpnServerConfigurationPolicyGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a ConfigurationPolicyGroup. +// Parameters: +// resourceGroupName - the resource group name of the ConfigurationPolicyGroup. +// vpnServerConfigurationName - the name of the VpnServerConfiguration. +// configurationPolicyGroupName - the name of the ConfigurationPolicyGroup. +func (client ConfigurationPolicyGroupsClient) Delete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (result ConfigurationPolicyGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationPolicyGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConfigurationPolicyGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationPolicyGroupName": autorest.Encode("path", configurationPolicyGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationPolicyGroupsClient) DeleteSender(req *http.Request) (future ConfigurationPolicyGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConfigurationPolicyGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a ConfigurationPolicyGroup. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration. +// configurationPolicyGroupName - the name of the ConfigurationPolicyGroup being retrieved. +func (client ConfigurationPolicyGroupsClient) Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (result VpnServerConfigurationPolicyGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationPolicyGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vpnServerConfigurationName, configurationPolicyGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationPolicyGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationPolicyGroupName": autorest.Encode("path", configurationPolicyGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups/{configurationPolicyGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationPolicyGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConfigurationPolicyGroupsClient) GetResponder(resp *http.Response) (result VpnServerConfigurationPolicyGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVpnServerConfiguration lists all the configurationPolicyGroups in a resource group for a +// vpnServerConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration. +func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfiguration(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result ListVpnServerConfigurationPolicyGroupsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationPolicyGroupsClient.ListByVpnServerConfiguration") + defer func() { + sc := -1 + if result.lvscpgr.Response.Response != nil { + sc = result.lvscpgr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVpnServerConfigurationNextResults + req, err := client.ListByVpnServerConfigurationPreparer(ctx, resourceGroupName, vpnServerConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "ListByVpnServerConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVpnServerConfigurationSender(req) + if err != nil { + result.lvscpgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "ListByVpnServerConfiguration", resp, "Failure sending request") + return + } + + result.lvscpgr, err = client.ListByVpnServerConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "ListByVpnServerConfiguration", resp, "Failure responding to request") + return + } + if result.lvscpgr.hasNextLink() && result.lvscpgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVpnServerConfigurationPreparer prepares the ListByVpnServerConfiguration request. +func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfigurationPreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}/configurationPolicyGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVpnServerConfigurationSender sends the ListByVpnServerConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVpnServerConfigurationResponder handles the response to the ListByVpnServerConfiguration request. The method always +// closes the http.Response Body. +func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfigurationResponder(resp *http.Response) (result ListVpnServerConfigurationPolicyGroupsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVpnServerConfigurationNextResults retrieves the next set of results, if any. +func (client ConfigurationPolicyGroupsClient) listByVpnServerConfigurationNextResults(ctx context.Context, lastResults ListVpnServerConfigurationPolicyGroupsResult) (result ListVpnServerConfigurationPolicyGroupsResult, err error) { + req, err := lastResults.listVpnServerConfigurationPolicyGroupsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "listByVpnServerConfigurationNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVpnServerConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "listByVpnServerConfigurationNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVpnServerConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsClient", "listByVpnServerConfigurationNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVpnServerConfigurationComplete enumerates all values, automatically crossing page boundaries as required. +func (client ConfigurationPolicyGroupsClient) ListByVpnServerConfigurationComplete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result ListVpnServerConfigurationPolicyGroupsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationPolicyGroupsClient.ListByVpnServerConfiguration") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVpnServerConfiguration(ctx, resourceGroupName, vpnServerConfigurationName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/connectionmonitors.go b/services/network/mgmt/2021-08-01/network/connectionmonitors.go new file mode 100644 index 000000000000..9c7ea471a494 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/connectionmonitors.go @@ -0,0 +1,701 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ConnectionMonitorsClient is the network Client +type ConnectionMonitorsClient struct { + BaseClient +} + +// NewConnectionMonitorsClient creates an instance of the ConnectionMonitorsClient client. +func NewConnectionMonitorsClient(subscriptionID string) ConnectionMonitorsClient { + return NewConnectionMonitorsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConnectionMonitorsClientWithBaseURI creates an instance of the ConnectionMonitorsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewConnectionMonitorsClientWithBaseURI(baseURI string, subscriptionID string) ConnectionMonitorsClient { + return ConnectionMonitorsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +// parameters - parameters that define the operation to create a connection monitor. +// migrate - value indicating whether connection monitor V1 should be migrated to V2 format. +func (client ConnectionMonitorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, migrate string) (result ConnectionMonitorsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.ConnectionMonitorParameters.Source.Port", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Source.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "parameters.ConnectionMonitorParameters.Source.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "parameters.ConnectionMonitorParameters.Destination", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Destination.Port", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.Destination.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "parameters.ConnectionMonitorParameters.Destination.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "parameters.ConnectionMonitorParameters.MonitoringIntervalInSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ConnectionMonitorParameters.MonitoringIntervalInSeconds", Name: validation.InclusiveMaximum, Rule: int64(1800), Chain: nil}, + {Target: "parameters.ConnectionMonitorParameters.MonitoringIntervalInSeconds", Name: validation.InclusiveMinimum, Rule: int64(30), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ConnectionMonitorsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters, migrate) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConnectionMonitorsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters ConnectionMonitor, migrate string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(migrate) > 0 { + queryParameters["migrate"] = autorest.Encode("query", migrate) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) CreateOrUpdateSender(req *http.Request) (future ConnectionMonitorsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) CreateOrUpdateResponder(resp *http.Response) (result ConnectionMonitorResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConnectionMonitorsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) DeleteSender(req *http.Request) (future ConnectionMonitorsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a connection monitor by name. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConnectionMonitorsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) GetResponder(resp *http.Response) (result ConnectionMonitorResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all connection monitors for the specified Network Watcher. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +func (client ConnectionMonitorsClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result ConnectionMonitorListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ConnectionMonitorsClient) ListPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) ListResponder(resp *http.Response) (result ConnectionMonitorListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Query query a snapshot of the most recent connection states. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name given to the connection monitor. +func (client ConnectionMonitorsClient) Query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsQueryFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.Query") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.QueryPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", nil, "Failure preparing request") + return + } + + result, err = client.QuerySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Query", result.Response(), "Failure sending request") + return + } + + return +} + +// QueryPreparer prepares the Query request. +func (client ConnectionMonitorsClient) QueryPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// QuerySender sends the Query request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) QuerySender(req *http.Request) (future ConnectionMonitorsQueryFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// QueryResponder handles the response to the Query request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) QueryResponder(resp *http.Response) (result ConnectionMonitorQueryResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start starts the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ConnectionMonitorsClient) StartPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) StartSender(req *http.Request) (future ConnectionMonitorsStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop stops the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +// connectionMonitorName - the name of the connection monitor. +func (client ConnectionMonitorsClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result ConnectionMonitorsStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ConnectionMonitorsClient) StopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) StopSender(req *http.Request) (future ConnectionMonitorsStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateTags update tags of the specified connection monitor. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// connectionMonitorName - the name of the connection monitor. +// parameters - parameters supplied to update connection monitor tags. +func (client ConnectionMonitorsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters TagsObject) (result ConnectionMonitorResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConnectionMonitorsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, connectionMonitorName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ConnectionMonitorsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionMonitorName": autorest.Encode("path", connectionMonitorName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ConnectionMonitorsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ConnectionMonitorsClient) UpdateTagsResponder(resp *http.Response) (result ConnectionMonitorResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/customipprefixes.go b/services/network/mgmt/2021-08-01/network/customipprefixes.go new file mode 100644 index 000000000000..4cccfbc1611b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/customipprefixes.go @@ -0,0 +1,581 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CustomIPPrefixesClient is the network Client +type CustomIPPrefixesClient struct { + BaseClient +} + +// NewCustomIPPrefixesClient creates an instance of the CustomIPPrefixesClient client. +func NewCustomIPPrefixesClient(subscriptionID string) CustomIPPrefixesClient { + return NewCustomIPPrefixesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewCustomIPPrefixesClientWithBaseURI creates an instance of the CustomIPPrefixesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewCustomIPPrefixesClientWithBaseURI(baseURI string, subscriptionID string) CustomIPPrefixesClient { + return CustomIPPrefixesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a custom IP prefix. +// Parameters: +// resourceGroupName - the name of the resource group. +// customIPPrefixName - the name of the custom IP prefix. +// parameters - parameters supplied to the create or update custom IP prefix operation. +func (client CustomIPPrefixesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix) (result CustomIPPrefixesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, customIPPrefixName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client CustomIPPrefixesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters CustomIPPrefix) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customIpPrefixName": autorest.Encode("path", customIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) CreateOrUpdateSender(req *http.Request) (future CustomIPPrefixesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) CreateOrUpdateResponder(resp *http.Response) (result CustomIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified custom IP prefix. +// Parameters: +// resourceGroupName - the name of the resource group. +// customIPPrefixName - the name of the CustomIpPrefix. +func (client CustomIPPrefixesClient) Delete(ctx context.Context, resourceGroupName string, customIPPrefixName string) (result CustomIPPrefixesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, customIPPrefixName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client CustomIPPrefixesClient) DeletePreparer(ctx context.Context, resourceGroupName string, customIPPrefixName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customIpPrefixName": autorest.Encode("path", customIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) DeleteSender(req *http.Request) (future CustomIPPrefixesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified custom IP prefix in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// customIPPrefixName - the name of the custom IP prefix. +// expand - expands referenced resources. +func (client CustomIPPrefixesClient) Get(ctx context.Context, resourceGroupName string, customIPPrefixName string, expand string) (result CustomIPPrefix, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, customIPPrefixName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client CustomIPPrefixesClient) GetPreparer(ctx context.Context, resourceGroupName string, customIPPrefixName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customIpPrefixName": autorest.Encode("path", customIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) GetResponder(resp *http.Response) (result CustomIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all custom IP prefixes in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client CustomIPPrefixesClient) List(ctx context.Context, resourceGroupName string) (result CustomIPPrefixListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.List") + defer func() { + sc := -1 + if result.ciplr.Response.Response != nil { + sc = result.ciplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ciplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "List", resp, "Failure sending request") + return + } + + result.ciplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "List", resp, "Failure responding to request") + return + } + if result.ciplr.hasNextLink() && result.ciplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client CustomIPPrefixesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) ListResponder(resp *http.Response) (result CustomIPPrefixListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client CustomIPPrefixesClient) listNextResults(ctx context.Context, lastResults CustomIPPrefixListResult) (result CustomIPPrefixListResult, err error) { + req, err := lastResults.customIPPrefixListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomIPPrefixesClient) ListComplete(ctx context.Context, resourceGroupName string) (result CustomIPPrefixListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the custom IP prefixes in a subscription. +func (client CustomIPPrefixesClient) ListAll(ctx context.Context) (result CustomIPPrefixListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.ListAll") + defer func() { + sc := -1 + if result.ciplr.Response.Response != nil { + sc = result.ciplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.ciplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "ListAll", resp, "Failure sending request") + return + } + + result.ciplr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.ciplr.hasNextLink() && result.ciplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client CustomIPPrefixesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/customIpPrefixes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) ListAllResponder(resp *http.Response) (result CustomIPPrefixListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client CustomIPPrefixesClient) listAllNextResults(ctx context.Context, lastResults CustomIPPrefixListResult) (result CustomIPPrefixListResult, err error) { + req, err := lastResults.customIPPrefixListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client CustomIPPrefixesClient) ListAllComplete(ctx context.Context) (result CustomIPPrefixListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates custom IP prefix tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// customIPPrefixName - the name of the custom IP prefix. +// parameters - parameters supplied to update custom IP prefix tags. +func (client CustomIPPrefixesClient) UpdateTags(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters TagsObject) (result CustomIPPrefix, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, customIPPrefixName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client CustomIPPrefixesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "customIpPrefixName": autorest.Encode("path", customIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/customIpPrefixes/{customIpPrefixName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client CustomIPPrefixesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client CustomIPPrefixesClient) UpdateTagsResponder(resp *http.Response) (result CustomIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/ddoscustompolicies.go b/services/network/mgmt/2021-08-01/network/ddoscustompolicies.go new file mode 100644 index 000000000000..57341307e42d --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/ddoscustompolicies.go @@ -0,0 +1,348 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DdosCustomPoliciesClient is the network Client +type DdosCustomPoliciesClient struct { + BaseClient +} + +// NewDdosCustomPoliciesClient creates an instance of the DdosCustomPoliciesClient client. +func NewDdosCustomPoliciesClient(subscriptionID string) DdosCustomPoliciesClient { + return NewDdosCustomPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDdosCustomPoliciesClientWithBaseURI creates an instance of the DdosCustomPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewDdosCustomPoliciesClientWithBaseURI(baseURI string, subscriptionID string) DdosCustomPoliciesClient { + return DdosCustomPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DDoS custom policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosCustomPolicyName - the name of the DDoS custom policy. +// parameters - parameters supplied to the create or update operation. +func (client DdosCustomPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy) (result DdosCustomPoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosCustomPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ddosCustomPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DdosCustomPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters DdosCustomPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosCustomPolicyName": autorest.Encode("path", ddosCustomPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DdosCustomPoliciesClient) CreateOrUpdateSender(req *http.Request) (future DdosCustomPoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DdosCustomPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result DdosCustomPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified DDoS custom policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosCustomPolicyName - the name of the DDoS custom policy. +func (client DdosCustomPoliciesClient) Delete(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (result DdosCustomPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosCustomPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ddosCustomPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DdosCustomPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosCustomPolicyName": autorest.Encode("path", ddosCustomPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DdosCustomPoliciesClient) DeleteSender(req *http.Request) (future DdosCustomPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DdosCustomPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified DDoS custom policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosCustomPolicyName - the name of the DDoS custom policy. +func (client DdosCustomPoliciesClient) Get(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (result DdosCustomPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosCustomPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, ddosCustomPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DdosCustomPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosCustomPolicyName": autorest.Encode("path", ddosCustomPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DdosCustomPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DdosCustomPoliciesClient) GetResponder(resp *http.Response) (result DdosCustomPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags update a DDoS custom policy tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosCustomPolicyName - the name of the DDoS custom policy. +// parameters - parameters supplied to update DDoS custom policy resource tags. +func (client DdosCustomPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters TagsObject) (result DdosCustomPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosCustomPoliciesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, ddosCustomPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client DdosCustomPoliciesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosCustomPolicyName": autorest.Encode("path", ddosCustomPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosCustomPolicies/{ddosCustomPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client DdosCustomPoliciesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client DdosCustomPoliciesClient) UpdateTagsResponder(resp *http.Response) (result DdosCustomPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/ddosprotectionplans.go b/services/network/mgmt/2021-08-01/network/ddosprotectionplans.go new file mode 100644 index 000000000000..84dd6888cf26 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/ddosprotectionplans.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DdosProtectionPlansClient is the network Client +type DdosProtectionPlansClient struct { + BaseClient +} + +// NewDdosProtectionPlansClient creates an instance of the DdosProtectionPlansClient client. +func NewDdosProtectionPlansClient(subscriptionID string) DdosProtectionPlansClient { + return NewDdosProtectionPlansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDdosProtectionPlansClientWithBaseURI creates an instance of the DdosProtectionPlansClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewDdosProtectionPlansClientWithBaseURI(baseURI string, subscriptionID string) DdosProtectionPlansClient { + return DdosProtectionPlansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +// parameters - parameters supplied to the create or update operation. +func (client DdosProtectionPlansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan) (result DdosProtectionPlansCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, ddosProtectionPlanName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DdosProtectionPlansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters DdosProtectionPlan) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) CreateOrUpdateSender(req *http.Request) (future DdosProtectionPlansCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) CreateOrUpdateResponder(resp *http.Response) (result DdosProtectionPlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +func (client DdosProtectionPlansClient) Delete(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result DdosProtectionPlansDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, ddosProtectionPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DdosProtectionPlansClient) DeletePreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) DeleteSender(req *http.Request) (future DdosProtectionPlansDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified DDoS protection plan. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +func (client DdosProtectionPlansClient) Get(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result DdosProtectionPlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, ddosProtectionPlanName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DdosProtectionPlansClient) GetPreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) GetResponder(resp *http.Response) (result DdosProtectionPlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all DDoS protection plans in a subscription. +func (client DdosProtectionPlansClient) List(ctx context.Context) (result DdosProtectionPlanListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.List") + defer func() { + sc := -1 + if result.dpplr.Response.Response != nil { + sc = result.dpplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dpplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", resp, "Failure sending request") + return + } + + result.dpplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "List", resp, "Failure responding to request") + return + } + if result.dpplr.hasNextLink() && result.dpplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DdosProtectionPlansClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) ListResponder(resp *http.Response) (result DdosProtectionPlanListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DdosProtectionPlansClient) listNextResults(ctx context.Context, lastResults DdosProtectionPlanListResult) (result DdosProtectionPlanListResult, err error) { + req, err := lastResults.ddosProtectionPlanListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DdosProtectionPlansClient) ListComplete(ctx context.Context) (result DdosProtectionPlanListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all the DDoS protection plans in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client DdosProtectionPlansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DdosProtectionPlanListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dpplr.Response.Response != nil { + sc = result.dpplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dpplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dpplr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dpplr.hasNextLink() && result.dpplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DdosProtectionPlansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) ListByResourceGroupResponder(resp *http.Response) (result DdosProtectionPlanListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DdosProtectionPlansClient) listByResourceGroupNextResults(ctx context.Context, lastResults DdosProtectionPlanListResult) (result DdosProtectionPlanListResult, err error) { + req, err := lastResults.ddosProtectionPlanListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DdosProtectionPlansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DdosProtectionPlanListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags update a DDoS protection plan tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// ddosProtectionPlanName - the name of the DDoS protection plan. +// parameters - parameters supplied to the update DDoS protection plan resource tags. +func (client DdosProtectionPlansClient) UpdateTags(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters TagsObject) (result DdosProtectionPlan, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlansClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, ddosProtectionPlanName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client DdosProtectionPlansClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ddosProtectionPlanName": autorest.Encode("path", ddosProtectionPlanName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client DdosProtectionPlansClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client DdosProtectionPlansClient) UpdateTagsResponder(resp *http.Response) (result DdosProtectionPlan, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/defaultsecurityrules.go b/services/network/mgmt/2021-08-01/network/defaultsecurityrules.go new file mode 100644 index 000000000000..43a559531ba5 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/defaultsecurityrules.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DefaultSecurityRulesClient is the network Client +type DefaultSecurityRulesClient struct { + BaseClient +} + +// NewDefaultSecurityRulesClient creates an instance of the DefaultSecurityRulesClient client. +func NewDefaultSecurityRulesClient(subscriptionID string) DefaultSecurityRulesClient { + return NewDefaultSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDefaultSecurityRulesClientWithBaseURI creates an instance of the DefaultSecurityRulesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) DefaultSecurityRulesClient { + return DefaultSecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified default network security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// defaultSecurityRuleName - the name of the default security rule. +func (client DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DefaultSecurityRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DefaultSecurityRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "defaultSecurityRuleName": autorest.Encode("path", defaultSecurityRuleName), + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DefaultSecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DefaultSecurityRulesClient) GetResponder(resp *http.Response) (result SecurityRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all default security rules in a network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DefaultSecurityRulesClient.List") + defer func() { + sc := -1 + if result.srlr.Response.Response != nil { + sc = result.srlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure sending request") + return + } + + result.srlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure responding to request") + return + } + if result.srlr.hasNextLink() && result.srlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DefaultSecurityRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DefaultSecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DefaultSecurityRulesClient) ListResponder(resp *http.Response) (result SecurityRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DefaultSecurityRulesClient) listNextResults(ctx context.Context, lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { + req, err := lastResults.securityRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DefaultSecurityRulesClient) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DefaultSecurityRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkSecurityGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/dscpconfiguration.go b/services/network/mgmt/2021-08-01/network/dscpconfiguration.go new file mode 100644 index 000000000000..1721a2d088f0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/dscpconfiguration.go @@ -0,0 +1,498 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DscpConfigurationClient is the network Client +type DscpConfigurationClient struct { + BaseClient +} + +// NewDscpConfigurationClient creates an instance of the DscpConfigurationClient client. +func NewDscpConfigurationClient(subscriptionID string) DscpConfigurationClient { + return NewDscpConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDscpConfigurationClientWithBaseURI creates an instance of the DscpConfigurationClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewDscpConfigurationClientWithBaseURI(baseURI string, subscriptionID string) DscpConfigurationClient { + return DscpConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a DSCP Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// dscpConfigurationName - the name of the resource. +// parameters - parameters supplied to the create or update dscp configuration operation. +func (client DscpConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration) (result DscpConfigurationCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, dscpConfigurationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DscpConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters DscpConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dscpConfigurationName": autorest.Encode("path", dscpConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DscpConfigurationClient) CreateOrUpdateSender(req *http.Request) (future DscpConfigurationCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DscpConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result DscpConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a DSCP Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// dscpConfigurationName - the name of the resource. +func (client DscpConfigurationClient) Delete(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (result DscpConfigurationDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, dscpConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DscpConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dscpConfigurationName": autorest.Encode("path", dscpConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DscpConfigurationClient) DeleteSender(req *http.Request) (future DscpConfigurationDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DscpConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a DSCP Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// dscpConfigurationName - the name of the resource. +func (client DscpConfigurationClient) Get(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (result DscpConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, dscpConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DscpConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dscpConfigurationName": autorest.Encode("path", dscpConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations/{dscpConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DscpConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DscpConfigurationClient) GetResponder(resp *http.Response) (result DscpConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a DSCP Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client DscpConfigurationClient) List(ctx context.Context, resourceGroupName string) (result DscpConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.List") + defer func() { + sc := -1 + if result.dclr.Response.Response != nil { + sc = result.dclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "List", resp, "Failure sending request") + return + } + + result.dclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "List", resp, "Failure responding to request") + return + } + if result.dclr.hasNextLink() && result.dclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DscpConfigurationClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dscpConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DscpConfigurationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DscpConfigurationClient) ListResponder(resp *http.Response) (result DscpConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DscpConfigurationClient) listNextResults(ctx context.Context, lastResults DscpConfigurationListResult) (result DscpConfigurationListResult, err error) { + req, err := lastResults.dscpConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DscpConfigurationClient) ListComplete(ctx context.Context, resourceGroupName string) (result DscpConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all dscp configurations in a subscription. +func (client DscpConfigurationClient) ListAll(ctx context.Context) (result DscpConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.ListAll") + defer func() { + sc := -1 + if result.dclr.Response.Response != nil { + sc = result.dclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.dclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "ListAll", resp, "Failure sending request") + return + } + + result.dclr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "ListAll", resp, "Failure responding to request") + return + } + if result.dclr.hasNextLink() && result.dclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client DscpConfigurationClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/dscpConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client DscpConfigurationClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client DscpConfigurationClient) ListAllResponder(resp *http.Response) (result DscpConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client DscpConfigurationClient) listAllNextResults(ctx context.Context, lastResults DscpConfigurationListResult) (result DscpConfigurationListResult, err error) { + req, err := lastResults.dscpConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client DscpConfigurationClient) ListAllComplete(ctx context.Context) (result DscpConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/enums.go b/services/network/mgmt/2021-08-01/network/enums.go new file mode 100644 index 000000000000..5c9c1b81969e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/enums.go @@ -0,0 +1,3119 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Access enumerates the values for access. +type Access string + +const ( + // AccessAllow ... + AccessAllow Access = "Allow" + // AccessDeny ... + AccessDeny Access = "Deny" +) + +// PossibleAccessValues returns an array of possible values for the Access const type. +func PossibleAccessValues() []Access { + return []Access{AccessAllow, AccessDeny} +} + +// ApplicationGatewayBackendHealthServerHealth enumerates the values for application gateway backend health +// server health. +type ApplicationGatewayBackendHealthServerHealth string + +const ( + // ApplicationGatewayBackendHealthServerHealthDown ... + ApplicationGatewayBackendHealthServerHealthDown ApplicationGatewayBackendHealthServerHealth = "Down" + // ApplicationGatewayBackendHealthServerHealthDraining ... + ApplicationGatewayBackendHealthServerHealthDraining ApplicationGatewayBackendHealthServerHealth = "Draining" + // ApplicationGatewayBackendHealthServerHealthPartial ... + ApplicationGatewayBackendHealthServerHealthPartial ApplicationGatewayBackendHealthServerHealth = "Partial" + // ApplicationGatewayBackendHealthServerHealthUnknown ... + ApplicationGatewayBackendHealthServerHealthUnknown ApplicationGatewayBackendHealthServerHealth = "Unknown" + // ApplicationGatewayBackendHealthServerHealthUp ... + ApplicationGatewayBackendHealthServerHealthUp ApplicationGatewayBackendHealthServerHealth = "Up" +) + +// PossibleApplicationGatewayBackendHealthServerHealthValues returns an array of possible values for the ApplicationGatewayBackendHealthServerHealth const type. +func PossibleApplicationGatewayBackendHealthServerHealthValues() []ApplicationGatewayBackendHealthServerHealth { + return []ApplicationGatewayBackendHealthServerHealth{ApplicationGatewayBackendHealthServerHealthDown, ApplicationGatewayBackendHealthServerHealthDraining, ApplicationGatewayBackendHealthServerHealthPartial, ApplicationGatewayBackendHealthServerHealthUnknown, ApplicationGatewayBackendHealthServerHealthUp} +} + +// ApplicationGatewayCookieBasedAffinity enumerates the values for application gateway cookie based affinity. +type ApplicationGatewayCookieBasedAffinity string + +const ( + // ApplicationGatewayCookieBasedAffinityDisabled ... + ApplicationGatewayCookieBasedAffinityDisabled ApplicationGatewayCookieBasedAffinity = "Disabled" + // ApplicationGatewayCookieBasedAffinityEnabled ... + ApplicationGatewayCookieBasedAffinityEnabled ApplicationGatewayCookieBasedAffinity = "Enabled" +) + +// PossibleApplicationGatewayCookieBasedAffinityValues returns an array of possible values for the ApplicationGatewayCookieBasedAffinity const type. +func PossibleApplicationGatewayCookieBasedAffinityValues() []ApplicationGatewayCookieBasedAffinity { + return []ApplicationGatewayCookieBasedAffinity{ApplicationGatewayCookieBasedAffinityDisabled, ApplicationGatewayCookieBasedAffinityEnabled} +} + +// ApplicationGatewayCustomErrorStatusCode enumerates the values for application gateway custom error status +// code. +type ApplicationGatewayCustomErrorStatusCode string + +const ( + // ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ... + ApplicationGatewayCustomErrorStatusCodeHTTPStatus403 ApplicationGatewayCustomErrorStatusCode = "HttpStatus403" + // ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ... + ApplicationGatewayCustomErrorStatusCodeHTTPStatus502 ApplicationGatewayCustomErrorStatusCode = "HttpStatus502" +) + +// PossibleApplicationGatewayCustomErrorStatusCodeValues returns an array of possible values for the ApplicationGatewayCustomErrorStatusCode const type. +func PossibleApplicationGatewayCustomErrorStatusCodeValues() []ApplicationGatewayCustomErrorStatusCode { + return []ApplicationGatewayCustomErrorStatusCode{ApplicationGatewayCustomErrorStatusCodeHTTPStatus403, ApplicationGatewayCustomErrorStatusCodeHTTPStatus502} +} + +// ApplicationGatewayFirewallMode enumerates the values for application gateway firewall mode. +type ApplicationGatewayFirewallMode string + +const ( + // ApplicationGatewayFirewallModeDetection ... + ApplicationGatewayFirewallModeDetection ApplicationGatewayFirewallMode = "Detection" + // ApplicationGatewayFirewallModePrevention ... + ApplicationGatewayFirewallModePrevention ApplicationGatewayFirewallMode = "Prevention" +) + +// PossibleApplicationGatewayFirewallModeValues returns an array of possible values for the ApplicationGatewayFirewallMode const type. +func PossibleApplicationGatewayFirewallModeValues() []ApplicationGatewayFirewallMode { + return []ApplicationGatewayFirewallMode{ApplicationGatewayFirewallModeDetection, ApplicationGatewayFirewallModePrevention} +} + +// ApplicationGatewayLoadDistributionAlgorithm enumerates the values for application gateway load distribution +// algorithm. +type ApplicationGatewayLoadDistributionAlgorithm string + +const ( + // ApplicationGatewayLoadDistributionAlgorithmIPHash ... + ApplicationGatewayLoadDistributionAlgorithmIPHash ApplicationGatewayLoadDistributionAlgorithm = "IpHash" + // ApplicationGatewayLoadDistributionAlgorithmLeastConnections ... + ApplicationGatewayLoadDistributionAlgorithmLeastConnections ApplicationGatewayLoadDistributionAlgorithm = "LeastConnections" + // ApplicationGatewayLoadDistributionAlgorithmRoundRobin ... + ApplicationGatewayLoadDistributionAlgorithmRoundRobin ApplicationGatewayLoadDistributionAlgorithm = "RoundRobin" +) + +// PossibleApplicationGatewayLoadDistributionAlgorithmValues returns an array of possible values for the ApplicationGatewayLoadDistributionAlgorithm const type. +func PossibleApplicationGatewayLoadDistributionAlgorithmValues() []ApplicationGatewayLoadDistributionAlgorithm { + return []ApplicationGatewayLoadDistributionAlgorithm{ApplicationGatewayLoadDistributionAlgorithmIPHash, ApplicationGatewayLoadDistributionAlgorithmLeastConnections, ApplicationGatewayLoadDistributionAlgorithmRoundRobin} +} + +// ApplicationGatewayOperationalState enumerates the values for application gateway operational state. +type ApplicationGatewayOperationalState string + +const ( + // ApplicationGatewayOperationalStateRunning ... + ApplicationGatewayOperationalStateRunning ApplicationGatewayOperationalState = "Running" + // ApplicationGatewayOperationalStateStarting ... + ApplicationGatewayOperationalStateStarting ApplicationGatewayOperationalState = "Starting" + // ApplicationGatewayOperationalStateStopped ... + ApplicationGatewayOperationalStateStopped ApplicationGatewayOperationalState = "Stopped" + // ApplicationGatewayOperationalStateStopping ... + ApplicationGatewayOperationalStateStopping ApplicationGatewayOperationalState = "Stopping" +) + +// PossibleApplicationGatewayOperationalStateValues returns an array of possible values for the ApplicationGatewayOperationalState const type. +func PossibleApplicationGatewayOperationalStateValues() []ApplicationGatewayOperationalState { + return []ApplicationGatewayOperationalState{ApplicationGatewayOperationalStateRunning, ApplicationGatewayOperationalStateStarting, ApplicationGatewayOperationalStateStopped, ApplicationGatewayOperationalStateStopping} +} + +// ApplicationGatewayProtocol enumerates the values for application gateway protocol. +type ApplicationGatewayProtocol string + +const ( + // ApplicationGatewayProtocolHTTP ... + ApplicationGatewayProtocolHTTP ApplicationGatewayProtocol = "Http" + // ApplicationGatewayProtocolHTTPS ... + ApplicationGatewayProtocolHTTPS ApplicationGatewayProtocol = "Https" + // ApplicationGatewayProtocolTCP ... + ApplicationGatewayProtocolTCP ApplicationGatewayProtocol = "Tcp" + // ApplicationGatewayProtocolTLS ... + ApplicationGatewayProtocolTLS ApplicationGatewayProtocol = "Tls" +) + +// PossibleApplicationGatewayProtocolValues returns an array of possible values for the ApplicationGatewayProtocol const type. +func PossibleApplicationGatewayProtocolValues() []ApplicationGatewayProtocol { + return []ApplicationGatewayProtocol{ApplicationGatewayProtocolHTTP, ApplicationGatewayProtocolHTTPS, ApplicationGatewayProtocolTCP, ApplicationGatewayProtocolTLS} +} + +// ApplicationGatewayRedirectType enumerates the values for application gateway redirect type. +type ApplicationGatewayRedirectType string + +const ( + // ApplicationGatewayRedirectTypeFound ... + ApplicationGatewayRedirectTypeFound ApplicationGatewayRedirectType = "Found" + // ApplicationGatewayRedirectTypePermanent ... + ApplicationGatewayRedirectTypePermanent ApplicationGatewayRedirectType = "Permanent" + // ApplicationGatewayRedirectTypeSeeOther ... + ApplicationGatewayRedirectTypeSeeOther ApplicationGatewayRedirectType = "SeeOther" + // ApplicationGatewayRedirectTypeTemporary ... + ApplicationGatewayRedirectTypeTemporary ApplicationGatewayRedirectType = "Temporary" +) + +// PossibleApplicationGatewayRedirectTypeValues returns an array of possible values for the ApplicationGatewayRedirectType const type. +func PossibleApplicationGatewayRedirectTypeValues() []ApplicationGatewayRedirectType { + return []ApplicationGatewayRedirectType{ApplicationGatewayRedirectTypeFound, ApplicationGatewayRedirectTypePermanent, ApplicationGatewayRedirectTypeSeeOther, ApplicationGatewayRedirectTypeTemporary} +} + +// ApplicationGatewayRequestRoutingRuleType enumerates the values for application gateway request routing rule +// type. +type ApplicationGatewayRequestRoutingRuleType string + +const ( + // ApplicationGatewayRequestRoutingRuleTypeBasic ... + ApplicationGatewayRequestRoutingRuleTypeBasic ApplicationGatewayRequestRoutingRuleType = "Basic" + // ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ... + ApplicationGatewayRequestRoutingRuleTypePathBasedRouting ApplicationGatewayRequestRoutingRuleType = "PathBasedRouting" +) + +// PossibleApplicationGatewayRequestRoutingRuleTypeValues returns an array of possible values for the ApplicationGatewayRequestRoutingRuleType const type. +func PossibleApplicationGatewayRequestRoutingRuleTypeValues() []ApplicationGatewayRequestRoutingRuleType { + return []ApplicationGatewayRequestRoutingRuleType{ApplicationGatewayRequestRoutingRuleTypeBasic, ApplicationGatewayRequestRoutingRuleTypePathBasedRouting} +} + +// ApplicationGatewaySkuName enumerates the values for application gateway sku name. +type ApplicationGatewaySkuName string + +const ( + // ApplicationGatewaySkuNameStandardLarge ... + ApplicationGatewaySkuNameStandardLarge ApplicationGatewaySkuName = "Standard_Large" + // ApplicationGatewaySkuNameStandardMedium ... + ApplicationGatewaySkuNameStandardMedium ApplicationGatewaySkuName = "Standard_Medium" + // ApplicationGatewaySkuNameStandardSmall ... + ApplicationGatewaySkuNameStandardSmall ApplicationGatewaySkuName = "Standard_Small" + // ApplicationGatewaySkuNameStandardV2 ... + ApplicationGatewaySkuNameStandardV2 ApplicationGatewaySkuName = "Standard_v2" + // ApplicationGatewaySkuNameWAFLarge ... + ApplicationGatewaySkuNameWAFLarge ApplicationGatewaySkuName = "WAF_Large" + // ApplicationGatewaySkuNameWAFMedium ... + ApplicationGatewaySkuNameWAFMedium ApplicationGatewaySkuName = "WAF_Medium" + // ApplicationGatewaySkuNameWAFV2 ... + ApplicationGatewaySkuNameWAFV2 ApplicationGatewaySkuName = "WAF_v2" +) + +// PossibleApplicationGatewaySkuNameValues returns an array of possible values for the ApplicationGatewaySkuName const type. +func PossibleApplicationGatewaySkuNameValues() []ApplicationGatewaySkuName { + return []ApplicationGatewaySkuName{ApplicationGatewaySkuNameStandardLarge, ApplicationGatewaySkuNameStandardMedium, ApplicationGatewaySkuNameStandardSmall, ApplicationGatewaySkuNameStandardV2, ApplicationGatewaySkuNameWAFLarge, ApplicationGatewaySkuNameWAFMedium, ApplicationGatewaySkuNameWAFV2} +} + +// ApplicationGatewaySslCipherSuite enumerates the values for application gateway ssl cipher suite. +type ApplicationGatewaySslCipherSuite string + +const ( + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_DSS_WITH_AES_256_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384" + // ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" + // ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_3DES_EDE_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_128_GCM_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_CBC_SHA256" + // ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ... + ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384 ApplicationGatewaySslCipherSuite = "TLS_RSA_WITH_AES_256_GCM_SHA384" +) + +// PossibleApplicationGatewaySslCipherSuiteValues returns an array of possible values for the ApplicationGatewaySslCipherSuite const type. +func PossibleApplicationGatewaySslCipherSuiteValues() []ApplicationGatewaySslCipherSuite { + return []ApplicationGatewaySslCipherSuite{ApplicationGatewaySslCipherSuiteTLSDHEDSSWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHEDSSWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHEECDSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256CBCSHA384, ApplicationGatewaySslCipherSuiteTLSECDHERSAWITHAES256GCMSHA384, ApplicationGatewaySslCipherSuiteTLSRSAWITH3DESEDECBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES128GCMSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256CBCSHA256, ApplicationGatewaySslCipherSuiteTLSRSAWITHAES256GCMSHA384} +} + +// ApplicationGatewaySslPolicyName enumerates the values for application gateway ssl policy name. +type ApplicationGatewaySslPolicyName string + +const ( + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20150501" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401 ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401" + // ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ... + ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S ApplicationGatewaySslPolicyName = "AppGwSslPolicy20170401S" +) + +// PossibleApplicationGatewaySslPolicyNameValues returns an array of possible values for the ApplicationGatewaySslPolicyName const type. +func PossibleApplicationGatewaySslPolicyNameValues() []ApplicationGatewaySslPolicyName { + return []ApplicationGatewaySslPolicyName{ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401, ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S} +} + +// ApplicationGatewaySslPolicyType enumerates the values for application gateway ssl policy type. +type ApplicationGatewaySslPolicyType string + +const ( + // ApplicationGatewaySslPolicyTypeCustom ... + ApplicationGatewaySslPolicyTypeCustom ApplicationGatewaySslPolicyType = "Custom" + // ApplicationGatewaySslPolicyTypePredefined ... + ApplicationGatewaySslPolicyTypePredefined ApplicationGatewaySslPolicyType = "Predefined" +) + +// PossibleApplicationGatewaySslPolicyTypeValues returns an array of possible values for the ApplicationGatewaySslPolicyType const type. +func PossibleApplicationGatewaySslPolicyTypeValues() []ApplicationGatewaySslPolicyType { + return []ApplicationGatewaySslPolicyType{ApplicationGatewaySslPolicyTypeCustom, ApplicationGatewaySslPolicyTypePredefined} +} + +// ApplicationGatewaySslProtocol enumerates the values for application gateway ssl protocol. +type ApplicationGatewaySslProtocol string + +const ( + // ApplicationGatewaySslProtocolTLSv10 ... + ApplicationGatewaySslProtocolTLSv10 ApplicationGatewaySslProtocol = "TLSv1_0" + // ApplicationGatewaySslProtocolTLSv11 ... + ApplicationGatewaySslProtocolTLSv11 ApplicationGatewaySslProtocol = "TLSv1_1" + // ApplicationGatewaySslProtocolTLSv12 ... + ApplicationGatewaySslProtocolTLSv12 ApplicationGatewaySslProtocol = "TLSv1_2" +) + +// PossibleApplicationGatewaySslProtocolValues returns an array of possible values for the ApplicationGatewaySslProtocol const type. +func PossibleApplicationGatewaySslProtocolValues() []ApplicationGatewaySslProtocol { + return []ApplicationGatewaySslProtocol{ApplicationGatewaySslProtocolTLSv10, ApplicationGatewaySslProtocolTLSv11, ApplicationGatewaySslProtocolTLSv12} +} + +// ApplicationGatewayTier enumerates the values for application gateway tier. +type ApplicationGatewayTier string + +const ( + // ApplicationGatewayTierStandard ... + ApplicationGatewayTierStandard ApplicationGatewayTier = "Standard" + // ApplicationGatewayTierStandardV2 ... + ApplicationGatewayTierStandardV2 ApplicationGatewayTier = "Standard_v2" + // ApplicationGatewayTierWAF ... + ApplicationGatewayTierWAF ApplicationGatewayTier = "WAF" + // ApplicationGatewayTierWAFV2 ... + ApplicationGatewayTierWAFV2 ApplicationGatewayTier = "WAF_v2" +) + +// PossibleApplicationGatewayTierValues returns an array of possible values for the ApplicationGatewayTier const type. +func PossibleApplicationGatewayTierValues() []ApplicationGatewayTier { + return []ApplicationGatewayTier{ApplicationGatewayTierStandard, ApplicationGatewayTierStandardV2, ApplicationGatewayTierWAF, ApplicationGatewayTierWAFV2} +} + +// AssociationType enumerates the values for association type. +type AssociationType string + +const ( + // AssociationTypeAssociated ... + AssociationTypeAssociated AssociationType = "Associated" + // AssociationTypeContains ... + AssociationTypeContains AssociationType = "Contains" +) + +// PossibleAssociationTypeValues returns an array of possible values for the AssociationType const type. +func PossibleAssociationTypeValues() []AssociationType { + return []AssociationType{AssociationTypeAssociated, AssociationTypeContains} +} + +// AuthenticationMethod enumerates the values for authentication method. +type AuthenticationMethod string + +const ( + // AuthenticationMethodEAPMSCHAPv2 ... + AuthenticationMethodEAPMSCHAPv2 AuthenticationMethod = "EAPMSCHAPv2" + // AuthenticationMethodEAPTLS ... + AuthenticationMethodEAPTLS AuthenticationMethod = "EAPTLS" +) + +// PossibleAuthenticationMethodValues returns an array of possible values for the AuthenticationMethod const type. +func PossibleAuthenticationMethodValues() []AuthenticationMethod { + return []AuthenticationMethod{AuthenticationMethodEAPMSCHAPv2, AuthenticationMethodEAPTLS} +} + +// AuthorizationUseStatus enumerates the values for authorization use status. +type AuthorizationUseStatus string + +const ( + // AuthorizationUseStatusAvailable ... + AuthorizationUseStatusAvailable AuthorizationUseStatus = "Available" + // AuthorizationUseStatusInUse ... + AuthorizationUseStatusInUse AuthorizationUseStatus = "InUse" +) + +// PossibleAuthorizationUseStatusValues returns an array of possible values for the AuthorizationUseStatus const type. +func PossibleAuthorizationUseStatusValues() []AuthorizationUseStatus { + return []AuthorizationUseStatus{AuthorizationUseStatusAvailable, AuthorizationUseStatusInUse} +} + +// AzureFirewallApplicationRuleProtocolType enumerates the values for azure firewall application rule protocol +// type. +type AzureFirewallApplicationRuleProtocolType string + +const ( + // AzureFirewallApplicationRuleProtocolTypeHTTP ... + AzureFirewallApplicationRuleProtocolTypeHTTP AzureFirewallApplicationRuleProtocolType = "Http" + // AzureFirewallApplicationRuleProtocolTypeHTTPS ... + AzureFirewallApplicationRuleProtocolTypeHTTPS AzureFirewallApplicationRuleProtocolType = "Https" + // AzureFirewallApplicationRuleProtocolTypeMssql ... + AzureFirewallApplicationRuleProtocolTypeMssql AzureFirewallApplicationRuleProtocolType = "Mssql" +) + +// PossibleAzureFirewallApplicationRuleProtocolTypeValues returns an array of possible values for the AzureFirewallApplicationRuleProtocolType const type. +func PossibleAzureFirewallApplicationRuleProtocolTypeValues() []AzureFirewallApplicationRuleProtocolType { + return []AzureFirewallApplicationRuleProtocolType{AzureFirewallApplicationRuleProtocolTypeHTTP, AzureFirewallApplicationRuleProtocolTypeHTTPS, AzureFirewallApplicationRuleProtocolTypeMssql} +} + +// AzureFirewallNatRCActionType enumerates the values for azure firewall nat rc action type. +type AzureFirewallNatRCActionType string + +const ( + // AzureFirewallNatRCActionTypeDnat ... + AzureFirewallNatRCActionTypeDnat AzureFirewallNatRCActionType = "Dnat" + // AzureFirewallNatRCActionTypeSnat ... + AzureFirewallNatRCActionTypeSnat AzureFirewallNatRCActionType = "Snat" +) + +// PossibleAzureFirewallNatRCActionTypeValues returns an array of possible values for the AzureFirewallNatRCActionType const type. +func PossibleAzureFirewallNatRCActionTypeValues() []AzureFirewallNatRCActionType { + return []AzureFirewallNatRCActionType{AzureFirewallNatRCActionTypeDnat, AzureFirewallNatRCActionTypeSnat} +} + +// AzureFirewallNetworkRuleProtocol enumerates the values for azure firewall network rule protocol. +type AzureFirewallNetworkRuleProtocol string + +const ( + // AzureFirewallNetworkRuleProtocolAny ... + AzureFirewallNetworkRuleProtocolAny AzureFirewallNetworkRuleProtocol = "Any" + // AzureFirewallNetworkRuleProtocolICMP ... + AzureFirewallNetworkRuleProtocolICMP AzureFirewallNetworkRuleProtocol = "ICMP" + // AzureFirewallNetworkRuleProtocolTCP ... + AzureFirewallNetworkRuleProtocolTCP AzureFirewallNetworkRuleProtocol = "TCP" + // AzureFirewallNetworkRuleProtocolUDP ... + AzureFirewallNetworkRuleProtocolUDP AzureFirewallNetworkRuleProtocol = "UDP" +) + +// PossibleAzureFirewallNetworkRuleProtocolValues returns an array of possible values for the AzureFirewallNetworkRuleProtocol const type. +func PossibleAzureFirewallNetworkRuleProtocolValues() []AzureFirewallNetworkRuleProtocol { + return []AzureFirewallNetworkRuleProtocol{AzureFirewallNetworkRuleProtocolAny, AzureFirewallNetworkRuleProtocolICMP, AzureFirewallNetworkRuleProtocolTCP, AzureFirewallNetworkRuleProtocolUDP} +} + +// AzureFirewallRCActionType enumerates the values for azure firewall rc action type. +type AzureFirewallRCActionType string + +const ( + // AzureFirewallRCActionTypeAllow ... + AzureFirewallRCActionTypeAllow AzureFirewallRCActionType = "Allow" + // AzureFirewallRCActionTypeDeny ... + AzureFirewallRCActionTypeDeny AzureFirewallRCActionType = "Deny" +) + +// PossibleAzureFirewallRCActionTypeValues returns an array of possible values for the AzureFirewallRCActionType const type. +func PossibleAzureFirewallRCActionTypeValues() []AzureFirewallRCActionType { + return []AzureFirewallRCActionType{AzureFirewallRCActionTypeAllow, AzureFirewallRCActionTypeDeny} +} + +// AzureFirewallSkuName enumerates the values for azure firewall sku name. +type AzureFirewallSkuName string + +const ( + // AzureFirewallSkuNameAZFWHub ... + AzureFirewallSkuNameAZFWHub AzureFirewallSkuName = "AZFW_Hub" + // AzureFirewallSkuNameAZFWVNet ... + AzureFirewallSkuNameAZFWVNet AzureFirewallSkuName = "AZFW_VNet" +) + +// PossibleAzureFirewallSkuNameValues returns an array of possible values for the AzureFirewallSkuName const type. +func PossibleAzureFirewallSkuNameValues() []AzureFirewallSkuName { + return []AzureFirewallSkuName{AzureFirewallSkuNameAZFWHub, AzureFirewallSkuNameAZFWVNet} +} + +// AzureFirewallSkuTier enumerates the values for azure firewall sku tier. +type AzureFirewallSkuTier string + +const ( + // AzureFirewallSkuTierBasic ... + AzureFirewallSkuTierBasic AzureFirewallSkuTier = "Basic" + // AzureFirewallSkuTierPremium ... + AzureFirewallSkuTierPremium AzureFirewallSkuTier = "Premium" + // AzureFirewallSkuTierStandard ... + AzureFirewallSkuTierStandard AzureFirewallSkuTier = "Standard" +) + +// PossibleAzureFirewallSkuTierValues returns an array of possible values for the AzureFirewallSkuTier const type. +func PossibleAzureFirewallSkuTierValues() []AzureFirewallSkuTier { + return []AzureFirewallSkuTier{AzureFirewallSkuTierBasic, AzureFirewallSkuTierPremium, AzureFirewallSkuTierStandard} +} + +// AzureFirewallThreatIntelMode enumerates the values for azure firewall threat intel mode. +type AzureFirewallThreatIntelMode string + +const ( + // AzureFirewallThreatIntelModeAlert ... + AzureFirewallThreatIntelModeAlert AzureFirewallThreatIntelMode = "Alert" + // AzureFirewallThreatIntelModeDeny ... + AzureFirewallThreatIntelModeDeny AzureFirewallThreatIntelMode = "Deny" + // AzureFirewallThreatIntelModeOff ... + AzureFirewallThreatIntelModeOff AzureFirewallThreatIntelMode = "Off" +) + +// PossibleAzureFirewallThreatIntelModeValues returns an array of possible values for the AzureFirewallThreatIntelMode const type. +func PossibleAzureFirewallThreatIntelModeValues() []AzureFirewallThreatIntelMode { + return []AzureFirewallThreatIntelMode{AzureFirewallThreatIntelModeAlert, AzureFirewallThreatIntelModeDeny, AzureFirewallThreatIntelModeOff} +} + +// BastionConnectProtocol enumerates the values for bastion connect protocol. +type BastionConnectProtocol string + +const ( + // BastionConnectProtocolRDP ... + BastionConnectProtocolRDP BastionConnectProtocol = "RDP" + // BastionConnectProtocolSSH ... + BastionConnectProtocolSSH BastionConnectProtocol = "SSH" +) + +// PossibleBastionConnectProtocolValues returns an array of possible values for the BastionConnectProtocol const type. +func PossibleBastionConnectProtocolValues() []BastionConnectProtocol { + return []BastionConnectProtocol{BastionConnectProtocolRDP, BastionConnectProtocolSSH} +} + +// BastionHostSkuName enumerates the values for bastion host sku name. +type BastionHostSkuName string + +const ( + // BastionHostSkuNameBasic ... + BastionHostSkuNameBasic BastionHostSkuName = "Basic" + // BastionHostSkuNameStandard ... + BastionHostSkuNameStandard BastionHostSkuName = "Standard" +) + +// PossibleBastionHostSkuNameValues returns an array of possible values for the BastionHostSkuName const type. +func PossibleBastionHostSkuNameValues() []BastionHostSkuName { + return []BastionHostSkuName{BastionHostSkuNameBasic, BastionHostSkuNameStandard} +} + +// BgpPeerState enumerates the values for bgp peer state. +type BgpPeerState string + +const ( + // BgpPeerStateConnected ... + BgpPeerStateConnected BgpPeerState = "Connected" + // BgpPeerStateConnecting ... + BgpPeerStateConnecting BgpPeerState = "Connecting" + // BgpPeerStateIdle ... + BgpPeerStateIdle BgpPeerState = "Idle" + // BgpPeerStateStopped ... + BgpPeerStateStopped BgpPeerState = "Stopped" + // BgpPeerStateUnknown ... + BgpPeerStateUnknown BgpPeerState = "Unknown" +) + +// PossibleBgpPeerStateValues returns an array of possible values for the BgpPeerState const type. +func PossibleBgpPeerStateValues() []BgpPeerState { + return []BgpPeerState{BgpPeerStateConnected, BgpPeerStateConnecting, BgpPeerStateIdle, BgpPeerStateStopped, BgpPeerStateUnknown} +} + +// CircuitConnectionStatus enumerates the values for circuit connection status. +type CircuitConnectionStatus string + +const ( + // CircuitConnectionStatusConnected ... + CircuitConnectionStatusConnected CircuitConnectionStatus = "Connected" + // CircuitConnectionStatusConnecting ... + CircuitConnectionStatusConnecting CircuitConnectionStatus = "Connecting" + // CircuitConnectionStatusDisconnected ... + CircuitConnectionStatusDisconnected CircuitConnectionStatus = "Disconnected" +) + +// PossibleCircuitConnectionStatusValues returns an array of possible values for the CircuitConnectionStatus const type. +func PossibleCircuitConnectionStatusValues() []CircuitConnectionStatus { + return []CircuitConnectionStatus{CircuitConnectionStatusConnected, CircuitConnectionStatusConnecting, CircuitConnectionStatusDisconnected} +} + +// CommissionedState enumerates the values for commissioned state. +type CommissionedState string + +const ( + // CommissionedStateCommissioned ... + CommissionedStateCommissioned CommissionedState = "Commissioned" + // CommissionedStateCommissioning ... + CommissionedStateCommissioning CommissionedState = "Commissioning" + // CommissionedStateDecommissioning ... + CommissionedStateDecommissioning CommissionedState = "Decommissioning" + // CommissionedStateDeprovisioning ... + CommissionedStateDeprovisioning CommissionedState = "Deprovisioning" + // CommissionedStateProvisioned ... + CommissionedStateProvisioned CommissionedState = "Provisioned" + // CommissionedStateProvisioning ... + CommissionedStateProvisioning CommissionedState = "Provisioning" +) + +// PossibleCommissionedStateValues returns an array of possible values for the CommissionedState const type. +func PossibleCommissionedStateValues() []CommissionedState { + return []CommissionedState{CommissionedStateCommissioned, CommissionedStateCommissioning, CommissionedStateDecommissioning, CommissionedStateDeprovisioning, CommissionedStateProvisioned, CommissionedStateProvisioning} +} + +// ConnectionMonitorEndpointFilterItemType enumerates the values for connection monitor endpoint filter item +// type. +type ConnectionMonitorEndpointFilterItemType string + +const ( + // ConnectionMonitorEndpointFilterItemTypeAgentAddress ... + ConnectionMonitorEndpointFilterItemTypeAgentAddress ConnectionMonitorEndpointFilterItemType = "AgentAddress" +) + +// PossibleConnectionMonitorEndpointFilterItemTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterItemType const type. +func PossibleConnectionMonitorEndpointFilterItemTypeValues() []ConnectionMonitorEndpointFilterItemType { + return []ConnectionMonitorEndpointFilterItemType{ConnectionMonitorEndpointFilterItemTypeAgentAddress} +} + +// ConnectionMonitorEndpointFilterType enumerates the values for connection monitor endpoint filter type. +type ConnectionMonitorEndpointFilterType string + +const ( + // ConnectionMonitorEndpointFilterTypeInclude ... + ConnectionMonitorEndpointFilterTypeInclude ConnectionMonitorEndpointFilterType = "Include" +) + +// PossibleConnectionMonitorEndpointFilterTypeValues returns an array of possible values for the ConnectionMonitorEndpointFilterType const type. +func PossibleConnectionMonitorEndpointFilterTypeValues() []ConnectionMonitorEndpointFilterType { + return []ConnectionMonitorEndpointFilterType{ConnectionMonitorEndpointFilterTypeInclude} +} + +// ConnectionMonitorSourceStatus enumerates the values for connection monitor source status. +type ConnectionMonitorSourceStatus string + +const ( + // ConnectionMonitorSourceStatusActive ... + ConnectionMonitorSourceStatusActive ConnectionMonitorSourceStatus = "Active" + // ConnectionMonitorSourceStatusInactive ... + ConnectionMonitorSourceStatusInactive ConnectionMonitorSourceStatus = "Inactive" + // ConnectionMonitorSourceStatusUnknown ... + ConnectionMonitorSourceStatusUnknown ConnectionMonitorSourceStatus = "Unknown" +) + +// PossibleConnectionMonitorSourceStatusValues returns an array of possible values for the ConnectionMonitorSourceStatus const type. +func PossibleConnectionMonitorSourceStatusValues() []ConnectionMonitorSourceStatus { + return []ConnectionMonitorSourceStatus{ConnectionMonitorSourceStatusActive, ConnectionMonitorSourceStatusInactive, ConnectionMonitorSourceStatusUnknown} +} + +// ConnectionMonitorTestConfigurationProtocol enumerates the values for connection monitor test configuration +// protocol. +type ConnectionMonitorTestConfigurationProtocol string + +const ( + // ConnectionMonitorTestConfigurationProtocolHTTP ... + ConnectionMonitorTestConfigurationProtocolHTTP ConnectionMonitorTestConfigurationProtocol = "Http" + // ConnectionMonitorTestConfigurationProtocolIcmp ... + ConnectionMonitorTestConfigurationProtocolIcmp ConnectionMonitorTestConfigurationProtocol = "Icmp" + // ConnectionMonitorTestConfigurationProtocolTCP ... + ConnectionMonitorTestConfigurationProtocolTCP ConnectionMonitorTestConfigurationProtocol = "Tcp" +) + +// PossibleConnectionMonitorTestConfigurationProtocolValues returns an array of possible values for the ConnectionMonitorTestConfigurationProtocol const type. +func PossibleConnectionMonitorTestConfigurationProtocolValues() []ConnectionMonitorTestConfigurationProtocol { + return []ConnectionMonitorTestConfigurationProtocol{ConnectionMonitorTestConfigurationProtocolHTTP, ConnectionMonitorTestConfigurationProtocolIcmp, ConnectionMonitorTestConfigurationProtocolTCP} +} + +// ConnectionMonitorType enumerates the values for connection monitor type. +type ConnectionMonitorType string + +const ( + // ConnectionMonitorTypeMultiEndpoint ... + ConnectionMonitorTypeMultiEndpoint ConnectionMonitorType = "MultiEndpoint" + // ConnectionMonitorTypeSingleSourceDestination ... + ConnectionMonitorTypeSingleSourceDestination ConnectionMonitorType = "SingleSourceDestination" +) + +// PossibleConnectionMonitorTypeValues returns an array of possible values for the ConnectionMonitorType const type. +func PossibleConnectionMonitorTypeValues() []ConnectionMonitorType { + return []ConnectionMonitorType{ConnectionMonitorTypeMultiEndpoint, ConnectionMonitorTypeSingleSourceDestination} +} + +// ConnectionState enumerates the values for connection state. +type ConnectionState string + +const ( + // ConnectionStateReachable ... + ConnectionStateReachable ConnectionState = "Reachable" + // ConnectionStateUnknown ... + ConnectionStateUnknown ConnectionState = "Unknown" + // ConnectionStateUnreachable ... + ConnectionStateUnreachable ConnectionState = "Unreachable" +) + +// PossibleConnectionStateValues returns an array of possible values for the ConnectionState const type. +func PossibleConnectionStateValues() []ConnectionState { + return []ConnectionState{ConnectionStateReachable, ConnectionStateUnknown, ConnectionStateUnreachable} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusConnected ... + ConnectionStatusConnected ConnectionStatus = "Connected" + // ConnectionStatusDegraded ... + ConnectionStatusDegraded ConnectionStatus = "Degraded" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusUnknown ... + ConnectionStatusUnknown ConnectionStatus = "Unknown" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusConnected, ConnectionStatusDegraded, ConnectionStatusDisconnected, ConnectionStatusUnknown} +} + +// CoverageLevel enumerates the values for coverage level. +type CoverageLevel string + +const ( + // CoverageLevelAboveAverage ... + CoverageLevelAboveAverage CoverageLevel = "AboveAverage" + // CoverageLevelAverage ... + CoverageLevelAverage CoverageLevel = "Average" + // CoverageLevelBelowAverage ... + CoverageLevelBelowAverage CoverageLevel = "BelowAverage" + // CoverageLevelDefault ... + CoverageLevelDefault CoverageLevel = "Default" + // CoverageLevelFull ... + CoverageLevelFull CoverageLevel = "Full" + // CoverageLevelLow ... + CoverageLevelLow CoverageLevel = "Low" +) + +// PossibleCoverageLevelValues returns an array of possible values for the CoverageLevel const type. +func PossibleCoverageLevelValues() []CoverageLevel { + return []CoverageLevel{CoverageLevelAboveAverage, CoverageLevelAverage, CoverageLevelBelowAverage, CoverageLevelDefault, CoverageLevelFull, CoverageLevelLow} +} + +// DdosCustomPolicyProtocol enumerates the values for ddos custom policy protocol. +type DdosCustomPolicyProtocol string + +const ( + // DdosCustomPolicyProtocolSyn ... + DdosCustomPolicyProtocolSyn DdosCustomPolicyProtocol = "Syn" + // DdosCustomPolicyProtocolTCP ... + DdosCustomPolicyProtocolTCP DdosCustomPolicyProtocol = "Tcp" + // DdosCustomPolicyProtocolUDP ... + DdosCustomPolicyProtocolUDP DdosCustomPolicyProtocol = "Udp" +) + +// PossibleDdosCustomPolicyProtocolValues returns an array of possible values for the DdosCustomPolicyProtocol const type. +func PossibleDdosCustomPolicyProtocolValues() []DdosCustomPolicyProtocol { + return []DdosCustomPolicyProtocol{DdosCustomPolicyProtocolSyn, DdosCustomPolicyProtocolTCP, DdosCustomPolicyProtocolUDP} +} + +// DdosCustomPolicyTriggerSensitivityOverride enumerates the values for ddos custom policy trigger sensitivity +// override. +type DdosCustomPolicyTriggerSensitivityOverride string + +const ( + // DdosCustomPolicyTriggerSensitivityOverrideDefault ... + DdosCustomPolicyTriggerSensitivityOverrideDefault DdosCustomPolicyTriggerSensitivityOverride = "Default" + // DdosCustomPolicyTriggerSensitivityOverrideHigh ... + DdosCustomPolicyTriggerSensitivityOverrideHigh DdosCustomPolicyTriggerSensitivityOverride = "High" + // DdosCustomPolicyTriggerSensitivityOverrideLow ... + DdosCustomPolicyTriggerSensitivityOverrideLow DdosCustomPolicyTriggerSensitivityOverride = "Low" + // DdosCustomPolicyTriggerSensitivityOverrideRelaxed ... + DdosCustomPolicyTriggerSensitivityOverrideRelaxed DdosCustomPolicyTriggerSensitivityOverride = "Relaxed" +) + +// PossibleDdosCustomPolicyTriggerSensitivityOverrideValues returns an array of possible values for the DdosCustomPolicyTriggerSensitivityOverride const type. +func PossibleDdosCustomPolicyTriggerSensitivityOverrideValues() []DdosCustomPolicyTriggerSensitivityOverride { + return []DdosCustomPolicyTriggerSensitivityOverride{DdosCustomPolicyTriggerSensitivityOverrideDefault, DdosCustomPolicyTriggerSensitivityOverrideHigh, DdosCustomPolicyTriggerSensitivityOverrideLow, DdosCustomPolicyTriggerSensitivityOverrideRelaxed} +} + +// DdosSettingsProtectionCoverage enumerates the values for ddos settings protection coverage. +type DdosSettingsProtectionCoverage string + +const ( + // DdosSettingsProtectionCoverageBasic ... + DdosSettingsProtectionCoverageBasic DdosSettingsProtectionCoverage = "Basic" + // DdosSettingsProtectionCoverageStandard ... + DdosSettingsProtectionCoverageStandard DdosSettingsProtectionCoverage = "Standard" +) + +// PossibleDdosSettingsProtectionCoverageValues returns an array of possible values for the DdosSettingsProtectionCoverage const type. +func PossibleDdosSettingsProtectionCoverageValues() []DdosSettingsProtectionCoverage { + return []DdosSettingsProtectionCoverage{DdosSettingsProtectionCoverageBasic, DdosSettingsProtectionCoverageStandard} +} + +// DeleteOptions enumerates the values for delete options. +type DeleteOptions string + +const ( + // DeleteOptionsDelete ... + DeleteOptionsDelete DeleteOptions = "Delete" + // DeleteOptionsDetach ... + DeleteOptionsDetach DeleteOptions = "Detach" +) + +// PossibleDeleteOptionsValues returns an array of possible values for the DeleteOptions const type. +func PossibleDeleteOptionsValues() []DeleteOptions { + return []DeleteOptions{DeleteOptionsDelete, DeleteOptionsDetach} +} + +// DestinationPortBehavior enumerates the values for destination port behavior. +type DestinationPortBehavior string + +const ( + // DestinationPortBehaviorListenIfAvailable ... + DestinationPortBehaviorListenIfAvailable DestinationPortBehavior = "ListenIfAvailable" + // DestinationPortBehaviorNone ... + DestinationPortBehaviorNone DestinationPortBehavior = "None" +) + +// PossibleDestinationPortBehaviorValues returns an array of possible values for the DestinationPortBehavior const type. +func PossibleDestinationPortBehaviorValues() []DestinationPortBehavior { + return []DestinationPortBehavior{DestinationPortBehaviorListenIfAvailable, DestinationPortBehaviorNone} +} + +// DhGroup enumerates the values for dh group. +type DhGroup string + +const ( + // DhGroupDHGroup1 ... + DhGroupDHGroup1 DhGroup = "DHGroup1" + // DhGroupDHGroup14 ... + DhGroupDHGroup14 DhGroup = "DHGroup14" + // DhGroupDHGroup2 ... + DhGroupDHGroup2 DhGroup = "DHGroup2" + // DhGroupDHGroup2048 ... + DhGroupDHGroup2048 DhGroup = "DHGroup2048" + // DhGroupDHGroup24 ... + DhGroupDHGroup24 DhGroup = "DHGroup24" + // DhGroupECP256 ... + DhGroupECP256 DhGroup = "ECP256" + // DhGroupECP384 ... + DhGroupECP384 DhGroup = "ECP384" + // DhGroupNone ... + DhGroupNone DhGroup = "None" +) + +// PossibleDhGroupValues returns an array of possible values for the DhGroup const type. +func PossibleDhGroupValues() []DhGroup { + return []DhGroup{DhGroupDHGroup1, DhGroupDHGroup14, DhGroupDHGroup2, DhGroupDHGroup2048, DhGroupDHGroup24, DhGroupECP256, DhGroupECP384, DhGroupNone} +} + +// Direction enumerates the values for direction. +type Direction string + +const ( + // DirectionInbound ... + DirectionInbound Direction = "Inbound" + // DirectionOutbound ... + DirectionOutbound Direction = "Outbound" +) + +// PossibleDirectionValues returns an array of possible values for the Direction const type. +func PossibleDirectionValues() []Direction { + return []Direction{DirectionInbound, DirectionOutbound} +} + +// EffectiveRouteSource enumerates the values for effective route source. +type EffectiveRouteSource string + +const ( + // EffectiveRouteSourceDefault ... + EffectiveRouteSourceDefault EffectiveRouteSource = "Default" + // EffectiveRouteSourceUnknown ... + EffectiveRouteSourceUnknown EffectiveRouteSource = "Unknown" + // EffectiveRouteSourceUser ... + EffectiveRouteSourceUser EffectiveRouteSource = "User" + // EffectiveRouteSourceVirtualNetworkGateway ... + EffectiveRouteSourceVirtualNetworkGateway EffectiveRouteSource = "VirtualNetworkGateway" +) + +// PossibleEffectiveRouteSourceValues returns an array of possible values for the EffectiveRouteSource const type. +func PossibleEffectiveRouteSourceValues() []EffectiveRouteSource { + return []EffectiveRouteSource{EffectiveRouteSourceDefault, EffectiveRouteSourceUnknown, EffectiveRouteSourceUser, EffectiveRouteSourceVirtualNetworkGateway} +} + +// EffectiveRouteState enumerates the values for effective route state. +type EffectiveRouteState string + +const ( + // EffectiveRouteStateActive ... + EffectiveRouteStateActive EffectiveRouteState = "Active" + // EffectiveRouteStateInvalid ... + EffectiveRouteStateInvalid EffectiveRouteState = "Invalid" +) + +// PossibleEffectiveRouteStateValues returns an array of possible values for the EffectiveRouteState const type. +func PossibleEffectiveRouteStateValues() []EffectiveRouteState { + return []EffectiveRouteState{EffectiveRouteStateActive, EffectiveRouteStateInvalid} +} + +// EffectiveSecurityRuleProtocol enumerates the values for effective security rule protocol. +type EffectiveSecurityRuleProtocol string + +const ( + // EffectiveSecurityRuleProtocolAll ... + EffectiveSecurityRuleProtocolAll EffectiveSecurityRuleProtocol = "All" + // EffectiveSecurityRuleProtocolTCP ... + EffectiveSecurityRuleProtocolTCP EffectiveSecurityRuleProtocol = "Tcp" + // EffectiveSecurityRuleProtocolUDP ... + EffectiveSecurityRuleProtocolUDP EffectiveSecurityRuleProtocol = "Udp" +) + +// PossibleEffectiveSecurityRuleProtocolValues returns an array of possible values for the EffectiveSecurityRuleProtocol const type. +func PossibleEffectiveSecurityRuleProtocolValues() []EffectiveSecurityRuleProtocol { + return []EffectiveSecurityRuleProtocol{EffectiveSecurityRuleProtocolAll, EffectiveSecurityRuleProtocolTCP, EffectiveSecurityRuleProtocolUDP} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeAzureSubnet ... + EndpointTypeAzureSubnet EndpointType = "AzureSubnet" + // EndpointTypeAzureVM ... + EndpointTypeAzureVM EndpointType = "AzureVM" + // EndpointTypeAzureVNet ... + EndpointTypeAzureVNet EndpointType = "AzureVNet" + // EndpointTypeExternalAddress ... + EndpointTypeExternalAddress EndpointType = "ExternalAddress" + // EndpointTypeMMAWorkspaceMachine ... + EndpointTypeMMAWorkspaceMachine EndpointType = "MMAWorkspaceMachine" + // EndpointTypeMMAWorkspaceNetwork ... + EndpointTypeMMAWorkspaceNetwork EndpointType = "MMAWorkspaceNetwork" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeAzureSubnet, EndpointTypeAzureVM, EndpointTypeAzureVNet, EndpointTypeExternalAddress, EndpointTypeMMAWorkspaceMachine, EndpointTypeMMAWorkspaceNetwork} +} + +// EvaluationState enumerates the values for evaluation state. +type EvaluationState string + +const ( + // EvaluationStateCompleted ... + EvaluationStateCompleted EvaluationState = "Completed" + // EvaluationStateInProgress ... + EvaluationStateInProgress EvaluationState = "InProgress" + // EvaluationStateNotStarted ... + EvaluationStateNotStarted EvaluationState = "NotStarted" +) + +// PossibleEvaluationStateValues returns an array of possible values for the EvaluationState const type. +func PossibleEvaluationStateValues() []EvaluationState { + return []EvaluationState{EvaluationStateCompleted, EvaluationStateInProgress, EvaluationStateNotStarted} +} + +// ExpressRouteCircuitPeeringAdvertisedPublicPrefixState enumerates the values for express route circuit +// peering advertised public prefix state. +type ExpressRouteCircuitPeeringAdvertisedPublicPrefixState string + +const ( + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configured" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "Configuring" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "NotConfigured" + // ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ... + ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded ExpressRouteCircuitPeeringAdvertisedPublicPrefixState = "ValidationNeeded" +) + +// PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues returns an array of possible values for the ExpressRouteCircuitPeeringAdvertisedPublicPrefixState const type. +func PossibleExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValues() []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState { + return []ExpressRouteCircuitPeeringAdvertisedPublicPrefixState{ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured, ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded} +} + +// ExpressRouteCircuitPeeringState enumerates the values for express route circuit peering state. +type ExpressRouteCircuitPeeringState string + +const ( + // ExpressRouteCircuitPeeringStateDisabled ... + ExpressRouteCircuitPeeringStateDisabled ExpressRouteCircuitPeeringState = "Disabled" + // ExpressRouteCircuitPeeringStateEnabled ... + ExpressRouteCircuitPeeringStateEnabled ExpressRouteCircuitPeeringState = "Enabled" +) + +// PossibleExpressRouteCircuitPeeringStateValues returns an array of possible values for the ExpressRouteCircuitPeeringState const type. +func PossibleExpressRouteCircuitPeeringStateValues() []ExpressRouteCircuitPeeringState { + return []ExpressRouteCircuitPeeringState{ExpressRouteCircuitPeeringStateDisabled, ExpressRouteCircuitPeeringStateEnabled} +} + +// ExpressRouteCircuitSkuFamily enumerates the values for express route circuit sku family. +type ExpressRouteCircuitSkuFamily string + +const ( + // ExpressRouteCircuitSkuFamilyMeteredData ... + ExpressRouteCircuitSkuFamilyMeteredData ExpressRouteCircuitSkuFamily = "MeteredData" + // ExpressRouteCircuitSkuFamilyUnlimitedData ... + ExpressRouteCircuitSkuFamilyUnlimitedData ExpressRouteCircuitSkuFamily = "UnlimitedData" +) + +// PossibleExpressRouteCircuitSkuFamilyValues returns an array of possible values for the ExpressRouteCircuitSkuFamily const type. +func PossibleExpressRouteCircuitSkuFamilyValues() []ExpressRouteCircuitSkuFamily { + return []ExpressRouteCircuitSkuFamily{ExpressRouteCircuitSkuFamilyMeteredData, ExpressRouteCircuitSkuFamilyUnlimitedData} +} + +// ExpressRouteCircuitSkuTier enumerates the values for express route circuit sku tier. +type ExpressRouteCircuitSkuTier string + +const ( + // ExpressRouteCircuitSkuTierBasic ... + ExpressRouteCircuitSkuTierBasic ExpressRouteCircuitSkuTier = "Basic" + // ExpressRouteCircuitSkuTierLocal ... + ExpressRouteCircuitSkuTierLocal ExpressRouteCircuitSkuTier = "Local" + // ExpressRouteCircuitSkuTierPremium ... + ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = "Premium" + // ExpressRouteCircuitSkuTierStandard ... + ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = "Standard" +) + +// PossibleExpressRouteCircuitSkuTierValues returns an array of possible values for the ExpressRouteCircuitSkuTier const type. +func PossibleExpressRouteCircuitSkuTierValues() []ExpressRouteCircuitSkuTier { + return []ExpressRouteCircuitSkuTier{ExpressRouteCircuitSkuTierBasic, ExpressRouteCircuitSkuTierLocal, ExpressRouteCircuitSkuTierPremium, ExpressRouteCircuitSkuTierStandard} +} + +// ExpressRouteLinkAdminState enumerates the values for express route link admin state. +type ExpressRouteLinkAdminState string + +const ( + // ExpressRouteLinkAdminStateDisabled ... + ExpressRouteLinkAdminStateDisabled ExpressRouteLinkAdminState = "Disabled" + // ExpressRouteLinkAdminStateEnabled ... + ExpressRouteLinkAdminStateEnabled ExpressRouteLinkAdminState = "Enabled" +) + +// PossibleExpressRouteLinkAdminStateValues returns an array of possible values for the ExpressRouteLinkAdminState const type. +func PossibleExpressRouteLinkAdminStateValues() []ExpressRouteLinkAdminState { + return []ExpressRouteLinkAdminState{ExpressRouteLinkAdminStateDisabled, ExpressRouteLinkAdminStateEnabled} +} + +// ExpressRouteLinkConnectorType enumerates the values for express route link connector type. +type ExpressRouteLinkConnectorType string + +const ( + // ExpressRouteLinkConnectorTypeLC ... + ExpressRouteLinkConnectorTypeLC ExpressRouteLinkConnectorType = "LC" + // ExpressRouteLinkConnectorTypeSC ... + ExpressRouteLinkConnectorTypeSC ExpressRouteLinkConnectorType = "SC" +) + +// PossibleExpressRouteLinkConnectorTypeValues returns an array of possible values for the ExpressRouteLinkConnectorType const type. +func PossibleExpressRouteLinkConnectorTypeValues() []ExpressRouteLinkConnectorType { + return []ExpressRouteLinkConnectorType{ExpressRouteLinkConnectorTypeLC, ExpressRouteLinkConnectorTypeSC} +} + +// ExpressRouteLinkMacSecCipher enumerates the values for express route link mac sec cipher. +type ExpressRouteLinkMacSecCipher string + +const ( + // ExpressRouteLinkMacSecCipherGcmAes128 ... + ExpressRouteLinkMacSecCipherGcmAes128 ExpressRouteLinkMacSecCipher = "GcmAes128" + // ExpressRouteLinkMacSecCipherGcmAes256 ... + ExpressRouteLinkMacSecCipherGcmAes256 ExpressRouteLinkMacSecCipher = "GcmAes256" + // ExpressRouteLinkMacSecCipherGcmAesXpn128 ... + ExpressRouteLinkMacSecCipherGcmAesXpn128 ExpressRouteLinkMacSecCipher = "GcmAesXpn128" + // ExpressRouteLinkMacSecCipherGcmAesXpn256 ... + ExpressRouteLinkMacSecCipherGcmAesXpn256 ExpressRouteLinkMacSecCipher = "GcmAesXpn256" +) + +// PossibleExpressRouteLinkMacSecCipherValues returns an array of possible values for the ExpressRouteLinkMacSecCipher const type. +func PossibleExpressRouteLinkMacSecCipherValues() []ExpressRouteLinkMacSecCipher { + return []ExpressRouteLinkMacSecCipher{ExpressRouteLinkMacSecCipherGcmAes128, ExpressRouteLinkMacSecCipherGcmAes256, ExpressRouteLinkMacSecCipherGcmAesXpn128, ExpressRouteLinkMacSecCipherGcmAesXpn256} +} + +// ExpressRouteLinkMacSecSciState enumerates the values for express route link mac sec sci state. +type ExpressRouteLinkMacSecSciState string + +const ( + // ExpressRouteLinkMacSecSciStateDisabled ... + ExpressRouteLinkMacSecSciStateDisabled ExpressRouteLinkMacSecSciState = "Disabled" + // ExpressRouteLinkMacSecSciStateEnabled ... + ExpressRouteLinkMacSecSciStateEnabled ExpressRouteLinkMacSecSciState = "Enabled" +) + +// PossibleExpressRouteLinkMacSecSciStateValues returns an array of possible values for the ExpressRouteLinkMacSecSciState const type. +func PossibleExpressRouteLinkMacSecSciStateValues() []ExpressRouteLinkMacSecSciState { + return []ExpressRouteLinkMacSecSciState{ExpressRouteLinkMacSecSciStateDisabled, ExpressRouteLinkMacSecSciStateEnabled} +} + +// ExpressRoutePeeringState enumerates the values for express route peering state. +type ExpressRoutePeeringState string + +const ( + // ExpressRoutePeeringStateDisabled ... + ExpressRoutePeeringStateDisabled ExpressRoutePeeringState = "Disabled" + // ExpressRoutePeeringStateEnabled ... + ExpressRoutePeeringStateEnabled ExpressRoutePeeringState = "Enabled" +) + +// PossibleExpressRoutePeeringStateValues returns an array of possible values for the ExpressRoutePeeringState const type. +func PossibleExpressRoutePeeringStateValues() []ExpressRoutePeeringState { + return []ExpressRoutePeeringState{ExpressRoutePeeringStateDisabled, ExpressRoutePeeringStateEnabled} +} + +// ExpressRoutePeeringType enumerates the values for express route peering type. +type ExpressRoutePeeringType string + +const ( + // ExpressRoutePeeringTypeAzurePrivatePeering ... + ExpressRoutePeeringTypeAzurePrivatePeering ExpressRoutePeeringType = "AzurePrivatePeering" + // ExpressRoutePeeringTypeAzurePublicPeering ... + ExpressRoutePeeringTypeAzurePublicPeering ExpressRoutePeeringType = "AzurePublicPeering" + // ExpressRoutePeeringTypeMicrosoftPeering ... + ExpressRoutePeeringTypeMicrosoftPeering ExpressRoutePeeringType = "MicrosoftPeering" +) + +// PossibleExpressRoutePeeringTypeValues returns an array of possible values for the ExpressRoutePeeringType const type. +func PossibleExpressRoutePeeringTypeValues() []ExpressRoutePeeringType { + return []ExpressRoutePeeringType{ExpressRoutePeeringTypeAzurePrivatePeering, ExpressRoutePeeringTypeAzurePublicPeering, ExpressRoutePeeringTypeMicrosoftPeering} +} + +// ExpressRoutePortAuthorizationUseStatus enumerates the values for express route port authorization use +// status. +type ExpressRoutePortAuthorizationUseStatus string + +const ( + // ExpressRoutePortAuthorizationUseStatusAvailable ... + ExpressRoutePortAuthorizationUseStatusAvailable ExpressRoutePortAuthorizationUseStatus = "Available" + // ExpressRoutePortAuthorizationUseStatusInUse ... + ExpressRoutePortAuthorizationUseStatusInUse ExpressRoutePortAuthorizationUseStatus = "InUse" +) + +// PossibleExpressRoutePortAuthorizationUseStatusValues returns an array of possible values for the ExpressRoutePortAuthorizationUseStatus const type. +func PossibleExpressRoutePortAuthorizationUseStatusValues() []ExpressRoutePortAuthorizationUseStatus { + return []ExpressRoutePortAuthorizationUseStatus{ExpressRoutePortAuthorizationUseStatusAvailable, ExpressRoutePortAuthorizationUseStatusInUse} +} + +// ExpressRoutePortsEncapsulation enumerates the values for express route ports encapsulation. +type ExpressRoutePortsEncapsulation string + +const ( + // ExpressRoutePortsEncapsulationDot1Q ... + ExpressRoutePortsEncapsulationDot1Q ExpressRoutePortsEncapsulation = "Dot1Q" + // ExpressRoutePortsEncapsulationQinQ ... + ExpressRoutePortsEncapsulationQinQ ExpressRoutePortsEncapsulation = "QinQ" +) + +// PossibleExpressRoutePortsEncapsulationValues returns an array of possible values for the ExpressRoutePortsEncapsulation const type. +func PossibleExpressRoutePortsEncapsulationValues() []ExpressRoutePortsEncapsulation { + return []ExpressRoutePortsEncapsulation{ExpressRoutePortsEncapsulationDot1Q, ExpressRoutePortsEncapsulationQinQ} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// FirewallPolicyFilterRuleCollectionActionType enumerates the values for firewall policy filter rule +// collection action type. +type FirewallPolicyFilterRuleCollectionActionType string + +const ( + // FirewallPolicyFilterRuleCollectionActionTypeAllow ... + FirewallPolicyFilterRuleCollectionActionTypeAllow FirewallPolicyFilterRuleCollectionActionType = "Allow" + // FirewallPolicyFilterRuleCollectionActionTypeDeny ... + FirewallPolicyFilterRuleCollectionActionTypeDeny FirewallPolicyFilterRuleCollectionActionType = "Deny" +) + +// PossibleFirewallPolicyFilterRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyFilterRuleCollectionActionType const type. +func PossibleFirewallPolicyFilterRuleCollectionActionTypeValues() []FirewallPolicyFilterRuleCollectionActionType { + return []FirewallPolicyFilterRuleCollectionActionType{FirewallPolicyFilterRuleCollectionActionTypeAllow, FirewallPolicyFilterRuleCollectionActionTypeDeny} +} + +// FirewallPolicyIDPSQuerySortOrder enumerates the values for firewall policy idps query sort order. +type FirewallPolicyIDPSQuerySortOrder string + +const ( + // FirewallPolicyIDPSQuerySortOrderAscending ... + FirewallPolicyIDPSQuerySortOrderAscending FirewallPolicyIDPSQuerySortOrder = "Ascending" + // FirewallPolicyIDPSQuerySortOrderDescending ... + FirewallPolicyIDPSQuerySortOrderDescending FirewallPolicyIDPSQuerySortOrder = "Descending" +) + +// PossibleFirewallPolicyIDPSQuerySortOrderValues returns an array of possible values for the FirewallPolicyIDPSQuerySortOrder const type. +func PossibleFirewallPolicyIDPSQuerySortOrderValues() []FirewallPolicyIDPSQuerySortOrder { + return []FirewallPolicyIDPSQuerySortOrder{FirewallPolicyIDPSQuerySortOrderAscending, FirewallPolicyIDPSQuerySortOrderDescending} +} + +// FirewallPolicyIntrusionDetectionProtocol enumerates the values for firewall policy intrusion detection +// protocol. +type FirewallPolicyIntrusionDetectionProtocol string + +const ( + // FirewallPolicyIntrusionDetectionProtocolANY ... + FirewallPolicyIntrusionDetectionProtocolANY FirewallPolicyIntrusionDetectionProtocol = "ANY" + // FirewallPolicyIntrusionDetectionProtocolICMP ... + FirewallPolicyIntrusionDetectionProtocolICMP FirewallPolicyIntrusionDetectionProtocol = "ICMP" + // FirewallPolicyIntrusionDetectionProtocolTCP ... + FirewallPolicyIntrusionDetectionProtocolTCP FirewallPolicyIntrusionDetectionProtocol = "TCP" + // FirewallPolicyIntrusionDetectionProtocolUDP ... + FirewallPolicyIntrusionDetectionProtocolUDP FirewallPolicyIntrusionDetectionProtocol = "UDP" +) + +// PossibleFirewallPolicyIntrusionDetectionProtocolValues returns an array of possible values for the FirewallPolicyIntrusionDetectionProtocol const type. +func PossibleFirewallPolicyIntrusionDetectionProtocolValues() []FirewallPolicyIntrusionDetectionProtocol { + return []FirewallPolicyIntrusionDetectionProtocol{FirewallPolicyIntrusionDetectionProtocolANY, FirewallPolicyIntrusionDetectionProtocolICMP, FirewallPolicyIntrusionDetectionProtocolTCP, FirewallPolicyIntrusionDetectionProtocolUDP} +} + +// FirewallPolicyIntrusionDetectionStateType enumerates the values for firewall policy intrusion detection +// state type. +type FirewallPolicyIntrusionDetectionStateType string + +const ( + // FirewallPolicyIntrusionDetectionStateTypeAlert ... + FirewallPolicyIntrusionDetectionStateTypeAlert FirewallPolicyIntrusionDetectionStateType = "Alert" + // FirewallPolicyIntrusionDetectionStateTypeDeny ... + FirewallPolicyIntrusionDetectionStateTypeDeny FirewallPolicyIntrusionDetectionStateType = "Deny" + // FirewallPolicyIntrusionDetectionStateTypeOff ... + FirewallPolicyIntrusionDetectionStateTypeOff FirewallPolicyIntrusionDetectionStateType = "Off" +) + +// PossibleFirewallPolicyIntrusionDetectionStateTypeValues returns an array of possible values for the FirewallPolicyIntrusionDetectionStateType const type. +func PossibleFirewallPolicyIntrusionDetectionStateTypeValues() []FirewallPolicyIntrusionDetectionStateType { + return []FirewallPolicyIntrusionDetectionStateType{FirewallPolicyIntrusionDetectionStateTypeAlert, FirewallPolicyIntrusionDetectionStateTypeDeny, FirewallPolicyIntrusionDetectionStateTypeOff} +} + +// FirewallPolicyNatRuleCollectionActionType enumerates the values for firewall policy nat rule collection +// action type. +type FirewallPolicyNatRuleCollectionActionType string + +const ( + // FirewallPolicyNatRuleCollectionActionTypeDNAT ... + FirewallPolicyNatRuleCollectionActionTypeDNAT FirewallPolicyNatRuleCollectionActionType = "DNAT" +) + +// PossibleFirewallPolicyNatRuleCollectionActionTypeValues returns an array of possible values for the FirewallPolicyNatRuleCollectionActionType const type. +func PossibleFirewallPolicyNatRuleCollectionActionTypeValues() []FirewallPolicyNatRuleCollectionActionType { + return []FirewallPolicyNatRuleCollectionActionType{FirewallPolicyNatRuleCollectionActionTypeDNAT} +} + +// FirewallPolicyRuleApplicationProtocolType enumerates the values for firewall policy rule application +// protocol type. +type FirewallPolicyRuleApplicationProtocolType string + +const ( + // FirewallPolicyRuleApplicationProtocolTypeHTTP ... + FirewallPolicyRuleApplicationProtocolTypeHTTP FirewallPolicyRuleApplicationProtocolType = "Http" + // FirewallPolicyRuleApplicationProtocolTypeHTTPS ... + FirewallPolicyRuleApplicationProtocolTypeHTTPS FirewallPolicyRuleApplicationProtocolType = "Https" +) + +// PossibleFirewallPolicyRuleApplicationProtocolTypeValues returns an array of possible values for the FirewallPolicyRuleApplicationProtocolType const type. +func PossibleFirewallPolicyRuleApplicationProtocolTypeValues() []FirewallPolicyRuleApplicationProtocolType { + return []FirewallPolicyRuleApplicationProtocolType{FirewallPolicyRuleApplicationProtocolTypeHTTP, FirewallPolicyRuleApplicationProtocolTypeHTTPS} +} + +// FirewallPolicyRuleNetworkProtocol enumerates the values for firewall policy rule network protocol. +type FirewallPolicyRuleNetworkProtocol string + +const ( + // FirewallPolicyRuleNetworkProtocolAny ... + FirewallPolicyRuleNetworkProtocolAny FirewallPolicyRuleNetworkProtocol = "Any" + // FirewallPolicyRuleNetworkProtocolICMP ... + FirewallPolicyRuleNetworkProtocolICMP FirewallPolicyRuleNetworkProtocol = "ICMP" + // FirewallPolicyRuleNetworkProtocolTCP ... + FirewallPolicyRuleNetworkProtocolTCP FirewallPolicyRuleNetworkProtocol = "TCP" + // FirewallPolicyRuleNetworkProtocolUDP ... + FirewallPolicyRuleNetworkProtocolUDP FirewallPolicyRuleNetworkProtocol = "UDP" +) + +// PossibleFirewallPolicyRuleNetworkProtocolValues returns an array of possible values for the FirewallPolicyRuleNetworkProtocol const type. +func PossibleFirewallPolicyRuleNetworkProtocolValues() []FirewallPolicyRuleNetworkProtocol { + return []FirewallPolicyRuleNetworkProtocol{FirewallPolicyRuleNetworkProtocolAny, FirewallPolicyRuleNetworkProtocolICMP, FirewallPolicyRuleNetworkProtocolTCP, FirewallPolicyRuleNetworkProtocolUDP} +} + +// FirewallPolicySkuTier enumerates the values for firewall policy sku tier. +type FirewallPolicySkuTier string + +const ( + // FirewallPolicySkuTierBasic ... + FirewallPolicySkuTierBasic FirewallPolicySkuTier = "Basic" + // FirewallPolicySkuTierPremium ... + FirewallPolicySkuTierPremium FirewallPolicySkuTier = "Premium" + // FirewallPolicySkuTierStandard ... + FirewallPolicySkuTierStandard FirewallPolicySkuTier = "Standard" +) + +// PossibleFirewallPolicySkuTierValues returns an array of possible values for the FirewallPolicySkuTier const type. +func PossibleFirewallPolicySkuTierValues() []FirewallPolicySkuTier { + return []FirewallPolicySkuTier{FirewallPolicySkuTierBasic, FirewallPolicySkuTierPremium, FirewallPolicySkuTierStandard} +} + +// FlowLogFormatType enumerates the values for flow log format type. +type FlowLogFormatType string + +const ( + // FlowLogFormatTypeJSON ... + FlowLogFormatTypeJSON FlowLogFormatType = "JSON" +) + +// PossibleFlowLogFormatTypeValues returns an array of possible values for the FlowLogFormatType const type. +func PossibleFlowLogFormatTypeValues() []FlowLogFormatType { + return []FlowLogFormatType{FlowLogFormatTypeJSON} +} + +// GatewayLoadBalancerTunnelInterfaceType enumerates the values for gateway load balancer tunnel interface +// type. +type GatewayLoadBalancerTunnelInterfaceType string + +const ( + // GatewayLoadBalancerTunnelInterfaceTypeExternal ... + GatewayLoadBalancerTunnelInterfaceTypeExternal GatewayLoadBalancerTunnelInterfaceType = "External" + // GatewayLoadBalancerTunnelInterfaceTypeInternal ... + GatewayLoadBalancerTunnelInterfaceTypeInternal GatewayLoadBalancerTunnelInterfaceType = "Internal" + // GatewayLoadBalancerTunnelInterfaceTypeNone ... + GatewayLoadBalancerTunnelInterfaceTypeNone GatewayLoadBalancerTunnelInterfaceType = "None" +) + +// PossibleGatewayLoadBalancerTunnelInterfaceTypeValues returns an array of possible values for the GatewayLoadBalancerTunnelInterfaceType const type. +func PossibleGatewayLoadBalancerTunnelInterfaceTypeValues() []GatewayLoadBalancerTunnelInterfaceType { + return []GatewayLoadBalancerTunnelInterfaceType{GatewayLoadBalancerTunnelInterfaceTypeExternal, GatewayLoadBalancerTunnelInterfaceTypeInternal, GatewayLoadBalancerTunnelInterfaceTypeNone} +} + +// GatewayLoadBalancerTunnelProtocol enumerates the values for gateway load balancer tunnel protocol. +type GatewayLoadBalancerTunnelProtocol string + +const ( + // GatewayLoadBalancerTunnelProtocolNative ... + GatewayLoadBalancerTunnelProtocolNative GatewayLoadBalancerTunnelProtocol = "Native" + // GatewayLoadBalancerTunnelProtocolNone ... + GatewayLoadBalancerTunnelProtocolNone GatewayLoadBalancerTunnelProtocol = "None" + // GatewayLoadBalancerTunnelProtocolVXLAN ... + GatewayLoadBalancerTunnelProtocolVXLAN GatewayLoadBalancerTunnelProtocol = "VXLAN" +) + +// PossibleGatewayLoadBalancerTunnelProtocolValues returns an array of possible values for the GatewayLoadBalancerTunnelProtocol const type. +func PossibleGatewayLoadBalancerTunnelProtocolValues() []GatewayLoadBalancerTunnelProtocol { + return []GatewayLoadBalancerTunnelProtocol{GatewayLoadBalancerTunnelProtocolNative, GatewayLoadBalancerTunnelProtocolNone, GatewayLoadBalancerTunnelProtocolVXLAN} +} + +// HTTPConfigurationMethod enumerates the values for http configuration method. +type HTTPConfigurationMethod string + +const ( + // HTTPConfigurationMethodGet ... + HTTPConfigurationMethodGet HTTPConfigurationMethod = "Get" + // HTTPConfigurationMethodPost ... + HTTPConfigurationMethodPost HTTPConfigurationMethod = "Post" +) + +// PossibleHTTPConfigurationMethodValues returns an array of possible values for the HTTPConfigurationMethod const type. +func PossibleHTTPConfigurationMethodValues() []HTTPConfigurationMethod { + return []HTTPConfigurationMethod{HTTPConfigurationMethodGet, HTTPConfigurationMethodPost} +} + +// HTTPMethod enumerates the values for http method. +type HTTPMethod string + +const ( + // HTTPMethodGet ... + HTTPMethodGet HTTPMethod = "Get" +) + +// PossibleHTTPMethodValues returns an array of possible values for the HTTPMethod const type. +func PossibleHTTPMethodValues() []HTTPMethod { + return []HTTPMethod{HTTPMethodGet} +} + +// HubBgpConnectionStatus enumerates the values for hub bgp connection status. +type HubBgpConnectionStatus string + +const ( + // HubBgpConnectionStatusConnected ... + HubBgpConnectionStatusConnected HubBgpConnectionStatus = "Connected" + // HubBgpConnectionStatusConnecting ... + HubBgpConnectionStatusConnecting HubBgpConnectionStatus = "Connecting" + // HubBgpConnectionStatusNotConnected ... + HubBgpConnectionStatusNotConnected HubBgpConnectionStatus = "NotConnected" + // HubBgpConnectionStatusUnknown ... + HubBgpConnectionStatusUnknown HubBgpConnectionStatus = "Unknown" +) + +// PossibleHubBgpConnectionStatusValues returns an array of possible values for the HubBgpConnectionStatus const type. +func PossibleHubBgpConnectionStatusValues() []HubBgpConnectionStatus { + return []HubBgpConnectionStatus{HubBgpConnectionStatusConnected, HubBgpConnectionStatusConnecting, HubBgpConnectionStatusNotConnected, HubBgpConnectionStatusUnknown} +} + +// HubRoutingPreference enumerates the values for hub routing preference. +type HubRoutingPreference string + +const ( + // HubRoutingPreferenceASPath ... + HubRoutingPreferenceASPath HubRoutingPreference = "ASPath" + // HubRoutingPreferenceExpressRoute ... + HubRoutingPreferenceExpressRoute HubRoutingPreference = "ExpressRoute" + // HubRoutingPreferenceVpnGateway ... + HubRoutingPreferenceVpnGateway HubRoutingPreference = "VpnGateway" +) + +// PossibleHubRoutingPreferenceValues returns an array of possible values for the HubRoutingPreference const type. +func PossibleHubRoutingPreferenceValues() []HubRoutingPreference { + return []HubRoutingPreference{HubRoutingPreferenceASPath, HubRoutingPreferenceExpressRoute, HubRoutingPreferenceVpnGateway} +} + +// HubVirtualNetworkConnectionStatus enumerates the values for hub virtual network connection status. +type HubVirtualNetworkConnectionStatus string + +const ( + // HubVirtualNetworkConnectionStatusConnected ... + HubVirtualNetworkConnectionStatusConnected HubVirtualNetworkConnectionStatus = "Connected" + // HubVirtualNetworkConnectionStatusConnecting ... + HubVirtualNetworkConnectionStatusConnecting HubVirtualNetworkConnectionStatus = "Connecting" + // HubVirtualNetworkConnectionStatusNotConnected ... + HubVirtualNetworkConnectionStatusNotConnected HubVirtualNetworkConnectionStatus = "NotConnected" + // HubVirtualNetworkConnectionStatusUnknown ... + HubVirtualNetworkConnectionStatusUnknown HubVirtualNetworkConnectionStatus = "Unknown" +) + +// PossibleHubVirtualNetworkConnectionStatusValues returns an array of possible values for the HubVirtualNetworkConnectionStatus const type. +func PossibleHubVirtualNetworkConnectionStatusValues() []HubVirtualNetworkConnectionStatus { + return []HubVirtualNetworkConnectionStatus{HubVirtualNetworkConnectionStatusConnected, HubVirtualNetworkConnectionStatusConnecting, HubVirtualNetworkConnectionStatusNotConnected, HubVirtualNetworkConnectionStatusUnknown} +} + +// IkeEncryption enumerates the values for ike encryption. +type IkeEncryption string + +const ( + // IkeEncryptionAES128 ... + IkeEncryptionAES128 IkeEncryption = "AES128" + // IkeEncryptionAES192 ... + IkeEncryptionAES192 IkeEncryption = "AES192" + // IkeEncryptionAES256 ... + IkeEncryptionAES256 IkeEncryption = "AES256" + // IkeEncryptionDES ... + IkeEncryptionDES IkeEncryption = "DES" + // IkeEncryptionDES3 ... + IkeEncryptionDES3 IkeEncryption = "DES3" + // IkeEncryptionGCMAES128 ... + IkeEncryptionGCMAES128 IkeEncryption = "GCMAES128" + // IkeEncryptionGCMAES256 ... + IkeEncryptionGCMAES256 IkeEncryption = "GCMAES256" +) + +// PossibleIkeEncryptionValues returns an array of possible values for the IkeEncryption const type. +func PossibleIkeEncryptionValues() []IkeEncryption { + return []IkeEncryption{IkeEncryptionAES128, IkeEncryptionAES192, IkeEncryptionAES256, IkeEncryptionDES, IkeEncryptionDES3, IkeEncryptionGCMAES128, IkeEncryptionGCMAES256} +} + +// IkeIntegrity enumerates the values for ike integrity. +type IkeIntegrity string + +const ( + // IkeIntegrityGCMAES128 ... + IkeIntegrityGCMAES128 IkeIntegrity = "GCMAES128" + // IkeIntegrityGCMAES256 ... + IkeIntegrityGCMAES256 IkeIntegrity = "GCMAES256" + // IkeIntegrityMD5 ... + IkeIntegrityMD5 IkeIntegrity = "MD5" + // IkeIntegritySHA1 ... + IkeIntegritySHA1 IkeIntegrity = "SHA1" + // IkeIntegritySHA256 ... + IkeIntegritySHA256 IkeIntegrity = "SHA256" + // IkeIntegritySHA384 ... + IkeIntegritySHA384 IkeIntegrity = "SHA384" +) + +// PossibleIkeIntegrityValues returns an array of possible values for the IkeIntegrity const type. +func PossibleIkeIntegrityValues() []IkeIntegrity { + return []IkeIntegrity{IkeIntegrityGCMAES128, IkeIntegrityGCMAES256, IkeIntegrityMD5, IkeIntegritySHA1, IkeIntegritySHA256, IkeIntegritySHA384} +} + +// InboundSecurityRulesProtocol enumerates the values for inbound security rules protocol. +type InboundSecurityRulesProtocol string + +const ( + // InboundSecurityRulesProtocolTCP ... + InboundSecurityRulesProtocolTCP InboundSecurityRulesProtocol = "TCP" + // InboundSecurityRulesProtocolUDP ... + InboundSecurityRulesProtocolUDP InboundSecurityRulesProtocol = "UDP" +) + +// PossibleInboundSecurityRulesProtocolValues returns an array of possible values for the InboundSecurityRulesProtocol const type. +func PossibleInboundSecurityRulesProtocolValues() []InboundSecurityRulesProtocol { + return []InboundSecurityRulesProtocol{InboundSecurityRulesProtocolTCP, InboundSecurityRulesProtocolUDP} +} + +// InterfaceAuxiliaryMode enumerates the values for interface auxiliary mode. +type InterfaceAuxiliaryMode string + +const ( + // InterfaceAuxiliaryModeFloating ... + InterfaceAuxiliaryModeFloating InterfaceAuxiliaryMode = "Floating" + // InterfaceAuxiliaryModeMaxConnections ... + InterfaceAuxiliaryModeMaxConnections InterfaceAuxiliaryMode = "MaxConnections" + // InterfaceAuxiliaryModeNone ... + InterfaceAuxiliaryModeNone InterfaceAuxiliaryMode = "None" +) + +// PossibleInterfaceAuxiliaryModeValues returns an array of possible values for the InterfaceAuxiliaryMode const type. +func PossibleInterfaceAuxiliaryModeValues() []InterfaceAuxiliaryMode { + return []InterfaceAuxiliaryMode{InterfaceAuxiliaryModeFloating, InterfaceAuxiliaryModeMaxConnections, InterfaceAuxiliaryModeNone} +} + +// InterfaceMigrationPhase enumerates the values for interface migration phase. +type InterfaceMigrationPhase string + +const ( + // InterfaceMigrationPhaseAbort ... + InterfaceMigrationPhaseAbort InterfaceMigrationPhase = "Abort" + // InterfaceMigrationPhaseCommit ... + InterfaceMigrationPhaseCommit InterfaceMigrationPhase = "Commit" + // InterfaceMigrationPhaseCommitted ... + InterfaceMigrationPhaseCommitted InterfaceMigrationPhase = "Committed" + // InterfaceMigrationPhaseNone ... + InterfaceMigrationPhaseNone InterfaceMigrationPhase = "None" + // InterfaceMigrationPhasePrepare ... + InterfaceMigrationPhasePrepare InterfaceMigrationPhase = "Prepare" +) + +// PossibleInterfaceMigrationPhaseValues returns an array of possible values for the InterfaceMigrationPhase const type. +func PossibleInterfaceMigrationPhaseValues() []InterfaceMigrationPhase { + return []InterfaceMigrationPhase{InterfaceMigrationPhaseAbort, InterfaceMigrationPhaseCommit, InterfaceMigrationPhaseCommitted, InterfaceMigrationPhaseNone, InterfaceMigrationPhasePrepare} +} + +// InterfaceNicType enumerates the values for interface nic type. +type InterfaceNicType string + +const ( + // InterfaceNicTypeElastic ... + InterfaceNicTypeElastic InterfaceNicType = "Elastic" + // InterfaceNicTypeStandard ... + InterfaceNicTypeStandard InterfaceNicType = "Standard" +) + +// PossibleInterfaceNicTypeValues returns an array of possible values for the InterfaceNicType const type. +func PossibleInterfaceNicTypeValues() []InterfaceNicType { + return []InterfaceNicType{InterfaceNicTypeElastic, InterfaceNicTypeStandard} +} + +// IPAllocationMethod enumerates the values for ip allocation method. +type IPAllocationMethod string + +const ( + // IPAllocationMethodDynamic ... + IPAllocationMethodDynamic IPAllocationMethod = "Dynamic" + // IPAllocationMethodStatic ... + IPAllocationMethodStatic IPAllocationMethod = "Static" +) + +// PossibleIPAllocationMethodValues returns an array of possible values for the IPAllocationMethod const type. +func PossibleIPAllocationMethodValues() []IPAllocationMethod { + return []IPAllocationMethod{IPAllocationMethodDynamic, IPAllocationMethodStatic} +} + +// IPAllocationType enumerates the values for ip allocation type. +type IPAllocationType string + +const ( + // IPAllocationTypeHypernet ... + IPAllocationTypeHypernet IPAllocationType = "Hypernet" + // IPAllocationTypeUndefined ... + IPAllocationTypeUndefined IPAllocationType = "Undefined" +) + +// PossibleIPAllocationTypeValues returns an array of possible values for the IPAllocationType const type. +func PossibleIPAllocationTypeValues() []IPAllocationType { + return []IPAllocationType{IPAllocationTypeHypernet, IPAllocationTypeUndefined} +} + +// IPFlowProtocol enumerates the values for ip flow protocol. +type IPFlowProtocol string + +const ( + // IPFlowProtocolTCP ... + IPFlowProtocolTCP IPFlowProtocol = "TCP" + // IPFlowProtocolUDP ... + IPFlowProtocolUDP IPFlowProtocol = "UDP" +) + +// PossibleIPFlowProtocolValues returns an array of possible values for the IPFlowProtocol const type. +func PossibleIPFlowProtocolValues() []IPFlowProtocol { + return []IPFlowProtocol{IPFlowProtocolTCP, IPFlowProtocolUDP} +} + +// IpsecEncryption enumerates the values for ipsec encryption. +type IpsecEncryption string + +const ( + // IpsecEncryptionAES128 ... + IpsecEncryptionAES128 IpsecEncryption = "AES128" + // IpsecEncryptionAES192 ... + IpsecEncryptionAES192 IpsecEncryption = "AES192" + // IpsecEncryptionAES256 ... + IpsecEncryptionAES256 IpsecEncryption = "AES256" + // IpsecEncryptionDES ... + IpsecEncryptionDES IpsecEncryption = "DES" + // IpsecEncryptionDES3 ... + IpsecEncryptionDES3 IpsecEncryption = "DES3" + // IpsecEncryptionGCMAES128 ... + IpsecEncryptionGCMAES128 IpsecEncryption = "GCMAES128" + // IpsecEncryptionGCMAES192 ... + IpsecEncryptionGCMAES192 IpsecEncryption = "GCMAES192" + // IpsecEncryptionGCMAES256 ... + IpsecEncryptionGCMAES256 IpsecEncryption = "GCMAES256" + // IpsecEncryptionNone ... + IpsecEncryptionNone IpsecEncryption = "None" +) + +// PossibleIpsecEncryptionValues returns an array of possible values for the IpsecEncryption const type. +func PossibleIpsecEncryptionValues() []IpsecEncryption { + return []IpsecEncryption{IpsecEncryptionAES128, IpsecEncryptionAES192, IpsecEncryptionAES256, IpsecEncryptionDES, IpsecEncryptionDES3, IpsecEncryptionGCMAES128, IpsecEncryptionGCMAES192, IpsecEncryptionGCMAES256, IpsecEncryptionNone} +} + +// IpsecIntegrity enumerates the values for ipsec integrity. +type IpsecIntegrity string + +const ( + // IpsecIntegrityGCMAES128 ... + IpsecIntegrityGCMAES128 IpsecIntegrity = "GCMAES128" + // IpsecIntegrityGCMAES192 ... + IpsecIntegrityGCMAES192 IpsecIntegrity = "GCMAES192" + // IpsecIntegrityGCMAES256 ... + IpsecIntegrityGCMAES256 IpsecIntegrity = "GCMAES256" + // IpsecIntegrityMD5 ... + IpsecIntegrityMD5 IpsecIntegrity = "MD5" + // IpsecIntegritySHA1 ... + IpsecIntegritySHA1 IpsecIntegrity = "SHA1" + // IpsecIntegritySHA256 ... + IpsecIntegritySHA256 IpsecIntegrity = "SHA256" +) + +// PossibleIpsecIntegrityValues returns an array of possible values for the IpsecIntegrity const type. +func PossibleIpsecIntegrityValues() []IpsecIntegrity { + return []IpsecIntegrity{IpsecIntegrityGCMAES128, IpsecIntegrityGCMAES192, IpsecIntegrityGCMAES256, IpsecIntegrityMD5, IpsecIntegritySHA1, IpsecIntegritySHA256} +} + +// IPVersion enumerates the values for ip version. +type IPVersion string + +const ( + // IPVersionIPv4 ... + IPVersionIPv4 IPVersion = "IPv4" + // IPVersionIPv6 ... + IPVersionIPv6 IPVersion = "IPv6" +) + +// PossibleIPVersionValues returns an array of possible values for the IPVersion const type. +func PossibleIPVersionValues() []IPVersion { + return []IPVersion{IPVersionIPv4, IPVersionIPv6} +} + +// IssueType enumerates the values for issue type. +type IssueType string + +const ( + // IssueTypeAgentStopped ... + IssueTypeAgentStopped IssueType = "AgentStopped" + // IssueTypeDNSResolution ... + IssueTypeDNSResolution IssueType = "DnsResolution" + // IssueTypeGuestFirewall ... + IssueTypeGuestFirewall IssueType = "GuestFirewall" + // IssueTypeNetworkSecurityRule ... + IssueTypeNetworkSecurityRule IssueType = "NetworkSecurityRule" + // IssueTypePlatform ... + IssueTypePlatform IssueType = "Platform" + // IssueTypePortThrottled ... + IssueTypePortThrottled IssueType = "PortThrottled" + // IssueTypeSocketBind ... + IssueTypeSocketBind IssueType = "SocketBind" + // IssueTypeUnknown ... + IssueTypeUnknown IssueType = "Unknown" + // IssueTypeUserDefinedRoute ... + IssueTypeUserDefinedRoute IssueType = "UserDefinedRoute" +) + +// PossibleIssueTypeValues returns an array of possible values for the IssueType const type. +func PossibleIssueTypeValues() []IssueType { + return []IssueType{IssueTypeAgentStopped, IssueTypeDNSResolution, IssueTypeGuestFirewall, IssueTypeNetworkSecurityRule, IssueTypePlatform, IssueTypePortThrottled, IssueTypeSocketBind, IssueTypeUnknown, IssueTypeUserDefinedRoute} +} + +// LoadBalancerBackendAddressAdminState enumerates the values for load balancer backend address admin state. +type LoadBalancerBackendAddressAdminState string + +const ( + // LoadBalancerBackendAddressAdminStateDown ... + LoadBalancerBackendAddressAdminStateDown LoadBalancerBackendAddressAdminState = "Down" + // LoadBalancerBackendAddressAdminStateDrain ... + LoadBalancerBackendAddressAdminStateDrain LoadBalancerBackendAddressAdminState = "Drain" + // LoadBalancerBackendAddressAdminStateNone ... + LoadBalancerBackendAddressAdminStateNone LoadBalancerBackendAddressAdminState = "None" + // LoadBalancerBackendAddressAdminStateUp ... + LoadBalancerBackendAddressAdminStateUp LoadBalancerBackendAddressAdminState = "Up" +) + +// PossibleLoadBalancerBackendAddressAdminStateValues returns an array of possible values for the LoadBalancerBackendAddressAdminState const type. +func PossibleLoadBalancerBackendAddressAdminStateValues() []LoadBalancerBackendAddressAdminState { + return []LoadBalancerBackendAddressAdminState{LoadBalancerBackendAddressAdminStateDown, LoadBalancerBackendAddressAdminStateDrain, LoadBalancerBackendAddressAdminStateNone, LoadBalancerBackendAddressAdminStateUp} +} + +// LoadBalancerOutboundRuleProtocol enumerates the values for load balancer outbound rule protocol. +type LoadBalancerOutboundRuleProtocol string + +const ( + // LoadBalancerOutboundRuleProtocolAll ... + LoadBalancerOutboundRuleProtocolAll LoadBalancerOutboundRuleProtocol = "All" + // LoadBalancerOutboundRuleProtocolTCP ... + LoadBalancerOutboundRuleProtocolTCP LoadBalancerOutboundRuleProtocol = "Tcp" + // LoadBalancerOutboundRuleProtocolUDP ... + LoadBalancerOutboundRuleProtocolUDP LoadBalancerOutboundRuleProtocol = "Udp" +) + +// PossibleLoadBalancerOutboundRuleProtocolValues returns an array of possible values for the LoadBalancerOutboundRuleProtocol const type. +func PossibleLoadBalancerOutboundRuleProtocolValues() []LoadBalancerOutboundRuleProtocol { + return []LoadBalancerOutboundRuleProtocol{LoadBalancerOutboundRuleProtocolAll, LoadBalancerOutboundRuleProtocolTCP, LoadBalancerOutboundRuleProtocolUDP} +} + +// LoadBalancerSkuName enumerates the values for load balancer sku name. +type LoadBalancerSkuName string + +const ( + // LoadBalancerSkuNameBasic ... + LoadBalancerSkuNameBasic LoadBalancerSkuName = "Basic" + // LoadBalancerSkuNameGateway ... + LoadBalancerSkuNameGateway LoadBalancerSkuName = "Gateway" + // LoadBalancerSkuNameStandard ... + LoadBalancerSkuNameStandard LoadBalancerSkuName = "Standard" +) + +// PossibleLoadBalancerSkuNameValues returns an array of possible values for the LoadBalancerSkuName const type. +func PossibleLoadBalancerSkuNameValues() []LoadBalancerSkuName { + return []LoadBalancerSkuName{LoadBalancerSkuNameBasic, LoadBalancerSkuNameGateway, LoadBalancerSkuNameStandard} +} + +// LoadBalancerSkuTier enumerates the values for load balancer sku tier. +type LoadBalancerSkuTier string + +const ( + // LoadBalancerSkuTierGlobal ... + LoadBalancerSkuTierGlobal LoadBalancerSkuTier = "Global" + // LoadBalancerSkuTierRegional ... + LoadBalancerSkuTierRegional LoadBalancerSkuTier = "Regional" +) + +// PossibleLoadBalancerSkuTierValues returns an array of possible values for the LoadBalancerSkuTier const type. +func PossibleLoadBalancerSkuTierValues() []LoadBalancerSkuTier { + return []LoadBalancerSkuTier{LoadBalancerSkuTierGlobal, LoadBalancerSkuTierRegional} +} + +// LoadDistribution enumerates the values for load distribution. +type LoadDistribution string + +const ( + // LoadDistributionDefault ... + LoadDistributionDefault LoadDistribution = "Default" + // LoadDistributionSourceIP ... + LoadDistributionSourceIP LoadDistribution = "SourceIP" + // LoadDistributionSourceIPProtocol ... + LoadDistributionSourceIPProtocol LoadDistribution = "SourceIPProtocol" +) + +// PossibleLoadDistributionValues returns an array of possible values for the LoadDistribution const type. +func PossibleLoadDistributionValues() []LoadDistribution { + return []LoadDistribution{LoadDistributionDefault, LoadDistributionSourceIP, LoadDistributionSourceIPProtocol} +} + +// ManagedRuleEnabledState enumerates the values for managed rule enabled state. +type ManagedRuleEnabledState string + +const ( + // ManagedRuleEnabledStateDisabled ... + ManagedRuleEnabledStateDisabled ManagedRuleEnabledState = "Disabled" +) + +// PossibleManagedRuleEnabledStateValues returns an array of possible values for the ManagedRuleEnabledState const type. +func PossibleManagedRuleEnabledStateValues() []ManagedRuleEnabledState { + return []ManagedRuleEnabledState{ManagedRuleEnabledStateDisabled} +} + +// NatGatewaySkuName enumerates the values for nat gateway sku name. +type NatGatewaySkuName string + +const ( + // NatGatewaySkuNameStandard ... + NatGatewaySkuNameStandard NatGatewaySkuName = "Standard" +) + +// PossibleNatGatewaySkuNameValues returns an array of possible values for the NatGatewaySkuName const type. +func PossibleNatGatewaySkuNameValues() []NatGatewaySkuName { + return []NatGatewaySkuName{NatGatewaySkuNameStandard} +} + +// NextHopType enumerates the values for next hop type. +type NextHopType string + +const ( + // NextHopTypeHyperNetGateway ... + NextHopTypeHyperNetGateway NextHopType = "HyperNetGateway" + // NextHopTypeInternet ... + NextHopTypeInternet NextHopType = "Internet" + // NextHopTypeNone ... + NextHopTypeNone NextHopType = "None" + // NextHopTypeVirtualAppliance ... + NextHopTypeVirtualAppliance NextHopType = "VirtualAppliance" + // NextHopTypeVirtualNetworkGateway ... + NextHopTypeVirtualNetworkGateway NextHopType = "VirtualNetworkGateway" + // NextHopTypeVnetLocal ... + NextHopTypeVnetLocal NextHopType = "VnetLocal" +) + +// PossibleNextHopTypeValues returns an array of possible values for the NextHopType const type. +func PossibleNextHopTypeValues() []NextHopType { + return []NextHopType{NextHopTypeHyperNetGateway, NextHopTypeInternet, NextHopTypeNone, NextHopTypeVirtualAppliance, NextHopTypeVirtualNetworkGateway, NextHopTypeVnetLocal} +} + +// OfficeTrafficCategory enumerates the values for office traffic category. +type OfficeTrafficCategory string + +const ( + // OfficeTrafficCategoryAll ... + OfficeTrafficCategoryAll OfficeTrafficCategory = "All" + // OfficeTrafficCategoryNone ... + OfficeTrafficCategoryNone OfficeTrafficCategory = "None" + // OfficeTrafficCategoryOptimize ... + OfficeTrafficCategoryOptimize OfficeTrafficCategory = "Optimize" + // OfficeTrafficCategoryOptimizeAndAllow ... + OfficeTrafficCategoryOptimizeAndAllow OfficeTrafficCategory = "OptimizeAndAllow" +) + +// PossibleOfficeTrafficCategoryValues returns an array of possible values for the OfficeTrafficCategory const type. +func PossibleOfficeTrafficCategoryValues() []OfficeTrafficCategory { + return []OfficeTrafficCategory{OfficeTrafficCategoryAll, OfficeTrafficCategoryNone, OfficeTrafficCategoryOptimize, OfficeTrafficCategoryOptimizeAndAllow} +} + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusFailed ... + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusInProgress ... + OperationStatusInProgress OperationStatus = "InProgress" + // OperationStatusSucceeded ... + OperationStatusSucceeded OperationStatus = "Succeeded" +) + +// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{OperationStatusFailed, OperationStatusInProgress, OperationStatusSucceeded} +} + +// Origin enumerates the values for origin. +type Origin string + +const ( + // OriginInbound ... + OriginInbound Origin = "Inbound" + // OriginLocal ... + OriginLocal Origin = "Local" + // OriginOutbound ... + OriginOutbound Origin = "Outbound" +) + +// PossibleOriginValues returns an array of possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{OriginInbound, OriginLocal, OriginOutbound} +} + +// OutputType enumerates the values for output type. +type OutputType string + +const ( + // OutputTypeWorkspace ... + OutputTypeWorkspace OutputType = "Workspace" +) + +// PossibleOutputTypeValues returns an array of possible values for the OutputType const type. +func PossibleOutputTypeValues() []OutputType { + return []OutputType{OutputTypeWorkspace} +} + +// OwaspCrsExclusionEntryMatchVariable enumerates the values for owasp crs exclusion entry match variable. +type OwaspCrsExclusionEntryMatchVariable string + +const ( + // OwaspCrsExclusionEntryMatchVariableRequestArgKeys ... + OwaspCrsExclusionEntryMatchVariableRequestArgKeys OwaspCrsExclusionEntryMatchVariable = "RequestArgKeys" + // OwaspCrsExclusionEntryMatchVariableRequestArgNames ... + OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" + // OwaspCrsExclusionEntryMatchVariableRequestArgValues ... + OwaspCrsExclusionEntryMatchVariableRequestArgValues OwaspCrsExclusionEntryMatchVariable = "RequestArgValues" + // OwaspCrsExclusionEntryMatchVariableRequestCookieKeys ... + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys OwaspCrsExclusionEntryMatchVariable = "RequestCookieKeys" + // OwaspCrsExclusionEntryMatchVariableRequestCookieNames ... + OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" + // OwaspCrsExclusionEntryMatchVariableRequestCookieValues ... + OwaspCrsExclusionEntryMatchVariableRequestCookieValues OwaspCrsExclusionEntryMatchVariable = "RequestCookieValues" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys OwaspCrsExclusionEntryMatchVariable = "RequestHeaderKeys" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderNames ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" + // OwaspCrsExclusionEntryMatchVariableRequestHeaderValues ... + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues OwaspCrsExclusionEntryMatchVariable = "RequestHeaderValues" +) + +// PossibleOwaspCrsExclusionEntryMatchVariableValues returns an array of possible values for the OwaspCrsExclusionEntryMatchVariable const type. +func PossibleOwaspCrsExclusionEntryMatchVariableValues() []OwaspCrsExclusionEntryMatchVariable { + return []OwaspCrsExclusionEntryMatchVariable{OwaspCrsExclusionEntryMatchVariableRequestArgKeys, OwaspCrsExclusionEntryMatchVariableRequestArgNames, OwaspCrsExclusionEntryMatchVariableRequestArgValues, OwaspCrsExclusionEntryMatchVariableRequestCookieKeys, OwaspCrsExclusionEntryMatchVariableRequestCookieNames, OwaspCrsExclusionEntryMatchVariableRequestCookieValues, OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys, OwaspCrsExclusionEntryMatchVariableRequestHeaderNames, OwaspCrsExclusionEntryMatchVariableRequestHeaderValues} +} + +// OwaspCrsExclusionEntrySelectorMatchOperator enumerates the values for owasp crs exclusion entry selector +// match operator. +type OwaspCrsExclusionEntrySelectorMatchOperator string + +const ( + // OwaspCrsExclusionEntrySelectorMatchOperatorContains ... + OwaspCrsExclusionEntrySelectorMatchOperatorContains OwaspCrsExclusionEntrySelectorMatchOperator = "Contains" + // OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith ... + OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith OwaspCrsExclusionEntrySelectorMatchOperator = "EndsWith" + // OwaspCrsExclusionEntrySelectorMatchOperatorEquals ... + OwaspCrsExclusionEntrySelectorMatchOperatorEquals OwaspCrsExclusionEntrySelectorMatchOperator = "Equals" + // OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny ... + OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny OwaspCrsExclusionEntrySelectorMatchOperator = "EqualsAny" + // OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith ... + OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith OwaspCrsExclusionEntrySelectorMatchOperator = "StartsWith" +) + +// PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues returns an array of possible values for the OwaspCrsExclusionEntrySelectorMatchOperator const type. +func PossibleOwaspCrsExclusionEntrySelectorMatchOperatorValues() []OwaspCrsExclusionEntrySelectorMatchOperator { + return []OwaspCrsExclusionEntrySelectorMatchOperator{OwaspCrsExclusionEntrySelectorMatchOperatorContains, OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith, OwaspCrsExclusionEntrySelectorMatchOperatorEquals, OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny, OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith} +} + +// PcError enumerates the values for pc error. +type PcError string + +const ( + // PcErrorAgentStopped ... + PcErrorAgentStopped PcError = "AgentStopped" + // PcErrorCaptureFailed ... + PcErrorCaptureFailed PcError = "CaptureFailed" + // PcErrorInternalError ... + PcErrorInternalError PcError = "InternalError" + // PcErrorLocalFileFailed ... + PcErrorLocalFileFailed PcError = "LocalFileFailed" + // PcErrorStorageFailed ... + PcErrorStorageFailed PcError = "StorageFailed" +) + +// PossiblePcErrorValues returns an array of possible values for the PcError const type. +func PossiblePcErrorValues() []PcError { + return []PcError{PcErrorAgentStopped, PcErrorCaptureFailed, PcErrorInternalError, PcErrorLocalFileFailed, PcErrorStorageFailed} +} + +// PcProtocol enumerates the values for pc protocol. +type PcProtocol string + +const ( + // PcProtocolAny ... + PcProtocolAny PcProtocol = "Any" + // PcProtocolTCP ... + PcProtocolTCP PcProtocol = "TCP" + // PcProtocolUDP ... + PcProtocolUDP PcProtocol = "UDP" +) + +// PossiblePcProtocolValues returns an array of possible values for the PcProtocol const type. +func PossiblePcProtocolValues() []PcProtocol { + return []PcProtocol{PcProtocolAny, PcProtocolTCP, PcProtocolUDP} +} + +// PcStatus enumerates the values for pc status. +type PcStatus string + +const ( + // PcStatusError ... + PcStatusError PcStatus = "Error" + // PcStatusNotStarted ... + PcStatusNotStarted PcStatus = "NotStarted" + // PcStatusRunning ... + PcStatusRunning PcStatus = "Running" + // PcStatusStopped ... + PcStatusStopped PcStatus = "Stopped" + // PcStatusUnknown ... + PcStatusUnknown PcStatus = "Unknown" +) + +// PossiblePcStatusValues returns an array of possible values for the PcStatus const type. +func PossiblePcStatusValues() []PcStatus { + return []PcStatus{PcStatusError, PcStatusNotStarted, PcStatusRunning, PcStatusStopped, PcStatusUnknown} +} + +// PfsGroup enumerates the values for pfs group. +type PfsGroup string + +const ( + // PfsGroupECP256 ... + PfsGroupECP256 PfsGroup = "ECP256" + // PfsGroupECP384 ... + PfsGroupECP384 PfsGroup = "ECP384" + // PfsGroupNone ... + PfsGroupNone PfsGroup = "None" + // PfsGroupPFS1 ... + PfsGroupPFS1 PfsGroup = "PFS1" + // PfsGroupPFS14 ... + PfsGroupPFS14 PfsGroup = "PFS14" + // PfsGroupPFS2 ... + PfsGroupPFS2 PfsGroup = "PFS2" + // PfsGroupPFS2048 ... + PfsGroupPFS2048 PfsGroup = "PFS2048" + // PfsGroupPFS24 ... + PfsGroupPFS24 PfsGroup = "PFS24" + // PfsGroupPFSMM ... + PfsGroupPFSMM PfsGroup = "PFSMM" +) + +// PossiblePfsGroupValues returns an array of possible values for the PfsGroup const type. +func PossiblePfsGroupValues() []PfsGroup { + return []PfsGroup{PfsGroupECP256, PfsGroupECP384, PfsGroupNone, PfsGroupPFS1, PfsGroupPFS14, PfsGroupPFS2, PfsGroupPFS2048, PfsGroupPFS24, PfsGroupPFSMM} +} + +// PreferredIPVersion enumerates the values for preferred ip version. +type PreferredIPVersion string + +const ( + // PreferredIPVersionIPv4 ... + PreferredIPVersionIPv4 PreferredIPVersion = "IPv4" + // PreferredIPVersionIPv6 ... + PreferredIPVersionIPv6 PreferredIPVersion = "IPv6" +) + +// PossiblePreferredIPVersionValues returns an array of possible values for the PreferredIPVersion const type. +func PossiblePreferredIPVersionValues() []PreferredIPVersion { + return []PreferredIPVersion{PreferredIPVersionIPv4, PreferredIPVersionIPv6} +} + +// PreferredRoutingGateway enumerates the values for preferred routing gateway. +type PreferredRoutingGateway string + +const ( + // PreferredRoutingGatewayExpressRoute ... + PreferredRoutingGatewayExpressRoute PreferredRoutingGateway = "ExpressRoute" + // PreferredRoutingGatewayNone ... + PreferredRoutingGatewayNone PreferredRoutingGateway = "None" + // PreferredRoutingGatewayVpnGateway ... + PreferredRoutingGatewayVpnGateway PreferredRoutingGateway = "VpnGateway" +) + +// PossiblePreferredRoutingGatewayValues returns an array of possible values for the PreferredRoutingGateway const type. +func PossiblePreferredRoutingGatewayValues() []PreferredRoutingGateway { + return []PreferredRoutingGateway{PreferredRoutingGatewayExpressRoute, PreferredRoutingGatewayNone, PreferredRoutingGatewayVpnGateway} +} + +// ProbeProtocol enumerates the values for probe protocol. +type ProbeProtocol string + +const ( + // ProbeProtocolHTTP ... + ProbeProtocolHTTP ProbeProtocol = "Http" + // ProbeProtocolHTTPS ... + ProbeProtocolHTTPS ProbeProtocol = "Https" + // ProbeProtocolTCP ... + ProbeProtocolTCP ProbeProtocol = "Tcp" +) + +// PossibleProbeProtocolValues returns an array of possible values for the ProbeProtocol const type. +func PossibleProbeProtocolValues() []ProbeProtocol { + return []ProbeProtocol{ProbeProtocolHTTP, ProbeProtocolHTTPS, ProbeProtocolTCP} +} + +// ProcessorArchitecture enumerates the values for processor architecture. +type ProcessorArchitecture string + +const ( + // ProcessorArchitectureAmd64 ... + ProcessorArchitectureAmd64 ProcessorArchitecture = "Amd64" + // ProcessorArchitectureX86 ... + ProcessorArchitectureX86 ProcessorArchitecture = "X86" +) + +// PossibleProcessorArchitectureValues returns an array of possible values for the ProcessorArchitecture const type. +func PossibleProcessorArchitectureValues() []ProcessorArchitecture { + return []ProcessorArchitecture{ProcessorArchitectureAmd64, ProcessorArchitectureX86} +} + +// Protocol enumerates the values for protocol. +type Protocol string + +const ( + // ProtocolHTTP ... + ProtocolHTTP Protocol = "Http" + // ProtocolHTTPS ... + ProtocolHTTPS Protocol = "Https" + // ProtocolIcmp ... + ProtocolIcmp Protocol = "Icmp" + // ProtocolTCP ... + ProtocolTCP Protocol = "Tcp" +) + +// PossibleProtocolValues returns an array of possible values for the Protocol const type. +func PossibleProtocolValues() []Protocol { + return []Protocol{ProtocolHTTP, ProtocolHTTPS, ProtocolIcmp, ProtocolTCP} +} + +// ProtocolType enumerates the values for protocol type. +type ProtocolType string + +const ( + // ProtocolTypeAh ... + ProtocolTypeAh ProtocolType = "Ah" + // ProtocolTypeAll ... + ProtocolTypeAll ProtocolType = "All" + // ProtocolTypeDoNotUse ... + ProtocolTypeDoNotUse ProtocolType = "DoNotUse" + // ProtocolTypeEsp ... + ProtocolTypeEsp ProtocolType = "Esp" + // ProtocolTypeGre ... + ProtocolTypeGre ProtocolType = "Gre" + // ProtocolTypeIcmp ... + ProtocolTypeIcmp ProtocolType = "Icmp" + // ProtocolTypeTCP ... + ProtocolTypeTCP ProtocolType = "Tcp" + // ProtocolTypeUDP ... + ProtocolTypeUDP ProtocolType = "Udp" + // ProtocolTypeVxlan ... + ProtocolTypeVxlan ProtocolType = "Vxlan" +) + +// PossibleProtocolTypeValues returns an array of possible values for the ProtocolType const type. +func PossibleProtocolTypeValues() []ProtocolType { + return []ProtocolType{ProtocolTypeAh, ProtocolTypeAll, ProtocolTypeDoNotUse, ProtocolTypeEsp, ProtocolTypeGre, ProtocolTypeIcmp, ProtocolTypeTCP, ProtocolTypeUDP, ProtocolTypeVxlan} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// PublicIPAddressMigrationPhase enumerates the values for public ip address migration phase. +type PublicIPAddressMigrationPhase string + +const ( + // PublicIPAddressMigrationPhaseAbort ... + PublicIPAddressMigrationPhaseAbort PublicIPAddressMigrationPhase = "Abort" + // PublicIPAddressMigrationPhaseCommit ... + PublicIPAddressMigrationPhaseCommit PublicIPAddressMigrationPhase = "Commit" + // PublicIPAddressMigrationPhaseCommitted ... + PublicIPAddressMigrationPhaseCommitted PublicIPAddressMigrationPhase = "Committed" + // PublicIPAddressMigrationPhaseNone ... + PublicIPAddressMigrationPhaseNone PublicIPAddressMigrationPhase = "None" + // PublicIPAddressMigrationPhasePrepare ... + PublicIPAddressMigrationPhasePrepare PublicIPAddressMigrationPhase = "Prepare" +) + +// PossiblePublicIPAddressMigrationPhaseValues returns an array of possible values for the PublicIPAddressMigrationPhase const type. +func PossiblePublicIPAddressMigrationPhaseValues() []PublicIPAddressMigrationPhase { + return []PublicIPAddressMigrationPhase{PublicIPAddressMigrationPhaseAbort, PublicIPAddressMigrationPhaseCommit, PublicIPAddressMigrationPhaseCommitted, PublicIPAddressMigrationPhaseNone, PublicIPAddressMigrationPhasePrepare} +} + +// PublicIPAddressSkuName enumerates the values for public ip address sku name. +type PublicIPAddressSkuName string + +const ( + // PublicIPAddressSkuNameBasic ... + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + // PublicIPAddressSkuNameStandard ... + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +// PossiblePublicIPAddressSkuNameValues returns an array of possible values for the PublicIPAddressSkuName const type. +func PossiblePublicIPAddressSkuNameValues() []PublicIPAddressSkuName { + return []PublicIPAddressSkuName{PublicIPAddressSkuNameBasic, PublicIPAddressSkuNameStandard} +} + +// PublicIPAddressSkuTier enumerates the values for public ip address sku tier. +type PublicIPAddressSkuTier string + +const ( + // PublicIPAddressSkuTierGlobal ... + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + // PublicIPAddressSkuTierRegional ... + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +// PossiblePublicIPAddressSkuTierValues returns an array of possible values for the PublicIPAddressSkuTier const type. +func PossiblePublicIPAddressSkuTierValues() []PublicIPAddressSkuTier { + return []PublicIPAddressSkuTier{PublicIPAddressSkuTierGlobal, PublicIPAddressSkuTierRegional} +} + +// PublicIPPrefixSkuName enumerates the values for public ip prefix sku name. +type PublicIPPrefixSkuName string + +const ( + // PublicIPPrefixSkuNameStandard ... + PublicIPPrefixSkuNameStandard PublicIPPrefixSkuName = "Standard" +) + +// PossiblePublicIPPrefixSkuNameValues returns an array of possible values for the PublicIPPrefixSkuName const type. +func PossiblePublicIPPrefixSkuNameValues() []PublicIPPrefixSkuName { + return []PublicIPPrefixSkuName{PublicIPPrefixSkuNameStandard} +} + +// PublicIPPrefixSkuTier enumerates the values for public ip prefix sku tier. +type PublicIPPrefixSkuTier string + +const ( + // PublicIPPrefixSkuTierGlobal ... + PublicIPPrefixSkuTierGlobal PublicIPPrefixSkuTier = "Global" + // PublicIPPrefixSkuTierRegional ... + PublicIPPrefixSkuTierRegional PublicIPPrefixSkuTier = "Regional" +) + +// PossiblePublicIPPrefixSkuTierValues returns an array of possible values for the PublicIPPrefixSkuTier const type. +func PossiblePublicIPPrefixSkuTierValues() []PublicIPPrefixSkuTier { + return []PublicIPPrefixSkuTier{PublicIPPrefixSkuTierGlobal, PublicIPPrefixSkuTierRegional} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone ... + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned ... + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeSystemAssignedUserAssigned ... + ResourceIdentityTypeSystemAssignedUserAssigned ResourceIdentityType = "SystemAssigned, UserAssigned" + // ResourceIdentityTypeUserAssigned ... + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeSystemAssignedUserAssigned, ResourceIdentityTypeUserAssigned} +} + +// RouteNextHopType enumerates the values for route next hop type. +type RouteNextHopType string + +const ( + // RouteNextHopTypeInternet ... + RouteNextHopTypeInternet RouteNextHopType = "Internet" + // RouteNextHopTypeNone ... + RouteNextHopTypeNone RouteNextHopType = "None" + // RouteNextHopTypeVirtualAppliance ... + RouteNextHopTypeVirtualAppliance RouteNextHopType = "VirtualAppliance" + // RouteNextHopTypeVirtualNetworkGateway ... + RouteNextHopTypeVirtualNetworkGateway RouteNextHopType = "VirtualNetworkGateway" + // RouteNextHopTypeVnetLocal ... + RouteNextHopTypeVnetLocal RouteNextHopType = "VnetLocal" +) + +// PossibleRouteNextHopTypeValues returns an array of possible values for the RouteNextHopType const type. +func PossibleRouteNextHopTypeValues() []RouteNextHopType { + return []RouteNextHopType{RouteNextHopTypeInternet, RouteNextHopTypeNone, RouteNextHopTypeVirtualAppliance, RouteNextHopTypeVirtualNetworkGateway, RouteNextHopTypeVnetLocal} +} + +// RoutingState enumerates the values for routing state. +type RoutingState string + +const ( + // RoutingStateFailed ... + RoutingStateFailed RoutingState = "Failed" + // RoutingStateNone ... + RoutingStateNone RoutingState = "None" + // RoutingStateProvisioned ... + RoutingStateProvisioned RoutingState = "Provisioned" + // RoutingStateProvisioning ... + RoutingStateProvisioning RoutingState = "Provisioning" +) + +// PossibleRoutingStateValues returns an array of possible values for the RoutingState const type. +func PossibleRoutingStateValues() []RoutingState { + return []RoutingState{RoutingStateFailed, RoutingStateNone, RoutingStateProvisioned, RoutingStateProvisioning} +} + +// RuleCollectionType enumerates the values for rule collection type. +type RuleCollectionType string + +const ( + // RuleCollectionTypeFirewallPolicyFilterRuleCollection ... + RuleCollectionTypeFirewallPolicyFilterRuleCollection RuleCollectionType = "FirewallPolicyFilterRuleCollection" + // RuleCollectionTypeFirewallPolicyNatRuleCollection ... + RuleCollectionTypeFirewallPolicyNatRuleCollection RuleCollectionType = "FirewallPolicyNatRuleCollection" + // RuleCollectionTypeFirewallPolicyRuleCollection ... + RuleCollectionTypeFirewallPolicyRuleCollection RuleCollectionType = "FirewallPolicyRuleCollection" +) + +// PossibleRuleCollectionTypeValues returns an array of possible values for the RuleCollectionType const type. +func PossibleRuleCollectionTypeValues() []RuleCollectionType { + return []RuleCollectionType{RuleCollectionTypeFirewallPolicyFilterRuleCollection, RuleCollectionTypeFirewallPolicyNatRuleCollection, RuleCollectionTypeFirewallPolicyRuleCollection} +} + +// RuleType enumerates the values for rule type. +type RuleType string + +const ( + // RuleTypeApplicationRule ... + RuleTypeApplicationRule RuleType = "ApplicationRule" + // RuleTypeFirewallPolicyRule ... + RuleTypeFirewallPolicyRule RuleType = "FirewallPolicyRule" + // RuleTypeNatRule ... + RuleTypeNatRule RuleType = "NatRule" + // RuleTypeNetworkRule ... + RuleTypeNetworkRule RuleType = "NetworkRule" +) + +// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{RuleTypeApplicationRule, RuleTypeFirewallPolicyRule, RuleTypeNatRule, RuleTypeNetworkRule} +} + +// SecurityPartnerProviderConnectionStatus enumerates the values for security partner provider connection +// status. +type SecurityPartnerProviderConnectionStatus string + +const ( + // SecurityPartnerProviderConnectionStatusConnected ... + SecurityPartnerProviderConnectionStatusConnected SecurityPartnerProviderConnectionStatus = "Connected" + // SecurityPartnerProviderConnectionStatusNotConnected ... + SecurityPartnerProviderConnectionStatusNotConnected SecurityPartnerProviderConnectionStatus = "NotConnected" + // SecurityPartnerProviderConnectionStatusPartiallyConnected ... + SecurityPartnerProviderConnectionStatusPartiallyConnected SecurityPartnerProviderConnectionStatus = "PartiallyConnected" + // SecurityPartnerProviderConnectionStatusUnknown ... + SecurityPartnerProviderConnectionStatusUnknown SecurityPartnerProviderConnectionStatus = "Unknown" +) + +// PossibleSecurityPartnerProviderConnectionStatusValues returns an array of possible values for the SecurityPartnerProviderConnectionStatus const type. +func PossibleSecurityPartnerProviderConnectionStatusValues() []SecurityPartnerProviderConnectionStatus { + return []SecurityPartnerProviderConnectionStatus{SecurityPartnerProviderConnectionStatusConnected, SecurityPartnerProviderConnectionStatusNotConnected, SecurityPartnerProviderConnectionStatusPartiallyConnected, SecurityPartnerProviderConnectionStatusUnknown} +} + +// SecurityProviderName enumerates the values for security provider name. +type SecurityProviderName string + +const ( + // SecurityProviderNameCheckpoint ... + SecurityProviderNameCheckpoint SecurityProviderName = "Checkpoint" + // SecurityProviderNameIBoss ... + SecurityProviderNameIBoss SecurityProviderName = "IBoss" + // SecurityProviderNameZScaler ... + SecurityProviderNameZScaler SecurityProviderName = "ZScaler" +) + +// PossibleSecurityProviderNameValues returns an array of possible values for the SecurityProviderName const type. +func PossibleSecurityProviderNameValues() []SecurityProviderName { + return []SecurityProviderName{SecurityProviderNameCheckpoint, SecurityProviderNameIBoss, SecurityProviderNameZScaler} +} + +// SecurityRuleAccess enumerates the values for security rule access. +type SecurityRuleAccess string + +const ( + // SecurityRuleAccessAllow ... + SecurityRuleAccessAllow SecurityRuleAccess = "Allow" + // SecurityRuleAccessDeny ... + SecurityRuleAccessDeny SecurityRuleAccess = "Deny" +) + +// PossibleSecurityRuleAccessValues returns an array of possible values for the SecurityRuleAccess const type. +func PossibleSecurityRuleAccessValues() []SecurityRuleAccess { + return []SecurityRuleAccess{SecurityRuleAccessAllow, SecurityRuleAccessDeny} +} + +// SecurityRuleDirection enumerates the values for security rule direction. +type SecurityRuleDirection string + +const ( + // SecurityRuleDirectionInbound ... + SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound" + // SecurityRuleDirectionOutbound ... + SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound" +) + +// PossibleSecurityRuleDirectionValues returns an array of possible values for the SecurityRuleDirection const type. +func PossibleSecurityRuleDirectionValues() []SecurityRuleDirection { + return []SecurityRuleDirection{SecurityRuleDirectionInbound, SecurityRuleDirectionOutbound} +} + +// SecurityRuleProtocol enumerates the values for security rule protocol. +type SecurityRuleProtocol string + +const ( + // SecurityRuleProtocolAh ... + SecurityRuleProtocolAh SecurityRuleProtocol = "Ah" + // SecurityRuleProtocolAsterisk ... + SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*" + // SecurityRuleProtocolEsp ... + SecurityRuleProtocolEsp SecurityRuleProtocol = "Esp" + // SecurityRuleProtocolIcmp ... + SecurityRuleProtocolIcmp SecurityRuleProtocol = "Icmp" + // SecurityRuleProtocolTCP ... + SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp" + // SecurityRuleProtocolUDP ... + SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp" +) + +// PossibleSecurityRuleProtocolValues returns an array of possible values for the SecurityRuleProtocol const type. +func PossibleSecurityRuleProtocolValues() []SecurityRuleProtocol { + return []SecurityRuleProtocol{SecurityRuleProtocolAh, SecurityRuleProtocolAsterisk, SecurityRuleProtocolEsp, SecurityRuleProtocolIcmp, SecurityRuleProtocolTCP, SecurityRuleProtocolUDP} +} + +// ServiceProviderProvisioningState enumerates the values for service provider provisioning state. +type ServiceProviderProvisioningState string + +const ( + // ServiceProviderProvisioningStateDeprovisioning ... + ServiceProviderProvisioningStateDeprovisioning ServiceProviderProvisioningState = "Deprovisioning" + // ServiceProviderProvisioningStateNotProvisioned ... + ServiceProviderProvisioningStateNotProvisioned ServiceProviderProvisioningState = "NotProvisioned" + // ServiceProviderProvisioningStateProvisioned ... + ServiceProviderProvisioningStateProvisioned ServiceProviderProvisioningState = "Provisioned" + // ServiceProviderProvisioningStateProvisioning ... + ServiceProviderProvisioningStateProvisioning ServiceProviderProvisioningState = "Provisioning" +) + +// PossibleServiceProviderProvisioningStateValues returns an array of possible values for the ServiceProviderProvisioningState const type. +func PossibleServiceProviderProvisioningStateValues() []ServiceProviderProvisioningState { + return []ServiceProviderProvisioningState{ServiceProviderProvisioningStateDeprovisioning, ServiceProviderProvisioningStateNotProvisioned, ServiceProviderProvisioningStateProvisioned, ServiceProviderProvisioningStateProvisioning} +} + +// Severity enumerates the values for severity. +type Severity string + +const ( + // SeverityError ... + SeverityError Severity = "Error" + // SeverityWarning ... + SeverityWarning Severity = "Warning" +) + +// PossibleSeverityValues returns an array of possible values for the Severity const type. +func PossibleSeverityValues() []Severity { + return []Severity{SeverityError, SeverityWarning} +} + +// SyncRemoteAddressSpace enumerates the values for sync remote address space. +type SyncRemoteAddressSpace string + +const ( + // SyncRemoteAddressSpaceTrue ... + SyncRemoteAddressSpaceTrue SyncRemoteAddressSpace = "true" +) + +// PossibleSyncRemoteAddressSpaceValues returns an array of possible values for the SyncRemoteAddressSpace const type. +func PossibleSyncRemoteAddressSpaceValues() []SyncRemoteAddressSpace { + return []SyncRemoteAddressSpace{SyncRemoteAddressSpaceTrue} +} + +// TransportProtocol enumerates the values for transport protocol. +type TransportProtocol string + +const ( + // TransportProtocolAll ... + TransportProtocolAll TransportProtocol = "All" + // TransportProtocolTCP ... + TransportProtocolTCP TransportProtocol = "Tcp" + // TransportProtocolUDP ... + TransportProtocolUDP TransportProtocol = "Udp" +) + +// PossibleTransportProtocolValues returns an array of possible values for the TransportProtocol const type. +func PossibleTransportProtocolValues() []TransportProtocol { + return []TransportProtocol{TransportProtocolAll, TransportProtocolTCP, TransportProtocolUDP} +} + +// TunnelConnectionStatus enumerates the values for tunnel connection status. +type TunnelConnectionStatus string + +const ( + // TunnelConnectionStatusConnected ... + TunnelConnectionStatusConnected TunnelConnectionStatus = "Connected" + // TunnelConnectionStatusConnecting ... + TunnelConnectionStatusConnecting TunnelConnectionStatus = "Connecting" + // TunnelConnectionStatusNotConnected ... + TunnelConnectionStatusNotConnected TunnelConnectionStatus = "NotConnected" + // TunnelConnectionStatusUnknown ... + TunnelConnectionStatusUnknown TunnelConnectionStatus = "Unknown" +) + +// PossibleTunnelConnectionStatusValues returns an array of possible values for the TunnelConnectionStatus const type. +func PossibleTunnelConnectionStatusValues() []TunnelConnectionStatus { + return []TunnelConnectionStatus{TunnelConnectionStatusConnected, TunnelConnectionStatusConnecting, TunnelConnectionStatusNotConnected, TunnelConnectionStatusUnknown} +} + +// VerbosityLevel enumerates the values for verbosity level. +type VerbosityLevel string + +const ( + // VerbosityLevelFull ... + VerbosityLevelFull VerbosityLevel = "Full" + // VerbosityLevelMinimum ... + VerbosityLevelMinimum VerbosityLevel = "Minimum" + // VerbosityLevelNormal ... + VerbosityLevelNormal VerbosityLevel = "Normal" +) + +// PossibleVerbosityLevelValues returns an array of possible values for the VerbosityLevel const type. +func PossibleVerbosityLevelValues() []VerbosityLevel { + return []VerbosityLevel{VerbosityLevelFull, VerbosityLevelMinimum, VerbosityLevelNormal} +} + +// VirtualNetworkEncryptionEnforcement enumerates the values for virtual network encryption enforcement. +type VirtualNetworkEncryptionEnforcement string + +const ( + // VirtualNetworkEncryptionEnforcementAllowUnencrypted ... + VirtualNetworkEncryptionEnforcementAllowUnencrypted VirtualNetworkEncryptionEnforcement = "AllowUnencrypted" + // VirtualNetworkEncryptionEnforcementDropUnencrypted ... + VirtualNetworkEncryptionEnforcementDropUnencrypted VirtualNetworkEncryptionEnforcement = "DropUnencrypted" +) + +// PossibleVirtualNetworkEncryptionEnforcementValues returns an array of possible values for the VirtualNetworkEncryptionEnforcement const type. +func PossibleVirtualNetworkEncryptionEnforcementValues() []VirtualNetworkEncryptionEnforcement { + return []VirtualNetworkEncryptionEnforcement{VirtualNetworkEncryptionEnforcementAllowUnencrypted, VirtualNetworkEncryptionEnforcementDropUnencrypted} +} + +// VirtualNetworkGatewayConnectionMode enumerates the values for virtual network gateway connection mode. +type VirtualNetworkGatewayConnectionMode string + +const ( + // VirtualNetworkGatewayConnectionModeDefault ... + VirtualNetworkGatewayConnectionModeDefault VirtualNetworkGatewayConnectionMode = "Default" + // VirtualNetworkGatewayConnectionModeInitiatorOnly ... + VirtualNetworkGatewayConnectionModeInitiatorOnly VirtualNetworkGatewayConnectionMode = "InitiatorOnly" + // VirtualNetworkGatewayConnectionModeResponderOnly ... + VirtualNetworkGatewayConnectionModeResponderOnly VirtualNetworkGatewayConnectionMode = "ResponderOnly" +) + +// PossibleVirtualNetworkGatewayConnectionModeValues returns an array of possible values for the VirtualNetworkGatewayConnectionMode const type. +func PossibleVirtualNetworkGatewayConnectionModeValues() []VirtualNetworkGatewayConnectionMode { + return []VirtualNetworkGatewayConnectionMode{VirtualNetworkGatewayConnectionModeDefault, VirtualNetworkGatewayConnectionModeInitiatorOnly, VirtualNetworkGatewayConnectionModeResponderOnly} +} + +// VirtualNetworkGatewayConnectionProtocol enumerates the values for virtual network gateway connection +// protocol. +type VirtualNetworkGatewayConnectionProtocol string + +const ( + // VirtualNetworkGatewayConnectionProtocolIKEv1 ... + VirtualNetworkGatewayConnectionProtocolIKEv1 VirtualNetworkGatewayConnectionProtocol = "IKEv1" + // VirtualNetworkGatewayConnectionProtocolIKEv2 ... + VirtualNetworkGatewayConnectionProtocolIKEv2 VirtualNetworkGatewayConnectionProtocol = "IKEv2" +) + +// PossibleVirtualNetworkGatewayConnectionProtocolValues returns an array of possible values for the VirtualNetworkGatewayConnectionProtocol const type. +func PossibleVirtualNetworkGatewayConnectionProtocolValues() []VirtualNetworkGatewayConnectionProtocol { + return []VirtualNetworkGatewayConnectionProtocol{VirtualNetworkGatewayConnectionProtocolIKEv1, VirtualNetworkGatewayConnectionProtocolIKEv2} +} + +// VirtualNetworkGatewayConnectionStatus enumerates the values for virtual network gateway connection status. +type VirtualNetworkGatewayConnectionStatus string + +const ( + // VirtualNetworkGatewayConnectionStatusConnected ... + VirtualNetworkGatewayConnectionStatusConnected VirtualNetworkGatewayConnectionStatus = "Connected" + // VirtualNetworkGatewayConnectionStatusConnecting ... + VirtualNetworkGatewayConnectionStatusConnecting VirtualNetworkGatewayConnectionStatus = "Connecting" + // VirtualNetworkGatewayConnectionStatusNotConnected ... + VirtualNetworkGatewayConnectionStatusNotConnected VirtualNetworkGatewayConnectionStatus = "NotConnected" + // VirtualNetworkGatewayConnectionStatusUnknown ... + VirtualNetworkGatewayConnectionStatusUnknown VirtualNetworkGatewayConnectionStatus = "Unknown" +) + +// PossibleVirtualNetworkGatewayConnectionStatusValues returns an array of possible values for the VirtualNetworkGatewayConnectionStatus const type. +func PossibleVirtualNetworkGatewayConnectionStatusValues() []VirtualNetworkGatewayConnectionStatus { + return []VirtualNetworkGatewayConnectionStatus{VirtualNetworkGatewayConnectionStatusConnected, VirtualNetworkGatewayConnectionStatusConnecting, VirtualNetworkGatewayConnectionStatusNotConnected, VirtualNetworkGatewayConnectionStatusUnknown} +} + +// VirtualNetworkGatewayConnectionType enumerates the values for virtual network gateway connection type. +type VirtualNetworkGatewayConnectionType string + +const ( + // VirtualNetworkGatewayConnectionTypeExpressRoute ... + VirtualNetworkGatewayConnectionTypeExpressRoute VirtualNetworkGatewayConnectionType = "ExpressRoute" + // VirtualNetworkGatewayConnectionTypeIPsec ... + VirtualNetworkGatewayConnectionTypeIPsec VirtualNetworkGatewayConnectionType = "IPsec" + // VirtualNetworkGatewayConnectionTypeVnet2Vnet ... + VirtualNetworkGatewayConnectionTypeVnet2Vnet VirtualNetworkGatewayConnectionType = "Vnet2Vnet" + // VirtualNetworkGatewayConnectionTypeVPNClient ... + VirtualNetworkGatewayConnectionTypeVPNClient VirtualNetworkGatewayConnectionType = "VPNClient" +) + +// PossibleVirtualNetworkGatewayConnectionTypeValues returns an array of possible values for the VirtualNetworkGatewayConnectionType const type. +func PossibleVirtualNetworkGatewayConnectionTypeValues() []VirtualNetworkGatewayConnectionType { + return []VirtualNetworkGatewayConnectionType{VirtualNetworkGatewayConnectionTypeExpressRoute, VirtualNetworkGatewayConnectionTypeIPsec, VirtualNetworkGatewayConnectionTypeVnet2Vnet, VirtualNetworkGatewayConnectionTypeVPNClient} +} + +// VirtualNetworkGatewaySkuName enumerates the values for virtual network gateway sku name. +type VirtualNetworkGatewaySkuName string + +const ( + // VirtualNetworkGatewaySkuNameBasic ... + VirtualNetworkGatewaySkuNameBasic VirtualNetworkGatewaySkuName = "Basic" + // VirtualNetworkGatewaySkuNameErGw1AZ ... + VirtualNetworkGatewaySkuNameErGw1AZ VirtualNetworkGatewaySkuName = "ErGw1AZ" + // VirtualNetworkGatewaySkuNameErGw2AZ ... + VirtualNetworkGatewaySkuNameErGw2AZ VirtualNetworkGatewaySkuName = "ErGw2AZ" + // VirtualNetworkGatewaySkuNameErGw3AZ ... + VirtualNetworkGatewaySkuNameErGw3AZ VirtualNetworkGatewaySkuName = "ErGw3AZ" + // VirtualNetworkGatewaySkuNameHighPerformance ... + VirtualNetworkGatewaySkuNameHighPerformance VirtualNetworkGatewaySkuName = "HighPerformance" + // VirtualNetworkGatewaySkuNameStandard ... + VirtualNetworkGatewaySkuNameStandard VirtualNetworkGatewaySkuName = "Standard" + // VirtualNetworkGatewaySkuNameUltraPerformance ... + VirtualNetworkGatewaySkuNameUltraPerformance VirtualNetworkGatewaySkuName = "UltraPerformance" + // VirtualNetworkGatewaySkuNameVpnGw1 ... + VirtualNetworkGatewaySkuNameVpnGw1 VirtualNetworkGatewaySkuName = "VpnGw1" + // VirtualNetworkGatewaySkuNameVpnGw1AZ ... + VirtualNetworkGatewaySkuNameVpnGw1AZ VirtualNetworkGatewaySkuName = "VpnGw1AZ" + // VirtualNetworkGatewaySkuNameVpnGw2 ... + VirtualNetworkGatewaySkuNameVpnGw2 VirtualNetworkGatewaySkuName = "VpnGw2" + // VirtualNetworkGatewaySkuNameVpnGw2AZ ... + VirtualNetworkGatewaySkuNameVpnGw2AZ VirtualNetworkGatewaySkuName = "VpnGw2AZ" + // VirtualNetworkGatewaySkuNameVpnGw3 ... + VirtualNetworkGatewaySkuNameVpnGw3 VirtualNetworkGatewaySkuName = "VpnGw3" + // VirtualNetworkGatewaySkuNameVpnGw3AZ ... + VirtualNetworkGatewaySkuNameVpnGw3AZ VirtualNetworkGatewaySkuName = "VpnGw3AZ" + // VirtualNetworkGatewaySkuNameVpnGw4 ... + VirtualNetworkGatewaySkuNameVpnGw4 VirtualNetworkGatewaySkuName = "VpnGw4" + // VirtualNetworkGatewaySkuNameVpnGw4AZ ... + VirtualNetworkGatewaySkuNameVpnGw4AZ VirtualNetworkGatewaySkuName = "VpnGw4AZ" + // VirtualNetworkGatewaySkuNameVpnGw5 ... + VirtualNetworkGatewaySkuNameVpnGw5 VirtualNetworkGatewaySkuName = "VpnGw5" + // VirtualNetworkGatewaySkuNameVpnGw5AZ ... + VirtualNetworkGatewaySkuNameVpnGw5AZ VirtualNetworkGatewaySkuName = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySkuNameValues returns an array of possible values for the VirtualNetworkGatewaySkuName const type. +func PossibleVirtualNetworkGatewaySkuNameValues() []VirtualNetworkGatewaySkuName { + return []VirtualNetworkGatewaySkuName{VirtualNetworkGatewaySkuNameBasic, VirtualNetworkGatewaySkuNameErGw1AZ, VirtualNetworkGatewaySkuNameErGw2AZ, VirtualNetworkGatewaySkuNameErGw3AZ, VirtualNetworkGatewaySkuNameHighPerformance, VirtualNetworkGatewaySkuNameStandard, VirtualNetworkGatewaySkuNameUltraPerformance, VirtualNetworkGatewaySkuNameVpnGw1, VirtualNetworkGatewaySkuNameVpnGw1AZ, VirtualNetworkGatewaySkuNameVpnGw2, VirtualNetworkGatewaySkuNameVpnGw2AZ, VirtualNetworkGatewaySkuNameVpnGw3, VirtualNetworkGatewaySkuNameVpnGw3AZ, VirtualNetworkGatewaySkuNameVpnGw4, VirtualNetworkGatewaySkuNameVpnGw4AZ, VirtualNetworkGatewaySkuNameVpnGw5, VirtualNetworkGatewaySkuNameVpnGw5AZ} +} + +// VirtualNetworkGatewaySkuTier enumerates the values for virtual network gateway sku tier. +type VirtualNetworkGatewaySkuTier string + +const ( + // VirtualNetworkGatewaySkuTierBasic ... + VirtualNetworkGatewaySkuTierBasic VirtualNetworkGatewaySkuTier = "Basic" + // VirtualNetworkGatewaySkuTierErGw1AZ ... + VirtualNetworkGatewaySkuTierErGw1AZ VirtualNetworkGatewaySkuTier = "ErGw1AZ" + // VirtualNetworkGatewaySkuTierErGw2AZ ... + VirtualNetworkGatewaySkuTierErGw2AZ VirtualNetworkGatewaySkuTier = "ErGw2AZ" + // VirtualNetworkGatewaySkuTierErGw3AZ ... + VirtualNetworkGatewaySkuTierErGw3AZ VirtualNetworkGatewaySkuTier = "ErGw3AZ" + // VirtualNetworkGatewaySkuTierHighPerformance ... + VirtualNetworkGatewaySkuTierHighPerformance VirtualNetworkGatewaySkuTier = "HighPerformance" + // VirtualNetworkGatewaySkuTierStandard ... + VirtualNetworkGatewaySkuTierStandard VirtualNetworkGatewaySkuTier = "Standard" + // VirtualNetworkGatewaySkuTierUltraPerformance ... + VirtualNetworkGatewaySkuTierUltraPerformance VirtualNetworkGatewaySkuTier = "UltraPerformance" + // VirtualNetworkGatewaySkuTierVpnGw1 ... + VirtualNetworkGatewaySkuTierVpnGw1 VirtualNetworkGatewaySkuTier = "VpnGw1" + // VirtualNetworkGatewaySkuTierVpnGw1AZ ... + VirtualNetworkGatewaySkuTierVpnGw1AZ VirtualNetworkGatewaySkuTier = "VpnGw1AZ" + // VirtualNetworkGatewaySkuTierVpnGw2 ... + VirtualNetworkGatewaySkuTierVpnGw2 VirtualNetworkGatewaySkuTier = "VpnGw2" + // VirtualNetworkGatewaySkuTierVpnGw2AZ ... + VirtualNetworkGatewaySkuTierVpnGw2AZ VirtualNetworkGatewaySkuTier = "VpnGw2AZ" + // VirtualNetworkGatewaySkuTierVpnGw3 ... + VirtualNetworkGatewaySkuTierVpnGw3 VirtualNetworkGatewaySkuTier = "VpnGw3" + // VirtualNetworkGatewaySkuTierVpnGw3AZ ... + VirtualNetworkGatewaySkuTierVpnGw3AZ VirtualNetworkGatewaySkuTier = "VpnGw3AZ" + // VirtualNetworkGatewaySkuTierVpnGw4 ... + VirtualNetworkGatewaySkuTierVpnGw4 VirtualNetworkGatewaySkuTier = "VpnGw4" + // VirtualNetworkGatewaySkuTierVpnGw4AZ ... + VirtualNetworkGatewaySkuTierVpnGw4AZ VirtualNetworkGatewaySkuTier = "VpnGw4AZ" + // VirtualNetworkGatewaySkuTierVpnGw5 ... + VirtualNetworkGatewaySkuTierVpnGw5 VirtualNetworkGatewaySkuTier = "VpnGw5" + // VirtualNetworkGatewaySkuTierVpnGw5AZ ... + VirtualNetworkGatewaySkuTierVpnGw5AZ VirtualNetworkGatewaySkuTier = "VpnGw5AZ" +) + +// PossibleVirtualNetworkGatewaySkuTierValues returns an array of possible values for the VirtualNetworkGatewaySkuTier const type. +func PossibleVirtualNetworkGatewaySkuTierValues() []VirtualNetworkGatewaySkuTier { + return []VirtualNetworkGatewaySkuTier{VirtualNetworkGatewaySkuTierBasic, VirtualNetworkGatewaySkuTierErGw1AZ, VirtualNetworkGatewaySkuTierErGw2AZ, VirtualNetworkGatewaySkuTierErGw3AZ, VirtualNetworkGatewaySkuTierHighPerformance, VirtualNetworkGatewaySkuTierStandard, VirtualNetworkGatewaySkuTierUltraPerformance, VirtualNetworkGatewaySkuTierVpnGw1, VirtualNetworkGatewaySkuTierVpnGw1AZ, VirtualNetworkGatewaySkuTierVpnGw2, VirtualNetworkGatewaySkuTierVpnGw2AZ, VirtualNetworkGatewaySkuTierVpnGw3, VirtualNetworkGatewaySkuTierVpnGw3AZ, VirtualNetworkGatewaySkuTierVpnGw4, VirtualNetworkGatewaySkuTierVpnGw4AZ, VirtualNetworkGatewaySkuTierVpnGw5, VirtualNetworkGatewaySkuTierVpnGw5AZ} +} + +// VirtualNetworkGatewayType enumerates the values for virtual network gateway type. +type VirtualNetworkGatewayType string + +const ( + // VirtualNetworkGatewayTypeExpressRoute ... + VirtualNetworkGatewayTypeExpressRoute VirtualNetworkGatewayType = "ExpressRoute" + // VirtualNetworkGatewayTypeLocalGateway ... + VirtualNetworkGatewayTypeLocalGateway VirtualNetworkGatewayType = "LocalGateway" + // VirtualNetworkGatewayTypeVpn ... + VirtualNetworkGatewayTypeVpn VirtualNetworkGatewayType = "Vpn" +) + +// PossibleVirtualNetworkGatewayTypeValues returns an array of possible values for the VirtualNetworkGatewayType const type. +func PossibleVirtualNetworkGatewayTypeValues() []VirtualNetworkGatewayType { + return []VirtualNetworkGatewayType{VirtualNetworkGatewayTypeExpressRoute, VirtualNetworkGatewayTypeLocalGateway, VirtualNetworkGatewayTypeVpn} +} + +// VirtualNetworkPeeringLevel enumerates the values for virtual network peering level. +type VirtualNetworkPeeringLevel string + +const ( + // VirtualNetworkPeeringLevelFullyInSync ... + VirtualNetworkPeeringLevelFullyInSync VirtualNetworkPeeringLevel = "FullyInSync" + // VirtualNetworkPeeringLevelLocalAndRemoteNotInSync ... + VirtualNetworkPeeringLevelLocalAndRemoteNotInSync VirtualNetworkPeeringLevel = "LocalAndRemoteNotInSync" + // VirtualNetworkPeeringLevelLocalNotInSync ... + VirtualNetworkPeeringLevelLocalNotInSync VirtualNetworkPeeringLevel = "LocalNotInSync" + // VirtualNetworkPeeringLevelRemoteNotInSync ... + VirtualNetworkPeeringLevelRemoteNotInSync VirtualNetworkPeeringLevel = "RemoteNotInSync" +) + +// PossibleVirtualNetworkPeeringLevelValues returns an array of possible values for the VirtualNetworkPeeringLevel const type. +func PossibleVirtualNetworkPeeringLevelValues() []VirtualNetworkPeeringLevel { + return []VirtualNetworkPeeringLevel{VirtualNetworkPeeringLevelFullyInSync, VirtualNetworkPeeringLevelLocalAndRemoteNotInSync, VirtualNetworkPeeringLevelLocalNotInSync, VirtualNetworkPeeringLevelRemoteNotInSync} +} + +// VirtualNetworkPeeringState enumerates the values for virtual network peering state. +type VirtualNetworkPeeringState string + +const ( + // VirtualNetworkPeeringStateConnected ... + VirtualNetworkPeeringStateConnected VirtualNetworkPeeringState = "Connected" + // VirtualNetworkPeeringStateDisconnected ... + VirtualNetworkPeeringStateDisconnected VirtualNetworkPeeringState = "Disconnected" + // VirtualNetworkPeeringStateInitiated ... + VirtualNetworkPeeringStateInitiated VirtualNetworkPeeringState = "Initiated" +) + +// PossibleVirtualNetworkPeeringStateValues returns an array of possible values for the VirtualNetworkPeeringState const type. +func PossibleVirtualNetworkPeeringStateValues() []VirtualNetworkPeeringState { + return []VirtualNetworkPeeringState{VirtualNetworkPeeringStateConnected, VirtualNetworkPeeringStateDisconnected, VirtualNetworkPeeringStateInitiated} +} + +// VirtualNetworkPrivateEndpointNetworkPolicies enumerates the values for virtual network private endpoint +// network policies. +type VirtualNetworkPrivateEndpointNetworkPolicies string + +const ( + // VirtualNetworkPrivateEndpointNetworkPoliciesDisabled ... + VirtualNetworkPrivateEndpointNetworkPoliciesDisabled VirtualNetworkPrivateEndpointNetworkPolicies = "Disabled" + // VirtualNetworkPrivateEndpointNetworkPoliciesEnabled ... + VirtualNetworkPrivateEndpointNetworkPoliciesEnabled VirtualNetworkPrivateEndpointNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateEndpointNetworkPolicies const type. +func PossibleVirtualNetworkPrivateEndpointNetworkPoliciesValues() []VirtualNetworkPrivateEndpointNetworkPolicies { + return []VirtualNetworkPrivateEndpointNetworkPolicies{VirtualNetworkPrivateEndpointNetworkPoliciesDisabled, VirtualNetworkPrivateEndpointNetworkPoliciesEnabled} +} + +// VirtualNetworkPrivateLinkServiceNetworkPolicies enumerates the values for virtual network private link +// service network policies. +type VirtualNetworkPrivateLinkServiceNetworkPolicies string + +const ( + // VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled ... + VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Disabled" + // VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled ... + VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled VirtualNetworkPrivateLinkServiceNetworkPolicies = "Enabled" +) + +// PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues returns an array of possible values for the VirtualNetworkPrivateLinkServiceNetworkPolicies const type. +func PossibleVirtualNetworkPrivateLinkServiceNetworkPoliciesValues() []VirtualNetworkPrivateLinkServiceNetworkPolicies { + return []VirtualNetworkPrivateLinkServiceNetworkPolicies{VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled, VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled} +} + +// VirtualWanSecurityProviderType enumerates the values for virtual wan security provider type. +type VirtualWanSecurityProviderType string + +const ( + // VirtualWanSecurityProviderTypeExternal ... + VirtualWanSecurityProviderTypeExternal VirtualWanSecurityProviderType = "External" + // VirtualWanSecurityProviderTypeNative ... + VirtualWanSecurityProviderTypeNative VirtualWanSecurityProviderType = "Native" +) + +// PossibleVirtualWanSecurityProviderTypeValues returns an array of possible values for the VirtualWanSecurityProviderType const type. +func PossibleVirtualWanSecurityProviderTypeValues() []VirtualWanSecurityProviderType { + return []VirtualWanSecurityProviderType{VirtualWanSecurityProviderTypeExternal, VirtualWanSecurityProviderTypeNative} +} + +// VpnAuthenticationType enumerates the values for vpn authentication type. +type VpnAuthenticationType string + +const ( + // VpnAuthenticationTypeAAD ... + VpnAuthenticationTypeAAD VpnAuthenticationType = "AAD" + // VpnAuthenticationTypeCertificate ... + VpnAuthenticationTypeCertificate VpnAuthenticationType = "Certificate" + // VpnAuthenticationTypeRadius ... + VpnAuthenticationTypeRadius VpnAuthenticationType = "Radius" +) + +// PossibleVpnAuthenticationTypeValues returns an array of possible values for the VpnAuthenticationType const type. +func PossibleVpnAuthenticationTypeValues() []VpnAuthenticationType { + return []VpnAuthenticationType{VpnAuthenticationTypeAAD, VpnAuthenticationTypeCertificate, VpnAuthenticationTypeRadius} +} + +// VpnClientProtocol enumerates the values for vpn client protocol. +type VpnClientProtocol string + +const ( + // VpnClientProtocolIkeV2 ... + VpnClientProtocolIkeV2 VpnClientProtocol = "IkeV2" + // VpnClientProtocolOpenVPN ... + VpnClientProtocolOpenVPN VpnClientProtocol = "OpenVPN" + // VpnClientProtocolSSTP ... + VpnClientProtocolSSTP VpnClientProtocol = "SSTP" +) + +// PossibleVpnClientProtocolValues returns an array of possible values for the VpnClientProtocol const type. +func PossibleVpnClientProtocolValues() []VpnClientProtocol { + return []VpnClientProtocol{VpnClientProtocolIkeV2, VpnClientProtocolOpenVPN, VpnClientProtocolSSTP} +} + +// VpnConnectionStatus enumerates the values for vpn connection status. +type VpnConnectionStatus string + +const ( + // VpnConnectionStatusConnected ... + VpnConnectionStatusConnected VpnConnectionStatus = "Connected" + // VpnConnectionStatusConnecting ... + VpnConnectionStatusConnecting VpnConnectionStatus = "Connecting" + // VpnConnectionStatusNotConnected ... + VpnConnectionStatusNotConnected VpnConnectionStatus = "NotConnected" + // VpnConnectionStatusUnknown ... + VpnConnectionStatusUnknown VpnConnectionStatus = "Unknown" +) + +// PossibleVpnConnectionStatusValues returns an array of possible values for the VpnConnectionStatus const type. +func PossibleVpnConnectionStatusValues() []VpnConnectionStatus { + return []VpnConnectionStatus{VpnConnectionStatusConnected, VpnConnectionStatusConnecting, VpnConnectionStatusNotConnected, VpnConnectionStatusUnknown} +} + +// VpnGatewayGeneration enumerates the values for vpn gateway generation. +type VpnGatewayGeneration string + +const ( + // VpnGatewayGenerationGeneration1 ... + VpnGatewayGenerationGeneration1 VpnGatewayGeneration = "Generation1" + // VpnGatewayGenerationGeneration2 ... + VpnGatewayGenerationGeneration2 VpnGatewayGeneration = "Generation2" + // VpnGatewayGenerationNone ... + VpnGatewayGenerationNone VpnGatewayGeneration = "None" +) + +// PossibleVpnGatewayGenerationValues returns an array of possible values for the VpnGatewayGeneration const type. +func PossibleVpnGatewayGenerationValues() []VpnGatewayGeneration { + return []VpnGatewayGeneration{VpnGatewayGenerationGeneration1, VpnGatewayGenerationGeneration2, VpnGatewayGenerationNone} +} + +// VpnGatewayTunnelingProtocol enumerates the values for vpn gateway tunneling protocol. +type VpnGatewayTunnelingProtocol string + +const ( + // VpnGatewayTunnelingProtocolIkeV2 ... + VpnGatewayTunnelingProtocolIkeV2 VpnGatewayTunnelingProtocol = "IkeV2" + // VpnGatewayTunnelingProtocolOpenVPN ... + VpnGatewayTunnelingProtocolOpenVPN VpnGatewayTunnelingProtocol = "OpenVPN" +) + +// PossibleVpnGatewayTunnelingProtocolValues returns an array of possible values for the VpnGatewayTunnelingProtocol const type. +func PossibleVpnGatewayTunnelingProtocolValues() []VpnGatewayTunnelingProtocol { + return []VpnGatewayTunnelingProtocol{VpnGatewayTunnelingProtocolIkeV2, VpnGatewayTunnelingProtocolOpenVPN} +} + +// VpnLinkConnectionMode enumerates the values for vpn link connection mode. +type VpnLinkConnectionMode string + +const ( + // VpnLinkConnectionModeDefault ... + VpnLinkConnectionModeDefault VpnLinkConnectionMode = "Default" + // VpnLinkConnectionModeInitiatorOnly ... + VpnLinkConnectionModeInitiatorOnly VpnLinkConnectionMode = "InitiatorOnly" + // VpnLinkConnectionModeResponderOnly ... + VpnLinkConnectionModeResponderOnly VpnLinkConnectionMode = "ResponderOnly" +) + +// PossibleVpnLinkConnectionModeValues returns an array of possible values for the VpnLinkConnectionMode const type. +func PossibleVpnLinkConnectionModeValues() []VpnLinkConnectionMode { + return []VpnLinkConnectionMode{VpnLinkConnectionModeDefault, VpnLinkConnectionModeInitiatorOnly, VpnLinkConnectionModeResponderOnly} +} + +// VpnNatRuleMode enumerates the values for vpn nat rule mode. +type VpnNatRuleMode string + +const ( + // VpnNatRuleModeEgressSnat ... + VpnNatRuleModeEgressSnat VpnNatRuleMode = "EgressSnat" + // VpnNatRuleModeIngressSnat ... + VpnNatRuleModeIngressSnat VpnNatRuleMode = "IngressSnat" +) + +// PossibleVpnNatRuleModeValues returns an array of possible values for the VpnNatRuleMode const type. +func PossibleVpnNatRuleModeValues() []VpnNatRuleMode { + return []VpnNatRuleMode{VpnNatRuleModeEgressSnat, VpnNatRuleModeIngressSnat} +} + +// VpnNatRuleType enumerates the values for vpn nat rule type. +type VpnNatRuleType string + +const ( + // VpnNatRuleTypeDynamic ... + VpnNatRuleTypeDynamic VpnNatRuleType = "Dynamic" + // VpnNatRuleTypeStatic ... + VpnNatRuleTypeStatic VpnNatRuleType = "Static" +) + +// PossibleVpnNatRuleTypeValues returns an array of possible values for the VpnNatRuleType const type. +func PossibleVpnNatRuleTypeValues() []VpnNatRuleType { + return []VpnNatRuleType{VpnNatRuleTypeDynamic, VpnNatRuleTypeStatic} +} + +// VpnPolicyMemberAttributeType enumerates the values for vpn policy member attribute type. +type VpnPolicyMemberAttributeType string + +const ( + // VpnPolicyMemberAttributeTypeAADGroupID ... + VpnPolicyMemberAttributeTypeAADGroupID VpnPolicyMemberAttributeType = "AADGroupId" + // VpnPolicyMemberAttributeTypeCertificateGroupID ... + VpnPolicyMemberAttributeTypeCertificateGroupID VpnPolicyMemberAttributeType = "CertificateGroupId" + // VpnPolicyMemberAttributeTypeRadiusAzureGroupID ... + VpnPolicyMemberAttributeTypeRadiusAzureGroupID VpnPolicyMemberAttributeType = "RadiusAzureGroupId" +) + +// PossibleVpnPolicyMemberAttributeTypeValues returns an array of possible values for the VpnPolicyMemberAttributeType const type. +func PossibleVpnPolicyMemberAttributeTypeValues() []VpnPolicyMemberAttributeType { + return []VpnPolicyMemberAttributeType{VpnPolicyMemberAttributeTypeAADGroupID, VpnPolicyMemberAttributeTypeCertificateGroupID, VpnPolicyMemberAttributeTypeRadiusAzureGroupID} +} + +// VpnType enumerates the values for vpn type. +type VpnType string + +const ( + // VpnTypePolicyBased ... + VpnTypePolicyBased VpnType = "PolicyBased" + // VpnTypeRouteBased ... + VpnTypeRouteBased VpnType = "RouteBased" +) + +// PossibleVpnTypeValues returns an array of possible values for the VpnType const type. +func PossibleVpnTypeValues() []VpnType { + return []VpnType{VpnTypePolicyBased, VpnTypeRouteBased} +} + +// WebApplicationFirewallAction enumerates the values for web application firewall action. +type WebApplicationFirewallAction string + +const ( + // WebApplicationFirewallActionAllow ... + WebApplicationFirewallActionAllow WebApplicationFirewallAction = "Allow" + // WebApplicationFirewallActionBlock ... + WebApplicationFirewallActionBlock WebApplicationFirewallAction = "Block" + // WebApplicationFirewallActionLog ... + WebApplicationFirewallActionLog WebApplicationFirewallAction = "Log" +) + +// PossibleWebApplicationFirewallActionValues returns an array of possible values for the WebApplicationFirewallAction const type. +func PossibleWebApplicationFirewallActionValues() []WebApplicationFirewallAction { + return []WebApplicationFirewallAction{WebApplicationFirewallActionAllow, WebApplicationFirewallActionBlock, WebApplicationFirewallActionLog} +} + +// WebApplicationFirewallEnabledState enumerates the values for web application firewall enabled state. +type WebApplicationFirewallEnabledState string + +const ( + // WebApplicationFirewallEnabledStateDisabled ... + WebApplicationFirewallEnabledStateDisabled WebApplicationFirewallEnabledState = "Disabled" + // WebApplicationFirewallEnabledStateEnabled ... + WebApplicationFirewallEnabledStateEnabled WebApplicationFirewallEnabledState = "Enabled" +) + +// PossibleWebApplicationFirewallEnabledStateValues returns an array of possible values for the WebApplicationFirewallEnabledState const type. +func PossibleWebApplicationFirewallEnabledStateValues() []WebApplicationFirewallEnabledState { + return []WebApplicationFirewallEnabledState{WebApplicationFirewallEnabledStateDisabled, WebApplicationFirewallEnabledStateEnabled} +} + +// WebApplicationFirewallMatchVariable enumerates the values for web application firewall match variable. +type WebApplicationFirewallMatchVariable string + +const ( + // WebApplicationFirewallMatchVariablePostArgs ... + WebApplicationFirewallMatchVariablePostArgs WebApplicationFirewallMatchVariable = "PostArgs" + // WebApplicationFirewallMatchVariableQueryString ... + WebApplicationFirewallMatchVariableQueryString WebApplicationFirewallMatchVariable = "QueryString" + // WebApplicationFirewallMatchVariableRemoteAddr ... + WebApplicationFirewallMatchVariableRemoteAddr WebApplicationFirewallMatchVariable = "RemoteAddr" + // WebApplicationFirewallMatchVariableRequestBody ... + WebApplicationFirewallMatchVariableRequestBody WebApplicationFirewallMatchVariable = "RequestBody" + // WebApplicationFirewallMatchVariableRequestCookies ... + WebApplicationFirewallMatchVariableRequestCookies WebApplicationFirewallMatchVariable = "RequestCookies" + // WebApplicationFirewallMatchVariableRequestHeaders ... + WebApplicationFirewallMatchVariableRequestHeaders WebApplicationFirewallMatchVariable = "RequestHeaders" + // WebApplicationFirewallMatchVariableRequestMethod ... + WebApplicationFirewallMatchVariableRequestMethod WebApplicationFirewallMatchVariable = "RequestMethod" + // WebApplicationFirewallMatchVariableRequestURI ... + WebApplicationFirewallMatchVariableRequestURI WebApplicationFirewallMatchVariable = "RequestUri" +) + +// PossibleWebApplicationFirewallMatchVariableValues returns an array of possible values for the WebApplicationFirewallMatchVariable const type. +func PossibleWebApplicationFirewallMatchVariableValues() []WebApplicationFirewallMatchVariable { + return []WebApplicationFirewallMatchVariable{WebApplicationFirewallMatchVariablePostArgs, WebApplicationFirewallMatchVariableQueryString, WebApplicationFirewallMatchVariableRemoteAddr, WebApplicationFirewallMatchVariableRequestBody, WebApplicationFirewallMatchVariableRequestCookies, WebApplicationFirewallMatchVariableRequestHeaders, WebApplicationFirewallMatchVariableRequestMethod, WebApplicationFirewallMatchVariableRequestURI} +} + +// WebApplicationFirewallMode enumerates the values for web application firewall mode. +type WebApplicationFirewallMode string + +const ( + // WebApplicationFirewallModeDetection ... + WebApplicationFirewallModeDetection WebApplicationFirewallMode = "Detection" + // WebApplicationFirewallModePrevention ... + WebApplicationFirewallModePrevention WebApplicationFirewallMode = "Prevention" +) + +// PossibleWebApplicationFirewallModeValues returns an array of possible values for the WebApplicationFirewallMode const type. +func PossibleWebApplicationFirewallModeValues() []WebApplicationFirewallMode { + return []WebApplicationFirewallMode{WebApplicationFirewallModeDetection, WebApplicationFirewallModePrevention} +} + +// WebApplicationFirewallOperator enumerates the values for web application firewall operator. +type WebApplicationFirewallOperator string + +const ( + // WebApplicationFirewallOperatorBeginsWith ... + WebApplicationFirewallOperatorBeginsWith WebApplicationFirewallOperator = "BeginsWith" + // WebApplicationFirewallOperatorContains ... + WebApplicationFirewallOperatorContains WebApplicationFirewallOperator = "Contains" + // WebApplicationFirewallOperatorEndsWith ... + WebApplicationFirewallOperatorEndsWith WebApplicationFirewallOperator = "EndsWith" + // WebApplicationFirewallOperatorEqual ... + WebApplicationFirewallOperatorEqual WebApplicationFirewallOperator = "Equal" + // WebApplicationFirewallOperatorGeoMatch ... + WebApplicationFirewallOperatorGeoMatch WebApplicationFirewallOperator = "GeoMatch" + // WebApplicationFirewallOperatorGreaterThan ... + WebApplicationFirewallOperatorGreaterThan WebApplicationFirewallOperator = "GreaterThan" + // WebApplicationFirewallOperatorGreaterThanOrEqual ... + WebApplicationFirewallOperatorGreaterThanOrEqual WebApplicationFirewallOperator = "GreaterThanOrEqual" + // WebApplicationFirewallOperatorIPMatch ... + WebApplicationFirewallOperatorIPMatch WebApplicationFirewallOperator = "IPMatch" + // WebApplicationFirewallOperatorLessThan ... + WebApplicationFirewallOperatorLessThan WebApplicationFirewallOperator = "LessThan" + // WebApplicationFirewallOperatorLessThanOrEqual ... + WebApplicationFirewallOperatorLessThanOrEqual WebApplicationFirewallOperator = "LessThanOrEqual" + // WebApplicationFirewallOperatorRegex ... + WebApplicationFirewallOperatorRegex WebApplicationFirewallOperator = "Regex" +) + +// PossibleWebApplicationFirewallOperatorValues returns an array of possible values for the WebApplicationFirewallOperator const type. +func PossibleWebApplicationFirewallOperatorValues() []WebApplicationFirewallOperator { + return []WebApplicationFirewallOperator{WebApplicationFirewallOperatorBeginsWith, WebApplicationFirewallOperatorContains, WebApplicationFirewallOperatorEndsWith, WebApplicationFirewallOperatorEqual, WebApplicationFirewallOperatorGeoMatch, WebApplicationFirewallOperatorGreaterThan, WebApplicationFirewallOperatorGreaterThanOrEqual, WebApplicationFirewallOperatorIPMatch, WebApplicationFirewallOperatorLessThan, WebApplicationFirewallOperatorLessThanOrEqual, WebApplicationFirewallOperatorRegex} +} + +// WebApplicationFirewallPolicyResourceState enumerates the values for web application firewall policy resource +// state. +type WebApplicationFirewallPolicyResourceState string + +const ( + // WebApplicationFirewallPolicyResourceStateCreating ... + WebApplicationFirewallPolicyResourceStateCreating WebApplicationFirewallPolicyResourceState = "Creating" + // WebApplicationFirewallPolicyResourceStateDeleting ... + WebApplicationFirewallPolicyResourceStateDeleting WebApplicationFirewallPolicyResourceState = "Deleting" + // WebApplicationFirewallPolicyResourceStateDisabled ... + WebApplicationFirewallPolicyResourceStateDisabled WebApplicationFirewallPolicyResourceState = "Disabled" + // WebApplicationFirewallPolicyResourceStateDisabling ... + WebApplicationFirewallPolicyResourceStateDisabling WebApplicationFirewallPolicyResourceState = "Disabling" + // WebApplicationFirewallPolicyResourceStateEnabled ... + WebApplicationFirewallPolicyResourceStateEnabled WebApplicationFirewallPolicyResourceState = "Enabled" + // WebApplicationFirewallPolicyResourceStateEnabling ... + WebApplicationFirewallPolicyResourceStateEnabling WebApplicationFirewallPolicyResourceState = "Enabling" +) + +// PossibleWebApplicationFirewallPolicyResourceStateValues returns an array of possible values for the WebApplicationFirewallPolicyResourceState const type. +func PossibleWebApplicationFirewallPolicyResourceStateValues() []WebApplicationFirewallPolicyResourceState { + return []WebApplicationFirewallPolicyResourceState{WebApplicationFirewallPolicyResourceStateCreating, WebApplicationFirewallPolicyResourceStateDeleting, WebApplicationFirewallPolicyResourceStateDisabled, WebApplicationFirewallPolicyResourceStateDisabling, WebApplicationFirewallPolicyResourceStateEnabled, WebApplicationFirewallPolicyResourceStateEnabling} +} + +// WebApplicationFirewallRuleType enumerates the values for web application firewall rule type. +type WebApplicationFirewallRuleType string + +const ( + // WebApplicationFirewallRuleTypeInvalid ... + WebApplicationFirewallRuleTypeInvalid WebApplicationFirewallRuleType = "Invalid" + // WebApplicationFirewallRuleTypeMatchRule ... + WebApplicationFirewallRuleTypeMatchRule WebApplicationFirewallRuleType = "MatchRule" +) + +// PossibleWebApplicationFirewallRuleTypeValues returns an array of possible values for the WebApplicationFirewallRuleType const type. +func PossibleWebApplicationFirewallRuleTypeValues() []WebApplicationFirewallRuleType { + return []WebApplicationFirewallRuleType{WebApplicationFirewallRuleTypeInvalid, WebApplicationFirewallRuleTypeMatchRule} +} + +// WebApplicationFirewallTransform enumerates the values for web application firewall transform. +type WebApplicationFirewallTransform string + +const ( + // WebApplicationFirewallTransformHTMLEntityDecode ... + WebApplicationFirewallTransformHTMLEntityDecode WebApplicationFirewallTransform = "HtmlEntityDecode" + // WebApplicationFirewallTransformLowercase ... + WebApplicationFirewallTransformLowercase WebApplicationFirewallTransform = "Lowercase" + // WebApplicationFirewallTransformRemoveNulls ... + WebApplicationFirewallTransformRemoveNulls WebApplicationFirewallTransform = "RemoveNulls" + // WebApplicationFirewallTransformTrim ... + WebApplicationFirewallTransformTrim WebApplicationFirewallTransform = "Trim" + // WebApplicationFirewallTransformURLDecode ... + WebApplicationFirewallTransformURLDecode WebApplicationFirewallTransform = "UrlDecode" + // WebApplicationFirewallTransformURLEncode ... + WebApplicationFirewallTransformURLEncode WebApplicationFirewallTransform = "UrlEncode" +) + +// PossibleWebApplicationFirewallTransformValues returns an array of possible values for the WebApplicationFirewallTransform const type. +func PossibleWebApplicationFirewallTransformValues() []WebApplicationFirewallTransform { + return []WebApplicationFirewallTransform{WebApplicationFirewallTransformHTMLEntityDecode, WebApplicationFirewallTransformLowercase, WebApplicationFirewallTransformRemoveNulls, WebApplicationFirewallTransformTrim, WebApplicationFirewallTransformURLDecode, WebApplicationFirewallTransformURLEncode} +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecircuitauthorizations.go b/services/network/mgmt/2021-08-01/network/expressroutecircuitauthorizations.go new file mode 100644 index 000000000000..b266a6cf1a4d --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecircuitauthorizations.go @@ -0,0 +1,396 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCircuitAuthorizationsClient is the network Client +type ExpressRouteCircuitAuthorizationsClient struct { + BaseClient +} + +// NewExpressRouteCircuitAuthorizationsClient creates an instance of the ExpressRouteCircuitAuthorizationsClient +// client. +func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string) ExpressRouteCircuitAuthorizationsClient { + return NewExpressRouteCircuitAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitAuthorizationsClientWithBaseURI creates an instance of the +// ExpressRouteCircuitAuthorizationsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitAuthorizationsClient { + return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an authorization in the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. +// authorizationParameters - parameters supplied to the create or update express route circuit authorization +// operation. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitAuthorizationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + authorizationParameters.Etag = nil + authorizationParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithJSON(authorizationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified authorization from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. +func (client ExpressRouteCircuitAuthorizationsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitAuthorizationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, authorizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified authorization from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// authorizationName - the name of the authorization. +func (client ExpressRouteCircuitAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitAuthorizationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, authorizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitAuthorization, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all authorizations in an express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +func (client ExpressRouteCircuitAuthorizationsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitAuthorizationsClient.List") + defer func() { + sc := -1 + if result.alr.Response.Response != nil { + sc = result.alr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.alr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request") + return + } + + result.alr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request") + return + } + if result.alr.hasNextLink() && result.alr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.Response) (result AuthorizationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitAuthorizationsClient) listNextResults(ctx context.Context, lastResults AuthorizationListResult) (result AuthorizationListResult, err error) { + req, err := lastResults.authorizationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCircuitAuthorizationsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitAuthorizationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, circuitName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecircuitconnections.go b/services/network/mgmt/2021-08-01/network/expressroutecircuitconnections.go new file mode 100644 index 000000000000..83674223397e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecircuitconnections.go @@ -0,0 +1,403 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCircuitConnectionsClient is the network Client +type ExpressRouteCircuitConnectionsClient struct { + BaseClient +} + +// NewExpressRouteCircuitConnectionsClient creates an instance of the ExpressRouteCircuitConnectionsClient client. +func NewExpressRouteCircuitConnectionsClient(subscriptionID string) ExpressRouteCircuitConnectionsClient { + return NewExpressRouteCircuitConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitConnectionsClientWithBaseURI creates an instance of the ExpressRouteCircuitConnectionsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewExpressRouteCircuitConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitConnectionsClient { + return ExpressRouteCircuitConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Express Route Circuit Connection in the specified express route circuits. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +// expressRouteCircuitConnectionParameters - parameters supplied to the create or update express route circuit +// connection operation. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection) (result ExpressRouteCircuitConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters ExpressRouteCircuitConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + expressRouteCircuitConnectionParameters.Etag = nil + expressRouteCircuitConnectionParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", pathParameters), + autorest.WithJSON(expressRouteCircuitConnectionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Express Route Circuit Connection from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +func (client ExpressRouteCircuitConnectionsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result ExpressRouteCircuitConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitConnectionsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Express Route Circuit Connection from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the express route circuit connection. +func (client ExpressRouteCircuitConnectionsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result ExpressRouteCircuitConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all global reach connections associated with a private peering in an express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// peeringName - the name of the peering. +func (client ExpressRouteCircuitConnectionsClient) List(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionsClient.List") + defer func() { + sc := -1 + if result.ercclr.Response.Response != nil { + sc = result.ercclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ercclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.ercclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.ercclr.hasNextLink() && result.ercclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitConnectionsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCircuitConnectionListResult) (result ExpressRouteCircuitConnectionListResult, err error) { + req, err := lastResults.expressRouteCircuitConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCircuitConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, circuitName, peeringName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecircuitpeerings.go b/services/network/mgmt/2021-08-01/network/expressroutecircuitpeerings.go new file mode 100644 index 000000000000..f502d7a7ae49 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecircuitpeerings.go @@ -0,0 +1,406 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCircuitPeeringsClient is the network Client +type ExpressRouteCircuitPeeringsClient struct { + BaseClient +} + +// NewExpressRouteCircuitPeeringsClient creates an instance of the ExpressRouteCircuitPeeringsClient client. +func NewExpressRouteCircuitPeeringsClient(subscriptionID string) ExpressRouteCircuitPeeringsClient { + return NewExpressRouteCircuitPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitPeeringsClientWithBaseURI creates an instance of the ExpressRouteCircuitPeeringsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitPeeringsClient { + return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified express route circuits. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// peeringParameters - parameters supplied to the create or update express route circuit peering operation. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: peeringParameters, + Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "peeringParameters.ExpressRouteCircuitPeeringPropertiesFormat.PeerASN", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, peeringParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + peeringParameters.Etag = nil + peeringParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithJSON(peeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified peering from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +func (client ExpressRouteCircuitPeeringsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeeringsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified peering for the express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +func (client ExpressRouteCircuitPeeringsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuitPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all peerings in a specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +func (client ExpressRouteCircuitPeeringsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringsClient.List") + defer func() { + sc := -1 + if result.ercplr.Response.Response != nil { + sc = result.ercplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ercplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request") + return + } + + result.ercplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request") + return + } + if result.ercplr.hasNextLink() && result.ercplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitPeeringListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitPeeringsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) { + req, err := lastResults.expressRouteCircuitPeeringListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCircuitPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, circuitName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecircuits.go b/services/network/mgmt/2021-08-01/network/expressroutecircuits.go new file mode 100644 index 000000000000..6e6d664c9edd --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecircuits.go @@ -0,0 +1,982 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCircuitsClient is the network Client +type ExpressRouteCircuitsClient struct { + BaseClient +} + +// NewExpressRouteCircuitsClient creates an instance of the ExpressRouteCircuitsClient client. +func NewExpressRouteCircuitsClient(subscriptionID string) ExpressRouteCircuitsClient { + return NewExpressRouteCircuitsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCircuitsClientWithBaseURI creates an instance of the ExpressRouteCircuitsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCircuitsClient { + return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// parameters - parameters supplied to the create or update express route circuit operation. +func (client ExpressRouteCircuitsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuitsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +func (client ExpressRouteCircuitsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of express route circuit. +func (client ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPeeringStats gets all stats from an express route circuit in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +func (client ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.GetPeeringStats") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPeeringStatsPreparer(ctx, resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetPeeringStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure sending request") + return + } + + result, err = client.GetPeeringStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure responding to request") + return + } + + return +} + +// GetPeeringStatsPreparer prepares the GetPeeringStats request. +func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetStats gets all the stats from an express route circuit in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +func (client ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.GetStats") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetStatsPreparer(ctx, resourceGroupName, circuitName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request") + return + } + + resp, err := client.GetStatsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure sending request") + return + } + + result, err = client.GetStatsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure responding to request") + return + } + + return +} + +// GetStatsPreparer prepares the GetStats request. +func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetStatsSender sends the GetStats request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetStatsResponder handles the response to the GetStats request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the express route circuits in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ExpressRouteCircuitsClient) List(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.List") + defer func() { + sc := -1 + if result.erclr.Response.Response != nil { + sc = result.erclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request") + return + } + + result.erclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request") + return + } + if result.erclr.hasNextLink() && result.erclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { + req, err := lastResults.expressRouteCircuitListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCircuitsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the express route circuits in a subscription. +func (client ExpressRouteCircuitsClient) ListAll(ctx context.Context) (result ExpressRouteCircuitListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListAll") + defer func() { + sc := -1 + if result.erclr.Response.Response != nil { + sc = result.erclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.erclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request") + return + } + + result.erclr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.erclr.hasNextLink() && result.erclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (result ExpressRouteCircuitListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client ExpressRouteCircuitsClient) listAllNextResults(ctx context.Context, lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { + req, err := lastResults.expressRouteCircuitListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCircuitsClient) ListAllComplete(ctx context.Context) (result ExpressRouteCircuitListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCircuitsClient) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListArpTableFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListArpTable") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListArpTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request") + return + } + + result, err = client.ListArpTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListArpTablePreparer prepares the ListArpTable request. +func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListArpTableSender sends the ListArpTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListArpTableResponder handles the response to the ListArpTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCircuitsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListRoutesTable") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTablePreparer prepares the ListRoutesTable request. +func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSender sends the ListRoutesTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit +// in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.ListRoutesTableSummary") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSummarySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates an express route circuit tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// parameters - parameters supplied to update express route circuit tags. +func (client ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (result ExpressRouteCircuit, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, circuitName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ExpressRouteCircuitsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCircuit, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressrouteconnections.go b/services/network/mgmt/2021-08-01/network/expressrouteconnections.go new file mode 100644 index 000000000000..b58cfdf034cb --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressrouteconnections.go @@ -0,0 +1,359 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteConnectionsClient is the network Client +type ExpressRouteConnectionsClient struct { + BaseClient +} + +// NewExpressRouteConnectionsClient creates an instance of the ExpressRouteConnectionsClient client. +func NewExpressRouteConnectionsClient(subscriptionID string) ExpressRouteConnectionsClient { + return NewExpressRouteConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteConnectionsClientWithBaseURI creates an instance of the ExpressRouteConnectionsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewExpressRouteConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteConnectionsClient { + return ExpressRouteConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +// connectionName - the name of the connection subresource. +// putExpressRouteConnectionParameters - parameters required in an ExpressRouteConnection PUT operation. +func (client ExpressRouteConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection) (result ExpressRouteConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: putExpressRouteConnectionParameters, + Constraints: []validation.Constraint{{Target: "putExpressRouteConnectionParameters.ExpressRouteConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "putExpressRouteConnectionParameters.ExpressRouteConnectionProperties.ExpressRouteCircuitPeering", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "putExpressRouteConnectionParameters.Name", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, expressRouteGatewayName, connectionName, putExpressRouteConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters ExpressRouteConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", pathParameters), + autorest.WithJSON(putExpressRouteConnectionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a connection to a ExpressRoute circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +// connectionName - the name of the connection subresource. +func (client ExpressRouteConnectionsClient) Delete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (result ExpressRouteConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, expressRouteGatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteConnectionsClient) DeleteSender(req *http.Request) (future ExpressRouteConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified ExpressRouteConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +// connectionName - the name of the ExpressRoute connection. +func (client ExpressRouteConnectionsClient) Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (result ExpressRouteConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, expressRouteGatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists ExpressRouteConnections. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +func (client ExpressRouteConnectionsClient) List(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result ExpressRouteConnectionList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, expressRouteGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}/expressRouteConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteConnectionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecrossconnectionpeerings.go b/services/network/mgmt/2021-08-01/network/expressroutecrossconnectionpeerings.go new file mode 100644 index 000000000000..a4fbcebcd450 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecrossconnectionpeerings.go @@ -0,0 +1,407 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCrossConnectionPeeringsClient is the network Client +type ExpressRouteCrossConnectionPeeringsClient struct { + BaseClient +} + +// NewExpressRouteCrossConnectionPeeringsClient creates an instance of the ExpressRouteCrossConnectionPeeringsClient +// client. +func NewExpressRouteCrossConnectionPeeringsClient(subscriptionID string) ExpressRouteCrossConnectionPeeringsClient { + return NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCrossConnectionPeeringsClientWithBaseURI creates an instance of the +// ExpressRouteCrossConnectionPeeringsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewExpressRouteCrossConnectionPeeringsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionPeeringsClient { + return ExpressRouteCrossConnectionPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// peeringParameters - parameters supplied to the create or update ExpressRouteCrossConnection peering +// operation. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering) (result ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: peeringParameters, + Constraints: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "peeringParameters.ExpressRouteCrossConnectionPeeringProperties.PeerASN", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, peeringParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters ExpressRouteCrossConnectionPeering) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + peeringParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", pathParameters), + autorest.WithJSON(peeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified peering from the ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +func (client ExpressRouteCrossConnectionPeeringsClient) Delete(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result ExpressRouteCrossConnectionPeeringsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, crossConnectionName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteCrossConnectionPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCrossConnectionPeeringsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified peering for the ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +func (client ExpressRouteCrossConnectionPeeringsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result ExpressRouteCrossConnectionPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCrossConnectionPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all peerings in a specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +func (client ExpressRouteCrossConnectionPeeringsClient) List(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnectionPeeringListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringsClient.List") + defer func() { + sc := -1 + if result.erccpl.Response.Response != nil { + sc = result.erccpl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, crossConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erccpl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", resp, "Failure sending request") + return + } + + result.erccpl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "List", resp, "Failure responding to request") + return + } + if result.erccpl.hasNextLink() && result.erccpl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCrossConnectionPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionPeeringsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionPeeringList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCrossConnectionPeeringsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionPeeringList) (result ExpressRouteCrossConnectionPeeringList, err error) { + req, err := lastResults.expressRouteCrossConnectionPeeringListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnectionPeeringListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, crossConnectionName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutecrossconnections.go b/services/network/mgmt/2021-08-01/network/expressroutecrossconnections.go new file mode 100644 index 000000000000..5f644efbaa72 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutecrossconnections.go @@ -0,0 +1,751 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteCrossConnectionsClient is the network Client +type ExpressRouteCrossConnectionsClient struct { + BaseClient +} + +// NewExpressRouteCrossConnectionsClient creates an instance of the ExpressRouteCrossConnectionsClient client. +func NewExpressRouteCrossConnectionsClient(subscriptionID string) ExpressRouteCrossConnectionsClient { + return NewExpressRouteCrossConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteCrossConnectionsClientWithBaseURI creates an instance of the ExpressRouteCrossConnectionsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewExpressRouteCrossConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionsClient { + return ExpressRouteCrossConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// parameters - parameters supplied to the update express route crossConnection operation. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (result ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets details about the specified ExpressRouteCrossConnection. +// Parameters: +// resourceGroupName - the name of the resource group (peering location of the circuit). +// crossConnectionName - the name of the ExpressRouteCrossConnection (service key of the circuit). +func (client ExpressRouteCrossConnectionsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteCrossConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves all the ExpressRouteCrossConnections in a subscription. +func (client ExpressRouteCrossConnectionsClient) List(ctx context.Context) (result ExpressRouteCrossConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List") + defer func() { + sc := -1 + if result.ercclr.Response.Response != nil { + sc = result.ercclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ercclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.ercclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.ercclr.hasNextLink() && result.ercclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteCrossConnectionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteCrossConnectionsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { + req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionsClient) ListComplete(ctx context.Context) (result ExpressRouteCrossConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListArpTable gets the currently advertised ARP table associated with the express route cross connection in a +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCrossConnectionsClient) ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListArpTableFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListArpTable") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListArpTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", nil, "Failure preparing request") + return + } + + result, err = client.ListArpTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListArpTablePreparer prepares the ListArpTable request. +func (client ExpressRouteCrossConnectionsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListArpTableSender sends the ListArpTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListArpTableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListArpTableResponder handles the response to the ListArpTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup retrieves all the ExpressRouteCrossConnections in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ercclr.Response.Response != nil { + sc = result.ercclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ercclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ercclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ercclr.hasNextLink() && result.ercclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ExpressRouteCrossConnectionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { + req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListRoutesTable gets the currently advertised routes table associated with the express route cross connection in a +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTable") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTablePreparer prepares the ListRoutesTable request. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSender sends the ListRoutesTable request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListRoutesTableSummary gets the route table summary associated with the express route cross connection in a resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the ExpressRouteCrossConnection. +// peeringName - the name of the peering. +// devicePath - the path of the device. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTableSummary") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", nil, "Failure preparing request") + return + } + + result, err = client.ListRoutesTableSummarySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request") + return + } + + return +} + +// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "devicePath": autorest.Encode("path", devicePath), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates an express route cross connection tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// crossConnectionName - the name of the cross connection. +// crossConnectionParameters - parameters supplied to update express route cross connection tags. +func (client ExpressRouteCrossConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (result ExpressRouteCrossConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ExpressRouteCrossConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "crossConnectionName": autorest.Encode("path", crossConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), + autorest.WithJSON(crossConnectionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteCrossConnectionsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ExpressRouteCrossConnectionsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutegateways.go b/services/network/mgmt/2021-08-01/network/expressroutegateways.go new file mode 100644 index 000000000000..7073ce13ba27 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutegateways.go @@ -0,0 +1,505 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteGatewaysClient is the network Client +type ExpressRouteGatewaysClient struct { + BaseClient +} + +// NewExpressRouteGatewaysClient creates an instance of the ExpressRouteGatewaysClient client. +func NewExpressRouteGatewaysClient(subscriptionID string) ExpressRouteGatewaysClient { + return NewExpressRouteGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteGatewaysClientWithBaseURI creates an instance of the ExpressRouteGatewaysClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExpressRouteGatewaysClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteGatewaysClient { + return ExpressRouteGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a ExpressRoute gateway in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +// putExpressRouteGatewayParameters - parameters required in an ExpressRoute gateway PUT operation. +func (client ExpressRouteGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway) (result ExpressRouteGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: putExpressRouteGatewayParameters, + Constraints: []validation.Constraint{{Target: "putExpressRouteGatewayParameters.ExpressRouteGatewayProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "putExpressRouteGatewayParameters.ExpressRouteGatewayProperties.VirtualHub", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("network.ExpressRouteGatewaysClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, expressRouteGatewayName, putExpressRouteGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRouteGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters ExpressRouteGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + putExpressRouteGatewayParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", pathParameters), + autorest.WithJSON(putExpressRouteGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified ExpressRoute gateway in a resource group. An ExpressRoute gateway resource can only be +// deleted when there are no connection subresources. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +func (client ExpressRouteGatewaysClient) Delete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result ExpressRouteGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, expressRouteGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRouteGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) DeleteSender(req *http.Request) (future ExpressRouteGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get fetches the details of a ExpressRoute gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRouteGatewayName - the name of the ExpressRoute gateway. +func (client ExpressRouteGatewaysClient) Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result ExpressRouteGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, expressRouteGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) GetResponder(resp *http.Response) (result ExpressRouteGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup lists ExpressRoute gateways in a given resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ExpressRouteGatewaysClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRouteGatewayList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ExpressRouteGatewaysClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRouteGatewayList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription lists ExpressRoute gateways under a given subscription. +func (client ExpressRouteGatewaysClient) ListBySubscription(ctx context.Context) (result ExpressRouteGatewayList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ExpressRouteGatewaysClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) ListBySubscriptionResponder(resp *http.Response) (result ExpressRouteGatewayList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates express route gateway tags. +// Parameters: +// resourceGroupName - the resource group name of the ExpressRouteGateway. +// expressRouteGatewayName - the name of the gateway. +// expressRouteGatewayParameters - parameters supplied to update a virtual wan express route gateway tags. +func (client ExpressRouteGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject) (result ExpressRouteGatewaysUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, expressRouteGatewayName, expressRouteGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ExpressRouteGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRouteGatewayName": autorest.Encode("path", expressRouteGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteGateways/{expressRouteGatewayName}", pathParameters), + autorest.WithJSON(expressRouteGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteGatewaysClient) UpdateTagsSender(req *http.Request) (future ExpressRouteGatewaysUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ExpressRouteGatewaysClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressroutelinks.go b/services/network/mgmt/2021-08-01/network/expressroutelinks.go new file mode 100644 index 000000000000..3f973edf64bf --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressroutelinks.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteLinksClient is the network Client +type ExpressRouteLinksClient struct { + BaseClient +} + +// NewExpressRouteLinksClient creates an instance of the ExpressRouteLinksClient client. +func NewExpressRouteLinksClient(subscriptionID string) ExpressRouteLinksClient { + return NewExpressRouteLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteLinksClientWithBaseURI creates an instance of the ExpressRouteLinksClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExpressRouteLinksClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteLinksClient { + return ExpressRouteLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves the specified ExpressRouteLink resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the ExpressRoutePort resource. +// linkName - the name of the ExpressRouteLink resource. +func (client ExpressRouteLinksClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, linkName string) (result ExpressRouteLink, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, expressRoutePortName, linkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRouteLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, linkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "linkName": autorest.Encode("path", linkName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteLinksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRouteLinksClient) GetResponder(resp *http.Response) (result ExpressRouteLink, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the ExpressRoutePort resource. +func (client ExpressRouteLinksClient) List(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRouteLinkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinksClient.List") + defer func() { + sc := -1 + if result.erllr.Response.Response != nil { + sc = result.erllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, expressRoutePortName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "List", resp, "Failure sending request") + return + } + + result.erllr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "List", resp, "Failure responding to request") + return + } + if result.erllr.hasNextLink() && result.erllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteLinksClient) ListPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}/links", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteLinksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteLinksClient) ListResponder(resp *http.Response) (result ExpressRouteLinkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteLinksClient) listNextResults(ctx context.Context, lastResults ExpressRouteLinkListResult) (result ExpressRouteLinkListResult, err error) { + req, err := lastResults.expressRouteLinkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteLinksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteLinksClient) ListComplete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRouteLinkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinksClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, expressRoutePortName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressrouteportauthorizations.go b/services/network/mgmt/2021-08-01/network/expressrouteportauthorizations.go new file mode 100644 index 000000000000..43ea09b6d404 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressrouteportauthorizations.go @@ -0,0 +1,395 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRoutePortAuthorizationsClient is the network Client +type ExpressRoutePortAuthorizationsClient struct { + BaseClient +} + +// NewExpressRoutePortAuthorizationsClient creates an instance of the ExpressRoutePortAuthorizationsClient client. +func NewExpressRoutePortAuthorizationsClient(subscriptionID string) ExpressRoutePortAuthorizationsClient { + return NewExpressRoutePortAuthorizationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRoutePortAuthorizationsClientWithBaseURI creates an instance of the ExpressRoutePortAuthorizationsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewExpressRoutePortAuthorizationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRoutePortAuthorizationsClient { + return ExpressRoutePortAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an authorization in the specified express route port. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the express route port. +// authorizationName - the name of the authorization. +// authorizationParameters - parameters supplied to the create or update express route port authorization +// operation. +func (client ExpressRoutePortAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization) (result ExpressRoutePortAuthorizationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, expressRoutePortName, authorizationName, authorizationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRoutePortAuthorizationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters ExpressRoutePortAuthorization) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + authorizationParameters.Etag = nil + authorizationParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", pathParameters), + autorest.WithJSON(authorizationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRoutePortAuthorizationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortAuthorizationsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRoutePortAuthorization, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified authorization from the specified express route port. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the express route port. +// authorizationName - the name of the authorization. +func (client ExpressRoutePortAuthorizationsClient) Delete(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (result ExpressRoutePortAuthorizationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, expressRoutePortName, authorizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRoutePortAuthorizationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRoutePortAuthorizationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortAuthorizationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified authorization from the specified express route port. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the express route port. +// authorizationName - the name of the authorization. +func (client ExpressRoutePortAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (result ExpressRoutePortAuthorization, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, expressRoutePortName, authorizationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRoutePortAuthorizationsClient) GetPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "authorizationName": autorest.Encode("path", authorizationName), + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations/{authorizationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortAuthorizationsClient) GetResponder(resp *http.Response) (result ExpressRoutePortAuthorization, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all authorizations in an express route port. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the express route port. +func (client ExpressRoutePortAuthorizationsClient) List(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRoutePortAuthorizationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationsClient.List") + defer func() { + sc := -1 + if result.erpalr.Response.Response != nil { + sc = result.erpalr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, expressRoutePortName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erpalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "List", resp, "Failure sending request") + return + } + + result.erpalr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "List", resp, "Failure responding to request") + return + } + if result.erpalr.hasNextLink() && result.erpalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRoutePortAuthorizationsClient) ListPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRoutePorts/{expressRoutePortName}/authorizations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortAuthorizationsClient) ListResponder(resp *http.Response) (result ExpressRoutePortAuthorizationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRoutePortAuthorizationsClient) listNextResults(ctx context.Context, lastResults ExpressRoutePortAuthorizationListResult) (result ExpressRoutePortAuthorizationListResult, err error) { + req, err := lastResults.expressRoutePortAuthorizationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRoutePortAuthorizationsClient) ListComplete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRoutePortAuthorizationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, expressRoutePortName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressrouteports.go b/services/network/mgmt/2021-08-01/network/expressrouteports.go new file mode 100644 index 000000000000..bec868899b61 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressrouteports.go @@ -0,0 +1,663 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRoutePortsClient is the network Client +type ExpressRoutePortsClient struct { + BaseClient +} + +// NewExpressRoutePortsClient creates an instance of the ExpressRoutePortsClient client. +func NewExpressRoutePortsClient(subscriptionID string) ExpressRoutePortsClient { + return NewExpressRoutePortsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRoutePortsClientWithBaseURI creates an instance of the ExpressRoutePortsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewExpressRoutePortsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRoutePortsClient { + return ExpressRoutePortsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified ExpressRoutePort resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the ExpressRoutePort resource. +// parameters - parameters supplied to the create ExpressRoutePort operation. +func (client ExpressRoutePortsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort) (result ExpressRoutePortsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, expressRoutePortName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ExpressRoutePortsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters ExpressRoutePort) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRoutePortsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRoutePort, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified ExpressRoutePort resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the ExpressRoutePort resource. +func (client ExpressRoutePortsClient) Delete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRoutePortsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, expressRoutePortName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExpressRoutePortsClient) DeletePreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) DeleteSender(req *http.Request) (future ExpressRoutePortsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateLOA generate a letter of authorization for the requested ExpressRoutePort resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of ExpressRoutePort. +// request - request parameters supplied to generate a letter of authorization. +func (client ExpressRoutePortsClient) GenerateLOA(ctx context.Context, resourceGroupName string, expressRoutePortName string, request GenerateExpressRoutePortsLOARequest) (result GenerateExpressRoutePortsLOAResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.GenerateLOA") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.CustomerName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.ExpressRoutePortsClient", "GenerateLOA", err.Error()) + } + + req, err := client.GenerateLOAPreparer(ctx, resourceGroupName, expressRoutePortName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "GenerateLOA", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateLOASender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "GenerateLOA", resp, "Failure sending request") + return + } + + result, err = client.GenerateLOAResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "GenerateLOA", resp, "Failure responding to request") + return + } + + return +} + +// GenerateLOAPreparer prepares the GenerateLOA request. +func (client ExpressRoutePortsClient) GenerateLOAPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, request GenerateExpressRoutePortsLOARequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/expressRoutePorts/{expressRoutePortName}/generateLoa", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateLOASender sends the GenerateLOA request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) GenerateLOASender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateLOAResponder handles the response to the GenerateLOA request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) GenerateLOAResponder(resp *http.Response) (result GenerateExpressRoutePortsLOAResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieves the requested ExpressRoutePort resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of ExpressRoutePort. +func (client ExpressRoutePortsClient) Get(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result ExpressRoutePort, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, expressRoutePortName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRoutePortsClient) GetPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) GetResponder(resp *http.Response) (result ExpressRoutePort, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all the ExpressRoutePort resources in the specified subscription. +func (client ExpressRoutePortsClient) List(ctx context.Context) (result ExpressRoutePortListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.List") + defer func() { + sc := -1 + if result.erplr.Response.Response != nil { + sc = result.erplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "List", resp, "Failure sending request") + return + } + + result.erplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "List", resp, "Failure responding to request") + return + } + if result.erplr.hasNextLink() && result.erplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRoutePortsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePorts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) ListResponder(resp *http.Response) (result ExpressRoutePortListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRoutePortsClient) listNextResults(ctx context.Context, lastResults ExpressRoutePortListResult) (result ExpressRoutePortListResult, err error) { + req, err := lastResults.expressRoutePortListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRoutePortsClient) ListComplete(ctx context.Context) (result ExpressRoutePortListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup list all the ExpressRoutePort resources in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ExpressRoutePortsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRoutePortListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.erplr.Response.Response != nil { + sc = result.erplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.erplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.erplr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.erplr.hasNextLink() && result.erplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ExpressRoutePortsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRoutePortListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ExpressRoutePortsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ExpressRoutePortListResult) (result ExpressRoutePortListResult, err error) { + req, err := lastResults.expressRoutePortListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRoutePortsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ExpressRoutePortListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags update ExpressRoutePort tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// expressRoutePortName - the name of the ExpressRoutePort resource. +// parameters - parameters supplied to update ExpressRoutePort resource tags. +func (client ExpressRoutePortsClient) UpdateTags(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters TagsObject) (result ExpressRoutePort, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, expressRoutePortName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ExpressRoutePortsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "expressRoutePortName": autorest.Encode("path", expressRoutePortName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ExpressRoutePorts/{expressRoutePortName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRoutePort, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressrouteportslocations.go b/services/network/mgmt/2021-08-01/network/expressrouteportslocations.go new file mode 100644 index 000000000000..feca9cf4eddc --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressrouteportslocations.go @@ -0,0 +1,221 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRoutePortsLocationsClient is the network Client +type ExpressRoutePortsLocationsClient struct { + BaseClient +} + +// NewExpressRoutePortsLocationsClient creates an instance of the ExpressRoutePortsLocationsClient client. +func NewExpressRoutePortsLocationsClient(subscriptionID string) ExpressRoutePortsLocationsClient { + return NewExpressRoutePortsLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRoutePortsLocationsClientWithBaseURI creates an instance of the ExpressRoutePortsLocationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewExpressRoutePortsLocationsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRoutePortsLocationsClient { + return ExpressRoutePortsLocationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at +// said peering location. +// Parameters: +// locationName - name of the requested ExpressRoutePort peering location. +func (client ExpressRoutePortsLocationsClient) Get(ctx context.Context, locationName string) (result ExpressRoutePortsLocation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, locationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExpressRoutePortsLocationsClient) GetPreparer(ctx context.Context, locationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "locationName": autorest.Encode("path", locationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations/{locationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsLocationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsLocationsClient) GetResponder(resp *http.Response) (result ExpressRoutePortsLocation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each location. +// Available bandwidths can only be obtained when retrieving a specific peering location. +func (client ExpressRoutePortsLocationsClient) List(ctx context.Context) (result ExpressRoutePortsLocationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationsClient.List") + defer func() { + sc := -1 + if result.erpllr.Response.Response != nil { + sc = result.erpllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erpllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "List", resp, "Failure sending request") + return + } + + result.erpllr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "List", resp, "Failure responding to request") + return + } + if result.erpllr.hasNextLink() && result.erpllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRoutePortsLocationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ExpressRoutePortsLocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRoutePortsLocationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRoutePortsLocationsClient) ListResponder(resp *http.Response) (result ExpressRoutePortsLocationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRoutePortsLocationsClient) listNextResults(ctx context.Context, lastResults ExpressRoutePortsLocationListResult) (result ExpressRoutePortsLocationListResult, err error) { + req, err := lastResults.expressRoutePortsLocationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsLocationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRoutePortsLocationsClient) ListComplete(ctx context.Context) (result ExpressRoutePortsLocationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/expressrouteserviceproviders.go b/services/network/mgmt/2021-08-01/network/expressrouteserviceproviders.go new file mode 100644 index 000000000000..c237501b4d03 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/expressrouteserviceproviders.go @@ -0,0 +1,145 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExpressRouteServiceProvidersClient is the network Client +type ExpressRouteServiceProvidersClient struct { + BaseClient +} + +// NewExpressRouteServiceProvidersClient creates an instance of the ExpressRouteServiceProvidersClient client. +func NewExpressRouteServiceProvidersClient(subscriptionID string) ExpressRouteServiceProvidersClient { + return NewExpressRouteServiceProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExpressRouteServiceProvidersClientWithBaseURI creates an instance of the ExpressRouteServiceProvidersClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteServiceProvidersClient { + return ExpressRouteServiceProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all the available express route service providers. +func (client ExpressRouteServiceProvidersClient) List(ctx context.Context) (result ExpressRouteServiceProviderListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProvidersClient.List") + defer func() { + sc := -1 + if result.ersplr.Response.Response != nil { + sc = result.ersplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ersplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request") + return + } + + result.ersplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request") + return + } + if result.ersplr.hasNextLink() && result.ersplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExpressRouteServiceProvidersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Response) (result ExpressRouteServiceProviderListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExpressRouteServiceProvidersClient) listNextResults(ctx context.Context, lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) { + req, err := lastResults.expressRouteServiceProviderListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExpressRouteServiceProvidersClient) ListComplete(ctx context.Context) (result ExpressRouteServiceProviderListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProvidersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/firewallpolicies.go b/services/network/mgmt/2021-08-01/network/firewallpolicies.go new file mode 100644 index 000000000000..dddc0c3b11f5 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/firewallpolicies.go @@ -0,0 +1,603 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FirewallPoliciesClient is the network Client +type FirewallPoliciesClient struct { + BaseClient +} + +// NewFirewallPoliciesClient creates an instance of the FirewallPoliciesClient client. +func NewFirewallPoliciesClient(subscriptionID string) FirewallPoliciesClient { + return NewFirewallPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallPoliciesClientWithBaseURI creates an instance of the FirewallPoliciesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewFirewallPoliciesClientWithBaseURI(baseURI string, subscriptionID string) FirewallPoliciesClient { + return FirewallPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Firewall Policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// parameters - parameters supplied to the create or update Firewall Policy operation. +func (client FirewallPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy) (result FirewallPoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPPort", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPPort", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPSPort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPSPort", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.HTTPSPort", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.PacFilePort", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.PacFilePort", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.FirewallPolicyPropertiesFormat.ExplicitProxySettings.PacFilePort", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.FirewallPoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, firewallPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters FirewallPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) CreateOrUpdateSender(req *http.Request) (future FirewallPoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Firewall Policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPoliciesClient) Delete(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result FirewallPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) DeleteSender(req *http.Request) (future FirewallPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Firewall Policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// expand - expands referenced resources. +func (client FirewallPoliciesClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, expand string) (result FirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, firewallPolicyName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) GetResponder(resp *http.Response) (result FirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Firewall Policies in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client FirewallPoliciesClient) List(ctx context.Context, resourceGroupName string) (result FirewallPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.List") + defer func() { + sc := -1 + if result.fplr.Response.Response != nil { + sc = result.fplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "List", resp, "Failure sending request") + return + } + + result.fplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.fplr.hasNextLink() && result.fplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) ListResponder(resp *http.Response) (result FirewallPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FirewallPoliciesClient) listNextResults(ctx context.Context, lastResults FirewallPolicyListResult) (result FirewallPolicyListResult, err error) { + req, err := lastResults.firewallPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FirewallPoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result FirewallPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the Firewall Policies in a subscription. +func (client FirewallPoliciesClient) ListAll(ctx context.Context) (result FirewallPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.ListAll") + defer func() { + sc := -1 + if result.fplr.Response.Response != nil { + sc = result.fplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.fplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "ListAll", resp, "Failure sending request") + return + } + + result.fplr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.fplr.hasNextLink() && result.fplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client FirewallPoliciesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) ListAllResponder(resp *http.Response) (result FirewallPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client FirewallPoliciesClient) listAllNextResults(ctx context.Context, lastResults FirewallPolicyListResult) (result FirewallPolicyListResult, err error) { + req, err := lastResults.firewallPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client FirewallPoliciesClient) ListAllComplete(ctx context.Context) (result FirewallPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates tags of a Azure Firewall Policy resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// parameters - parameters supplied to update Azure Firewall Policy tags. +func (client FirewallPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters TagsObject) (result FirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPoliciesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, firewallPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client FirewallPoliciesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPoliciesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client FirewallPoliciesClient) UpdateTagsResponder(resp *http.Response) (result FirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignatures.go b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignatures.go new file mode 100644 index 000000000000..c920b64009a5 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignatures.go @@ -0,0 +1,120 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FirewallPolicyIdpsSignaturesClient is the network Client +type FirewallPolicyIdpsSignaturesClient struct { + BaseClient +} + +// NewFirewallPolicyIdpsSignaturesClient creates an instance of the FirewallPolicyIdpsSignaturesClient client. +func NewFirewallPolicyIdpsSignaturesClient(subscriptionID string) FirewallPolicyIdpsSignaturesClient { + return NewFirewallPolicyIdpsSignaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallPolicyIdpsSignaturesClientWithBaseURI creates an instance of the FirewallPolicyIdpsSignaturesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewFirewallPolicyIdpsSignaturesClientWithBaseURI(baseURI string, subscriptionID string) FirewallPolicyIdpsSignaturesClient { + return FirewallPolicyIdpsSignaturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieves the current status of IDPS signatures for the relevant policy +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject) (result QueryResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ResultsPerPage", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ResultsPerPage", Name: validation.InclusiveMaximum, Rule: int64(1000), Chain: nil}, + {Target: "parameters.ResultsPerPage", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.FirewallPolicyIdpsSignaturesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, firewallPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallPolicyIdpsSignaturesClient) ListPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/firewallPolicies/{firewallPolicyName}/listIdpsSignatures", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesClient) ListResponder(resp *http.Response) (result QueryResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesfiltervalues.go b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesfiltervalues.go new file mode 100644 index 000000000000..576612c8ed27 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesfiltervalues.go @@ -0,0 +1,111 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FirewallPolicyIdpsSignaturesFilterValuesClient is the network Client +type FirewallPolicyIdpsSignaturesFilterValuesClient struct { + BaseClient +} + +// NewFirewallPolicyIdpsSignaturesFilterValuesClient creates an instance of the +// FirewallPolicyIdpsSignaturesFilterValuesClient client. +func NewFirewallPolicyIdpsSignaturesFilterValuesClient(subscriptionID string) FirewallPolicyIdpsSignaturesFilterValuesClient { + return NewFirewallPolicyIdpsSignaturesFilterValuesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallPolicyIdpsSignaturesFilterValuesClientWithBaseURI creates an instance of the +// FirewallPolicyIdpsSignaturesFilterValuesClient client using a custom endpoint. Use this when interacting with an +// Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFirewallPolicyIdpsSignaturesFilterValuesClientWithBaseURI(baseURI string, subscriptionID string) FirewallPolicyIdpsSignaturesFilterValuesClient { + return FirewallPolicyIdpsSignaturesFilterValuesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieves the current filter values for the signatures overrides +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesFilterValuesClient) List(ctx context.Context, parameters SignatureOverridesFilterValuesQuery, resourceGroupName string, firewallPolicyName string) (result SignatureOverridesFilterValuesResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesFilterValuesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, parameters, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesFilterValuesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesFilterValuesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesFilterValuesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallPolicyIdpsSignaturesFilterValuesClient) ListPreparer(ctx context.Context, parameters SignatureOverridesFilterValuesQuery, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesFilterValuesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesFilterValuesClient) ListResponder(resp *http.Response) (result SignatureOverridesFilterValuesResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesoverrides.go b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesoverrides.go new file mode 100644 index 000000000000..6ab55b16199b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/firewallpolicyidpssignaturesoverrides.go @@ -0,0 +1,343 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FirewallPolicyIdpsSignaturesOverridesClient is the network Client +type FirewallPolicyIdpsSignaturesOverridesClient struct { + BaseClient +} + +// NewFirewallPolicyIdpsSignaturesOverridesClient creates an instance of the +// FirewallPolicyIdpsSignaturesOverridesClient client. +func NewFirewallPolicyIdpsSignaturesOverridesClient(subscriptionID string) FirewallPolicyIdpsSignaturesOverridesClient { + return NewFirewallPolicyIdpsSignaturesOverridesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallPolicyIdpsSignaturesOverridesClientWithBaseURI creates an instance of the +// FirewallPolicyIdpsSignaturesOverridesClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFirewallPolicyIdpsSignaturesOverridesClientWithBaseURI(baseURI string, subscriptionID string) FirewallPolicyIdpsSignaturesOverridesClient { + return FirewallPolicyIdpsSignaturesOverridesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get returns all signatures overrides for a specific policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesOverridesClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result SignaturesOverrides, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesOverridesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallPolicyIdpsSignaturesOverridesClient) GetPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesOverridesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesOverridesClient) GetResponder(resp *http.Response) (result SignaturesOverrides, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List returns all signatures overrides objects for a specific policy as a list containing a single value. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesOverridesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result SignaturesOverridesList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesOverridesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallPolicyIdpsSignaturesOverridesClient) ListPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesOverridesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesOverridesClient) ListResponder(resp *http.Response) (result SignaturesOverridesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Patch will update the status of policy's signature overrides for IDPS +// Parameters: +// parameters - will contain all properties of the object to put +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesOverridesClient) Patch(ctx context.Context, parameters SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (result SignaturesOverrides, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesOverridesClient.Patch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, parameters, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Patch", resp, "Failure responding to request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PatchPreparer(ctx context.Context, parameters SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PatchResponder(resp *http.Response) (result SignaturesOverrides, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put will override/create a new signature overrides for the policy's IDPS +// Parameters: +// parameters - will contain all properties of the object to put +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyIdpsSignaturesOverridesClient) Put(ctx context.Context, parameters SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (result SignaturesOverrides, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyIdpsSignaturesOverridesClient.Put") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PutPreparer(ctx, parameters, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyIdpsSignaturesOverridesClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PutPreparer(ctx context.Context, parameters SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client FirewallPolicyIdpsSignaturesOverridesClient) PutResponder(resp *http.Response) (result SignaturesOverrides, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/firewallpolicyrulecollectiongroups.go b/services/network/mgmt/2021-08-01/network/firewallpolicyrulecollectiongroups.go new file mode 100644 index 000000000000..5e93d360c63b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/firewallpolicyrulecollectiongroups.go @@ -0,0 +1,407 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FirewallPolicyRuleCollectionGroupsClient is the network Client +type FirewallPolicyRuleCollectionGroupsClient struct { + BaseClient +} + +// NewFirewallPolicyRuleCollectionGroupsClient creates an instance of the FirewallPolicyRuleCollectionGroupsClient +// client. +func NewFirewallPolicyRuleCollectionGroupsClient(subscriptionID string) FirewallPolicyRuleCollectionGroupsClient { + return NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI creates an instance of the +// FirewallPolicyRuleCollectionGroupsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFirewallPolicyRuleCollectionGroupsClientWithBaseURI(baseURI string, subscriptionID string) FirewallPolicyRuleCollectionGroupsClient { + return FirewallPolicyRuleCollectionGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified FirewallPolicyRuleCollectionGroup. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// ruleCollectionGroupName - the name of the FirewallPolicyRuleCollectionGroup. +// parameters - parameters supplied to the create or update FirewallPolicyRuleCollectionGroup operation. +func (client FirewallPolicyRuleCollectionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup) (result FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FirewallPolicyRuleCollectionGroupProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyRuleCollectionGroupProperties.Priority", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FirewallPolicyRuleCollectionGroupProperties.Priority", Name: validation.InclusiveMaximum, Rule: int64(65000), Chain: nil}, + {Target: "parameters.FirewallPolicyRuleCollectionGroupProperties.Priority", Name: validation.InclusiveMinimum, Rule: int64(100), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.FirewallPolicyRuleCollectionGroupsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FirewallPolicyRuleCollectionGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters FirewallPolicyRuleCollectionGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleCollectionGroupName": autorest.Encode("path", ruleCollectionGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyRuleCollectionGroupsClient) CreateOrUpdateSender(req *http.Request) (future FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FirewallPolicyRuleCollectionGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result FirewallPolicyRuleCollectionGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified FirewallPolicyRuleCollectionGroup. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// ruleCollectionGroupName - the name of the FirewallPolicyRuleCollectionGroup. +func (client FirewallPolicyRuleCollectionGroupsClient) Delete(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (result FirewallPolicyRuleCollectionGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FirewallPolicyRuleCollectionGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleCollectionGroupName": autorest.Encode("path", ruleCollectionGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyRuleCollectionGroupsClient) DeleteSender(req *http.Request) (future FirewallPolicyRuleCollectionGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FirewallPolicyRuleCollectionGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified FirewallPolicyRuleCollectionGroup. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +// ruleCollectionGroupName - the name of the FirewallPolicyRuleCollectionGroup. +func (client FirewallPolicyRuleCollectionGroupsClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (result FirewallPolicyRuleCollectionGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, firewallPolicyName, ruleCollectionGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FirewallPolicyRuleCollectionGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleCollectionGroupName": autorest.Encode("path", ruleCollectionGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups/{ruleCollectionGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyRuleCollectionGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FirewallPolicyRuleCollectionGroupsClient) GetResponder(resp *http.Response) (result FirewallPolicyRuleCollectionGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all FirewallPolicyRuleCollectionGroups in a FirewallPolicy resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// firewallPolicyName - the name of the Firewall Policy. +func (client FirewallPolicyRuleCollectionGroupsClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result FirewallPolicyRuleCollectionGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupsClient.List") + defer func() { + sc := -1 + if result.fprcglr.Response.Response != nil { + sc = result.fprcglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, firewallPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fprcglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "List", resp, "Failure sending request") + return + } + + result.fprcglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.fprcglr.hasNextLink() && result.fprcglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FirewallPolicyRuleCollectionGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string, firewallPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "firewallPolicyName": autorest.Encode("path", firewallPolicyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/ruleCollectionGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FirewallPolicyRuleCollectionGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FirewallPolicyRuleCollectionGroupsClient) ListResponder(resp *http.Response) (result FirewallPolicyRuleCollectionGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FirewallPolicyRuleCollectionGroupsClient) listNextResults(ctx context.Context, lastResults FirewallPolicyRuleCollectionGroupListResult) (result FirewallPolicyRuleCollectionGroupListResult, err error) { + req, err := lastResults.firewallPolicyRuleCollectionGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FirewallPolicyRuleCollectionGroupsClient) ListComplete(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result FirewallPolicyRuleCollectionGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, firewallPolicyName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/flowlogs.go b/services/network/mgmt/2021-08-01/network/flowlogs.go new file mode 100644 index 000000000000..6437b94c0910 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/flowlogs.go @@ -0,0 +1,483 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// FlowLogsClient is the network Client +type FlowLogsClient struct { + BaseClient +} + +// NewFlowLogsClient creates an instance of the FlowLogsClient client. +func NewFlowLogsClient(subscriptionID string) FlowLogsClient { + return NewFlowLogsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFlowLogsClientWithBaseURI creates an instance of the FlowLogsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewFlowLogsClientWithBaseURI(baseURI string, subscriptionID string) FlowLogsClient { + return FlowLogsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a flow log for the specified network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// flowLogName - the name of the flow log. +// parameters - parameters that define the create or update flow log resource. +func (client FlowLogsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog) (result FlowLogsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.FlowLogPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.FlowLogPropertiesFormat.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.FlowLogPropertiesFormat.StorageID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.FlowLogsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FlowLogsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters FlowLog) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "flowLogName": autorest.Encode("path", flowLogName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client FlowLogsClient) CreateOrUpdateSender(req *http.Request) (future FlowLogsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FlowLogsClient) CreateOrUpdateResponder(resp *http.Response) (result FlowLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified flow log resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// flowLogName - the name of the flow log resource. +func (client FlowLogsClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (result FlowLogsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, flowLogName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FlowLogsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "flowLogName": autorest.Encode("path", flowLogName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client FlowLogsClient) DeleteSender(req *http.Request) (future FlowLogsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FlowLogsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a flow log resource by name. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// flowLogName - the name of the flow log resource. +func (client FlowLogsClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (result FlowLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, flowLogName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FlowLogsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "flowLogName": autorest.Encode("path", flowLogName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client FlowLogsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client FlowLogsClient) GetResponder(resp *http.Response) (result FlowLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all flow log resources for the specified Network Watcher. +// Parameters: +// resourceGroupName - the name of the resource group containing Network Watcher. +// networkWatcherName - the name of the Network Watcher resource. +func (client FlowLogsClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result FlowLogListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.List") + defer func() { + sc := -1 + if result.fllr.Response.Response != nil { + sc = result.fllr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fllr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "List", resp, "Failure sending request") + return + } + + result.fllr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "List", resp, "Failure responding to request") + return + } + if result.fllr.hasNextLink() && result.fllr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FlowLogsClient) ListPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FlowLogsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FlowLogsClient) ListResponder(resp *http.Response) (result FlowLogListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FlowLogsClient) listNextResults(ctx context.Context, lastResults FlowLogListResult) (result FlowLogListResult, err error) { + req, err := lastResults.flowLogListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.FlowLogsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.FlowLogsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FlowLogsClient) ListComplete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result FlowLogListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkWatcherName) + return +} + +// UpdateTags update tags of the specified flow log. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// flowLogName - the name of the flow log. +// parameters - parameters supplied to update flow log tags. +func (client FlowLogsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters TagsObject) (result FlowLog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, flowLogName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client FlowLogsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "flowLogName": autorest.Encode("path", flowLogName), + "networkWatcherName": autorest.Encode("path", networkWatcherName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/flowLogs/{flowLogName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client FlowLogsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client FlowLogsClient) UpdateTagsResponder(resp *http.Response) (result FlowLog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/hubroutetables.go b/services/network/mgmt/2021-08-01/network/hubroutetables.go new file mode 100644 index 000000000000..579df8d7267c --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/hubroutetables.go @@ -0,0 +1,393 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// HubRouteTablesClient is the network Client +type HubRouteTablesClient struct { + BaseClient +} + +// NewHubRouteTablesClient creates an instance of the HubRouteTablesClient client. +func NewHubRouteTablesClient(subscriptionID string) HubRouteTablesClient { + return NewHubRouteTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHubRouteTablesClientWithBaseURI creates an instance of the HubRouteTablesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewHubRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) HubRouteTablesClient { + return HubRouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the RouteTable. +// routeTableParameters - parameters supplied to create or update RouteTable. +func (client HubRouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable) (result HubRouteTablesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubRouteTablesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, routeTableName, routeTableParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client HubRouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters HubRouteTable) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + routeTableParameters.Etag = nil + routeTableParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", pathParameters), + autorest.WithJSON(routeTableParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client HubRouteTablesClient) CreateOrUpdateSender(req *http.Request) (future HubRouteTablesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client HubRouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result HubRouteTable, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a RouteTable. +// Parameters: +// resourceGroupName - the resource group name of the RouteTable. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the RouteTable. +func (client HubRouteTablesClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result HubRouteTablesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubRouteTablesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client HubRouteTablesClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client HubRouteTablesClient) DeleteSender(req *http.Request) (future HubRouteTablesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client HubRouteTablesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a RouteTable. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the RouteTable. +func (client HubRouteTablesClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result HubRouteTable, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubRouteTablesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HubRouteTablesClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HubRouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HubRouteTablesClient) GetResponder(resp *http.Response) (result HubRouteTable, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the details of all RouteTables. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client HubRouteTablesClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListHubRouteTablesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubRouteTablesClient.List") + defer func() { + sc := -1 + if result.lhrtr.Response.Response != nil { + sc = result.lhrtr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lhrtr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "List", resp, "Failure sending request") + return + } + + result.lhrtr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "List", resp, "Failure responding to request") + return + } + if result.lhrtr.hasNextLink() && result.lhrtr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client HubRouteTablesClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubRouteTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client HubRouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client HubRouteTablesClient) ListResponder(resp *http.Response) (result ListHubRouteTablesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client HubRouteTablesClient) listNextResults(ctx context.Context, lastResults ListHubRouteTablesResult) (result ListHubRouteTablesResult, err error) { + req, err := lastResults.listHubRouteTablesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client HubRouteTablesClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListHubRouteTablesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubRouteTablesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/hubvirtualnetworkconnections.go b/services/network/mgmt/2021-08-01/network/hubvirtualnetworkconnections.go new file mode 100644 index 000000000000..2e68e70e460f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/hubvirtualnetworkconnections.go @@ -0,0 +1,394 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// HubVirtualNetworkConnectionsClient is the network Client +type HubVirtualNetworkConnectionsClient struct { + BaseClient +} + +// NewHubVirtualNetworkConnectionsClient creates an instance of the HubVirtualNetworkConnectionsClient client. +func NewHubVirtualNetworkConnectionsClient(subscriptionID string) HubVirtualNetworkConnectionsClient { + return NewHubVirtualNetworkConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHubVirtualNetworkConnectionsClientWithBaseURI creates an instance of the HubVirtualNetworkConnectionsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewHubVirtualNetworkConnectionsClientWithBaseURI(baseURI string, subscriptionID string) HubVirtualNetworkConnectionsClient { + return HubVirtualNetworkConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a hub virtual network connection if it doesn't exist else updates the existing one. +// Parameters: +// resourceGroupName - the resource group name of the HubVirtualNetworkConnection. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the HubVirtualNetworkConnection. +// hubVirtualNetworkConnectionParameters - parameters supplied to create or update a hub virtual network +// connection. +func (client HubVirtualNetworkConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection) (result HubVirtualNetworkConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubVirtualNetworkConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, connectionName, hubVirtualNetworkConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client HubVirtualNetworkConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters HubVirtualNetworkConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + hubVirtualNetworkConnectionParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", pathParameters), + autorest.WithJSON(hubVirtualNetworkConnectionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client HubVirtualNetworkConnectionsClient) CreateOrUpdateSender(req *http.Request) (future HubVirtualNetworkConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client HubVirtualNetworkConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result HubVirtualNetworkConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a HubVirtualNetworkConnection. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the HubVirtualNetworkConnection. +func (client HubVirtualNetworkConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result HubVirtualNetworkConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubVirtualNetworkConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client HubVirtualNetworkConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client HubVirtualNetworkConnectionsClient) DeleteSender(req *http.Request) (future HubVirtualNetworkConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client HubVirtualNetworkConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a HubVirtualNetworkConnection. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the vpn connection. +func (client HubVirtualNetworkConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result HubVirtualNetworkConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubVirtualNetworkConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HubVirtualNetworkConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HubVirtualNetworkConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HubVirtualNetworkConnectionsClient) GetResponder(resp *http.Response) (result HubVirtualNetworkConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the details of all HubVirtualNetworkConnections. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client HubVirtualNetworkConnectionsClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListHubVirtualNetworkConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubVirtualNetworkConnectionsClient.List") + defer func() { + sc := -1 + if result.lhvncr.Response.Response != nil { + sc = result.lhvncr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lhvncr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.lhvncr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.lhvncr.hasNextLink() && result.lhvncr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client HubVirtualNetworkConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client HubVirtualNetworkConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client HubVirtualNetworkConnectionsClient) ListResponder(resp *http.Response) (result ListHubVirtualNetworkConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client HubVirtualNetworkConnectionsClient) listNextResults(ctx context.Context, lastResults ListHubVirtualNetworkConnectionsResult) (result ListHubVirtualNetworkConnectionsResult, err error) { + req, err := lastResults.listHubVirtualNetworkConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client HubVirtualNetworkConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListHubVirtualNetworkConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HubVirtualNetworkConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/inboundnatrules.go b/services/network/mgmt/2021-08-01/network/inboundnatrules.go new file mode 100644 index 000000000000..f603374e192e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/inboundnatrules.go @@ -0,0 +1,419 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InboundNatRulesClient is the network Client +type InboundNatRulesClient struct { + BaseClient +} + +// NewInboundNatRulesClient creates an instance of the InboundNatRulesClient client. +func NewInboundNatRulesClient(subscriptionID string) InboundNatRulesClient { + return NewInboundNatRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInboundNatRulesClientWithBaseURI creates an instance of the InboundNatRulesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewInboundNatRulesClientWithBaseURI(baseURI string, subscriptionID string) InboundNatRulesClient { + return InboundNatRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a load balancer inbound NAT rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound NAT rule. +// inboundNatRuleParameters - parameters supplied to the create or update inbound NAT rule operation. +func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (result InboundNatRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: inboundNatRuleParameters, + Constraints: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat.BackendIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.InboundNatRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + inboundNatRuleParameters.Etag = nil + inboundNatRuleParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), + autorest.WithJSON(inboundNatRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (future InboundNatRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InboundNatRulesClient) CreateOrUpdateResponder(resp *http.Response) (result InboundNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified load balancer inbound NAT rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound NAT rule. +func (client InboundNatRulesClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result InboundNatRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client InboundNatRulesClient) DeleteSender(req *http.Request) (future InboundNatRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InboundNatRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified load balancer inbound NAT rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// inboundNatRuleName - the name of the inbound NAT rule. +// expand - expands referenced resources. +func (client InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result InboundNatRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client InboundNatRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InboundNatRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InboundNatRulesClient) GetResponder(resp *http.Response) (result InboundNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the inbound NAT rules in a load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client InboundNatRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRulesClient.List") + defer func() { + sc := -1 + if result.inrlr.Response.Response != nil { + sc = result.inrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.inrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure sending request") + return + } + + result.inrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure responding to request") + return + } + if result.inrlr.hasNextLink() && result.inrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client InboundNatRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InboundNatRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InboundNatRulesClient) ListResponder(resp *http.Response) (result InboundNatRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client InboundNatRulesClient) listNextResults(ctx context.Context, lastResults InboundNatRuleListResult) (result InboundNatRuleListResult, err error) { + req, err := lastResults.inboundNatRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client InboundNatRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/inboundsecurityrule.go b/services/network/mgmt/2021-08-01/network/inboundsecurityrule.go new file mode 100644 index 000000000000..d4279e18a391 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/inboundsecurityrule.go @@ -0,0 +1,119 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InboundSecurityRuleClient is the network Client +type InboundSecurityRuleClient struct { + BaseClient +} + +// NewInboundSecurityRuleClient creates an instance of the InboundSecurityRuleClient client. +func NewInboundSecurityRuleClient(subscriptionID string) InboundSecurityRuleClient { + return NewInboundSecurityRuleClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInboundSecurityRuleClientWithBaseURI creates an instance of the InboundSecurityRuleClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewInboundSecurityRuleClientWithBaseURI(baseURI string, subscriptionID string) InboundSecurityRuleClient { + return InboundSecurityRuleClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Network Virtual Appliance Inbound Security Rules. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of the Network Virtual Appliance. +// ruleCollectionName - the name of security rule collection. +// parameters - parameters supplied to the create or update Network Virtual Appliance Inbound Security Rules +// operation. +func (client InboundSecurityRuleClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule) (result InboundSecurityRuleCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundSecurityRuleClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkVirtualApplianceName, ruleCollectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InboundSecurityRuleClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters InboundSecurityRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "ruleCollectionName": autorest.Encode("path", ruleCollectionName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/inboundSecurityRules/{ruleCollectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InboundSecurityRuleClient) CreateOrUpdateSender(req *http.Request) (future InboundSecurityRuleCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InboundSecurityRuleClient) CreateOrUpdateResponder(resp *http.Response) (result InboundSecurityRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/interfaceipconfigurations.go b/services/network/mgmt/2021-08-01/network/interfaceipconfigurations.go new file mode 100644 index 000000000000..c2675352841f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/interfaceipconfigurations.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InterfaceIPConfigurationsClient is the network Client +type InterfaceIPConfigurationsClient struct { + BaseClient +} + +// NewInterfaceIPConfigurationsClient creates an instance of the InterfaceIPConfigurationsClient client. +func NewInterfaceIPConfigurationsClient(subscriptionID string) InterfaceIPConfigurationsClient { + return NewInterfaceIPConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfaceIPConfigurationsClientWithBaseURI creates an instance of the InterfaceIPConfigurationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewInterfaceIPConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) InterfaceIPConfigurationsClient { + return InterfaceIPConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified network interface ip configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the ip configuration name. +func (client InterfaceIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result InterfaceIPConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, IPConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client InterfaceIPConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InterfaceIPConfigurationsClient) GetResponder(resp *http.Response) (result InterfaceIPConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all ip configurations in a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfaceIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationsClient.List") + defer func() { + sc := -1 + if result.iiclr.Response.Response != nil { + sc = result.iiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.iiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.iiclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.iiclr.hasNextLink() && result.iiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client InterfaceIPConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InterfaceIPConfigurationsClient) ListResponder(resp *http.Response) (result InterfaceIPConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client InterfaceIPConfigurationsClient) listNextResults(ctx context.Context, lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) { + req, err := lastResults.interfaceIPConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfaceIPConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/interfaceloadbalancers.go b/services/network/mgmt/2021-08-01/network/interfaceloadbalancers.go new file mode 100644 index 000000000000..cc49e62e6ecc --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/interfaceloadbalancers.go @@ -0,0 +1,150 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InterfaceLoadBalancersClient is the network Client +type InterfaceLoadBalancersClient struct { + BaseClient +} + +// NewInterfaceLoadBalancersClient creates an instance of the InterfaceLoadBalancersClient client. +func NewInterfaceLoadBalancersClient(subscriptionID string) InterfaceLoadBalancersClient { + return NewInterfaceLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfaceLoadBalancersClientWithBaseURI creates an instance of the InterfaceLoadBalancersClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewInterfaceLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) InterfaceLoadBalancersClient { + return InterfaceLoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all load balancers in a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfaceLoadBalancersClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancersClient.List") + defer func() { + sc := -1 + if result.ilblr.Response.Response != nil { + sc = result.ilblr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ilblr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure sending request") + return + } + + result.ilblr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure responding to request") + return + } + if result.ilblr.hasNextLink() && result.ilblr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client InterfaceLoadBalancersClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceLoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InterfaceLoadBalancersClient) ListResponder(resp *http.Response) (result InterfaceLoadBalancerListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client InterfaceLoadBalancersClient) listNextResults(ctx context.Context, lastResults InterfaceLoadBalancerListResult) (result InterfaceLoadBalancerListResult, err error) { + req, err := lastResults.interfaceLoadBalancerListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfaceLoadBalancersClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/interfacesgroup.go b/services/network/mgmt/2021-08-01/network/interfacesgroup.go new file mode 100644 index 000000000000..d7152bb3fd78 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/interfacesgroup.go @@ -0,0 +1,1598 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InterfacesClient is the network Client +type InterfacesClient struct { + BaseClient +} + +// NewInterfacesClient creates an instance of the InterfacesClient client. +func NewInterfacesClient(subscriptionID string) InterfacesClient { + return NewInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfacesClientWithBaseURI creates an instance of the InterfacesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewInterfacesClientWithBaseURI(baseURI string, subscriptionID string) InterfacesClient { + return InterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// parameters - parameters supplied to the create or update network interface operation. +func (client InterfacesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface) (result InterfacesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkInterfaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters Interface) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (future InterfacesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InterfacesClient) CreateOrUpdateResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfacesClient) Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) DeleteSender(req *http.Request) (future InterfacesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InterfacesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. +func (client InterfacesClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result Interface, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client InterfacesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCloudServiceNetworkInterface get the specified network interface in a cloud service. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +// roleInstanceName - the name of role instance. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. +func (client InterfacesClient) GetCloudServiceNetworkInterface(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, expand string) (result Interface, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.GetCloudServiceNetworkInterface") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCloudServiceNetworkInterfacePreparer(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetCloudServiceNetworkInterface", nil, "Failure preparing request") + return + } + + resp, err := client.GetCloudServiceNetworkInterfaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetCloudServiceNetworkInterface", resp, "Failure sending request") + return + } + + result, err = client.GetCloudServiceNetworkInterfaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetCloudServiceNetworkInterface", resp, "Failure responding to request") + return + } + + return +} + +// GetCloudServiceNetworkInterfacePreparer prepares the GetCloudServiceNetworkInterface request. +func (client InterfacesClient) GetCloudServiceNetworkInterfacePreparer(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleInstanceName": autorest.Encode("path", roleInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCloudServiceNetworkInterfaceSender sends the GetCloudServiceNetworkInterface request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetCloudServiceNetworkInterfaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCloudServiceNetworkInterfaceResponder handles the response to the GetCloudServiceNetworkInterface request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetCloudServiceNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEffectiveRouteTable gets all route tables applied to a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfacesClient) GetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesGetEffectiveRouteTableFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.GetEffectiveRouteTable") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEffectiveRouteTablePreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", nil, "Failure preparing request") + return + } + + result, err = client.GetEffectiveRouteTableSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetEffectiveRouteTable", result.Response(), "Failure sending request") + return + } + + return +} + +// GetEffectiveRouteTablePreparer prepares the GetEffectiveRouteTable request. +func (client InterfacesClient) GetEffectiveRouteTablePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEffectiveRouteTableSender sends the GetEffectiveRouteTable request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetEffectiveRouteTableSender(req *http.Request) (future InterfacesGetEffectiveRouteTableFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetEffectiveRouteTableResponder handles the response to the GetEffectiveRouteTable request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetEffectiveRouteTableResponder(resp *http.Response) (result EffectiveRouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVirtualMachineScaleSetIPConfiguration get the specified network interface ip configuration in a virtual machine +// scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the ip configuration. +// expand - expands referenced resources. +func (client InterfacesClient) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result InterfaceIPConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.GetVirtualMachineScaleSetIPConfiguration") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVirtualMachineScaleSetIPConfigurationPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", nil, "Failure preparing request") + return + } + + resp, err := client.GetVirtualMachineScaleSetIPConfigurationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", resp, "Failure sending request") + return + } + + result, err = client.GetVirtualMachineScaleSetIPConfigurationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetIPConfiguration", resp, "Failure responding to request") + return + } + + return +} + +// GetVirtualMachineScaleSetIPConfigurationPreparer prepares the GetVirtualMachineScaleSetIPConfiguration request. +func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVirtualMachineScaleSetIPConfigurationSender sends the GetVirtualMachineScaleSetIPConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVirtualMachineScaleSetIPConfigurationResponder handles the response to the GetVirtualMachineScaleSetIPConfiguration request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetVirtualMachineScaleSetIPConfigurationResponder(resp *http.Response) (result InterfaceIPConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVirtualMachineScaleSetNetworkInterface get the specified network interface in a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result Interface, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.GetVirtualMachineScaleSetNetworkInterface") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", nil, "Failure preparing request") + return + } + + resp, err := client.GetVirtualMachineScaleSetNetworkInterfaceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure sending request") + return + } + + result, err = client.GetVirtualMachineScaleSetNetworkInterfaceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "GetVirtualMachineScaleSetNetworkInterface", resp, "Failure responding to request") + return + } + + return +} + +// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always +// closes the http.Response Body. +func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network interfaces in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client InterfacesClient) List(ctx context.Context, resourceGroupName string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.List") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "List", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client InterfacesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListComplete(ctx context.Context, resourceGroupName string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all network interfaces in a subscription. +func (client InterfacesClient) ListAll(ctx context.Context) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListAll") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client InterfacesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListAllResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listAllNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListAllComplete(ctx context.Context) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListCloudServiceNetworkInterfaces gets all network interfaces in a cloud service. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +func (client InterfacesClient) ListCloudServiceNetworkInterfaces(ctx context.Context, resourceGroupName string, cloudServiceName string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListCloudServiceNetworkInterfaces") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCloudServiceNetworkInterfacesNextResults + req, err := client.ListCloudServiceNetworkInterfacesPreparer(ctx, resourceGroupName, cloudServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListCloudServiceNetworkInterfacesSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceNetworkInterfaces", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListCloudServiceNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceNetworkInterfaces", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCloudServiceNetworkInterfacesPreparer prepares the ListCloudServiceNetworkInterfaces request. +func (client InterfacesClient) ListCloudServiceNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, cloudServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCloudServiceNetworkInterfacesSender sends the ListCloudServiceNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListCloudServiceNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCloudServiceNetworkInterfacesResponder handles the response to the ListCloudServiceNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListCloudServiceNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCloudServiceNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listCloudServiceNetworkInterfacesNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceNetworkInterfacesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCloudServiceNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceNetworkInterfacesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCloudServiceNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceNetworkInterfacesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCloudServiceNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListCloudServiceNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListCloudServiceNetworkInterfaces") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCloudServiceNetworkInterfaces(ctx, resourceGroupName, cloudServiceName) + return +} + +// ListCloudServiceRoleInstanceNetworkInterfaces gets information about all network interfaces in a role instance in a +// cloud service. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +// roleInstanceName - the name of role instance. +func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfaces(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListCloudServiceRoleInstanceNetworkInterfaces") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCloudServiceRoleInstanceNetworkInterfacesNextResults + req, err := client.ListCloudServiceRoleInstanceNetworkInterfacesPreparer(ctx, resourceGroupName, cloudServiceName, roleInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceRoleInstanceNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListCloudServiceRoleInstanceNetworkInterfacesSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceRoleInstanceNetworkInterfaces", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListCloudServiceRoleInstanceNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListCloudServiceRoleInstanceNetworkInterfaces", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCloudServiceRoleInstanceNetworkInterfacesPreparer prepares the ListCloudServiceRoleInstanceNetworkInterfaces request. +func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleInstanceName": autorest.Encode("path", roleInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCloudServiceRoleInstanceNetworkInterfacesSender sends the ListCloudServiceRoleInstanceNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCloudServiceRoleInstanceNetworkInterfacesResponder handles the response to the ListCloudServiceRoleInstanceNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCloudServiceRoleInstanceNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceRoleInstanceNetworkInterfacesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCloudServiceRoleInstanceNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceRoleInstanceNetworkInterfacesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCloudServiceRoleInstanceNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listCloudServiceRoleInstanceNetworkInterfacesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCloudServiceRoleInstanceNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListCloudServiceRoleInstanceNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListCloudServiceRoleInstanceNetworkInterfaces") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCloudServiceRoleInstanceNetworkInterfaces(ctx, resourceGroupName, cloudServiceName, roleInstanceName) + return +} + +// ListEffectiveNetworkSecurityGroups gets all network security groups applied to a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListEffectiveNetworkSecurityGroups") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListEffectiveNetworkSecurityGroupsPreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", nil, "Failure preparing request") + return + } + + result, err = client.ListEffectiveNetworkSecurityGroupsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListEffectiveNetworkSecurityGroups", result.Response(), "Failure sending request") + return + } + + return +} + +// ListEffectiveNetworkSecurityGroupsPreparer prepares the ListEffectiveNetworkSecurityGroups request. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListEffectiveNetworkSecurityGroupsSender sends the ListEffectiveNetworkSecurityGroups request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsSender(req *http.Request) (future InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListEffectiveNetworkSecurityGroupsResponder handles the response to the ListEffectiveNetworkSecurityGroups request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListEffectiveNetworkSecurityGroupsResponder(resp *http.Response) (result EffectiveNetworkSecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListVirtualMachineScaleSetIPConfigurations get the specified network interface ip configuration in a virtual machine +// scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// expand - expands referenced resources. +func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetIPConfigurations") + defer func() { + sc := -1 + if result.iiclr.Response.Response != nil { + sc = result.iiclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listVirtualMachineScaleSetIPConfigurationsNextResults + req, err := client.ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetIPConfigurationsSender(req) + if err != nil { + result.iiclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", resp, "Failure sending request") + return + } + + result.iiclr, err = client.ListVirtualMachineScaleSetIPConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetIPConfigurations", resp, "Failure responding to request") + return + } + if result.iiclr.hasNextLink() && result.iiclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVirtualMachineScaleSetIPConfigurationsPreparer prepares the ListVirtualMachineScaleSetIPConfigurations request. +func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVirtualMachineScaleSetIPConfigurationsSender sends the ListVirtualMachineScaleSetIPConfigurations request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVirtualMachineScaleSetIPConfigurationsResponder handles the response to the ListVirtualMachineScaleSetIPConfigurations request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsResponder(resp *http.Response) (result InterfaceIPConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVirtualMachineScaleSetIPConfigurationsNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listVirtualMachineScaleSetIPConfigurationsNextResults(ctx context.Context, lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) { + req, err := lastResults.interfaceIPConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVirtualMachineScaleSetIPConfigurationsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVirtualMachineScaleSetIPConfigurationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetIPConfigurationsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVirtualMachineScaleSetIPConfigurationsComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListVirtualMachineScaleSetIPConfigurationsComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result InterfaceIPConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetIPConfigurations") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVirtualMachineScaleSetIPConfigurations(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) + return +} + +// ListVirtualMachineScaleSetNetworkInterfaces gets all network interfaces in a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetNetworkInterfaces") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listVirtualMachineScaleSetNetworkInterfacesNextResults + req, err := client.ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetNetworkInterfaces", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVirtualMachineScaleSetNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listVirtualMachineScaleSetNetworkInterfacesNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVirtualMachineScaleSetNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVirtualMachineScaleSetNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetNetworkInterfacesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVirtualMachineScaleSetNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetNetworkInterfaces") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVirtualMachineScaleSetNetworkInterfaces(ctx, resourceGroupName, virtualMachineScaleSetName) + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfaces gets information about all network interfaces in a virtual machine in +// a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfaces") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listVirtualMachineScaleSetVMNetworkInterfacesNextResults + req, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "ListVirtualMachineScaleSetVMNetworkInterfaces", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always +// closes the http.Response Body. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVirtualMachineScaleSetVMNetworkInterfacesNextResults retrieves the next set of results, if any. +func (client InterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVirtualMachineScaleSetVMNetworkInterfacesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVirtualMachineScaleSetVMNetworkInterfacesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "listVirtualMachineScaleSetVMNetworkInterfacesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVirtualMachineScaleSetVMNetworkInterfacesComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.ListVirtualMachineScaleSetVMNetworkInterfaces") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVirtualMachineScaleSetVMNetworkInterfaces(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex) + return +} + +// UpdateTags updates a network interface tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// parameters - parameters supplied to update network interface tags. +func (client InterfacesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject) (result Interface, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfacesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkInterfaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client InterfacesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client InterfacesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client InterfacesClient) UpdateTagsResponder(resp *http.Response) (result Interface, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/interfacetapconfigurations.go b/services/network/mgmt/2021-08-01/network/interfacetapconfigurations.go new file mode 100644 index 000000000000..bf16177e294e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/interfacetapconfigurations.go @@ -0,0 +1,434 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// InterfaceTapConfigurationsClient is the network Client +type InterfaceTapConfigurationsClient struct { + BaseClient +} + +// NewInterfaceTapConfigurationsClient creates an instance of the InterfaceTapConfigurationsClient client. +func NewInterfaceTapConfigurationsClient(subscriptionID string) InterfaceTapConfigurationsClient { + return NewInterfaceTapConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInterfaceTapConfigurationsClientWithBaseURI creates an instance of the InterfaceTapConfigurationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewInterfaceTapConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) InterfaceTapConfigurationsClient { + return InterfaceTapConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Tap configuration in the specified NetworkInterface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// tapConfigurationName - the name of the tap configuration. +// tapConfigurationParameters - parameters supplied to the create or update tap configuration operation. +func (client InterfaceTapConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration) (result InterfaceTapConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: tapConfigurationParameters, + Constraints: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "tapConfigurationParameters.InterfaceTapConfigurationPropertiesFormat.VirtualNetworkTap.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.InterfaceTapConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName, tapConfigurationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client InterfaceTapConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters InterfaceTapConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapConfigurationName": autorest.Encode("path", tapConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + tapConfigurationParameters.Etag = nil + tapConfigurationParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", pathParameters), + autorest.WithJSON(tapConfigurationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceTapConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future InterfaceTapConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client InterfaceTapConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result InterfaceTapConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified tap configuration from the NetworkInterface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// tapConfigurationName - the name of the tap configuration. +func (client InterfaceTapConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (result InterfaceTapConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client InterfaceTapConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapConfigurationName": autorest.Encode("path", tapConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceTapConfigurationsClient) DeleteSender(req *http.Request) (future InterfaceTapConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client InterfaceTapConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified tap configuration on a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +// tapConfigurationName - the name of the tap configuration. +func (client InterfaceTapConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (result InterfaceTapConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, tapConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client InterfaceTapConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapConfigurationName": autorest.Encode("path", tapConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations/{tapConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceTapConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client InterfaceTapConfigurationsClient) GetResponder(resp *http.Response) (result InterfaceTapConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all Tap configurations in a network interface. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkInterfaceName - the name of the network interface. +func (client InterfaceTapConfigurationsClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceTapConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationsClient.List") + defer func() { + sc := -1 + if result.itclr.Response.Response != nil { + sc = result.itclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.itclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.itclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.itclr.hasNextLink() && result.itclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client InterfaceTapConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/tapConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client InterfaceTapConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client InterfaceTapConfigurationsClient) ListResponder(resp *http.Response) (result InterfaceTapConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client InterfaceTapConfigurationsClient) listNextResults(ctx context.Context, lastResults InterfaceTapConfigurationListResult) (result InterfaceTapConfigurationListResult, err error) { + req, err := lastResults.interfaceTapConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client InterfaceTapConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceTapConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/ipallocations.go b/services/network/mgmt/2021-08-01/network/ipallocations.go new file mode 100644 index 000000000000..764e051e0052 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/ipallocations.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IPAllocationsClient is the network Client +type IPAllocationsClient struct { + BaseClient +} + +// NewIPAllocationsClient creates an instance of the IPAllocationsClient client. +func NewIPAllocationsClient(subscriptionID string) IPAllocationsClient { + return NewIPAllocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIPAllocationsClientWithBaseURI creates an instance of the IPAllocationsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIPAllocationsClientWithBaseURI(baseURI string, subscriptionID string) IPAllocationsClient { + return IPAllocationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an IpAllocation in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPAllocationName - the name of the IpAllocation. +// parameters - parameters supplied to the create or update virtual network operation. +func (client IPAllocationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters IPAllocation) (result IPAllocationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, IPAllocationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IPAllocationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters IPAllocation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipAllocationName": autorest.Encode("path", IPAllocationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) CreateOrUpdateSender(req *http.Request) (future IPAllocationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) CreateOrUpdateResponder(resp *http.Response) (result IPAllocation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified IpAllocation. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPAllocationName - the name of the IpAllocation. +func (client IPAllocationsClient) Delete(ctx context.Context, resourceGroupName string, IPAllocationName string) (result IPAllocationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, IPAllocationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IPAllocationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, IPAllocationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipAllocationName": autorest.Encode("path", IPAllocationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) DeleteSender(req *http.Request) (future IPAllocationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified IpAllocation by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPAllocationName - the name of the IpAllocation. +// expand - expands referenced resources. +func (client IPAllocationsClient) Get(ctx context.Context, resourceGroupName string, IPAllocationName string, expand string) (result IPAllocation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, IPAllocationName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IPAllocationsClient) GetPreparer(ctx context.Context, resourceGroupName string, IPAllocationName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipAllocationName": autorest.Encode("path", IPAllocationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) GetResponder(resp *http.Response) (result IPAllocation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all IpAllocations in a subscription. +func (client IPAllocationsClient) List(ctx context.Context) (result IPAllocationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.List") + defer func() { + sc := -1 + if result.ialr.Response.Response != nil { + sc = result.ialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "List", resp, "Failure sending request") + return + } + + result.ialr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "List", resp, "Failure responding to request") + return + } + if result.ialr.hasNextLink() && result.ialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IPAllocationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/IpAllocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) ListResponder(resp *http.Response) (result IPAllocationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IPAllocationsClient) listNextResults(ctx context.Context, lastResults IPAllocationListResult) (result IPAllocationListResult, err error) { + req, err := lastResults.iPAllocationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IPAllocationsClient) ListComplete(ctx context.Context) (result IPAllocationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all IpAllocations in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client IPAllocationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result IPAllocationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.ialr.Response.Response != nil { + sc = result.ialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.ialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.ialr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.ialr.hasNextLink() && result.ialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IPAllocationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) ListByResourceGroupResponder(resp *http.Response) (result IPAllocationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client IPAllocationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults IPAllocationListResult) (result IPAllocationListResult, err error) { + req, err := lastResults.iPAllocationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client IPAllocationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result IPAllocationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates a IpAllocation tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPAllocationName - the name of the IpAllocation. +// parameters - parameters supplied to update IpAllocation tags. +func (client IPAllocationsClient) UpdateTags(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters TagsObject) (result IPAllocation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, IPAllocationName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client IPAllocationsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipAllocationName": autorest.Encode("path", IPAllocationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/IpAllocations/{ipAllocationName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client IPAllocationsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client IPAllocationsClient) UpdateTagsResponder(resp *http.Response) (result IPAllocation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/ipgroups.go b/services/network/mgmt/2021-08-01/network/ipgroups.go new file mode 100644 index 000000000000..ec763e6966c1 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/ipgroups.go @@ -0,0 +1,581 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// IPGroupsClient is the network Client +type IPGroupsClient struct { + BaseClient +} + +// NewIPGroupsClient creates an instance of the IPGroupsClient client. +func NewIPGroupsClient(subscriptionID string) IPGroupsClient { + return NewIPGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewIPGroupsClientWithBaseURI creates an instance of the IPGroupsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewIPGroupsClientWithBaseURI(baseURI string, subscriptionID string) IPGroupsClient { + return IPGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an ipGroups in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPGroupsName - the name of the ipGroups. +// parameters - parameters supplied to the create or update IpGroups operation. +func (client IPGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters IPGroup) (result IPGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, IPGroupsName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IPGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters IPGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipGroupsName": autorest.Encode("path", IPGroupsName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) CreateOrUpdateSender(req *http.Request) (future IPGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result IPGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified ipGroups. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPGroupsName - the name of the ipGroups. +func (client IPGroupsClient) Delete(ctx context.Context, resourceGroupName string, IPGroupsName string) (result IPGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, IPGroupsName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IPGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, IPGroupsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipGroupsName": autorest.Encode("path", IPGroupsName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) DeleteSender(req *http.Request) (future IPGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified ipGroups. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPGroupsName - the name of the ipGroups. +// expand - expands resourceIds (of Firewalls/Network Security Groups etc.) back referenced by the IpGroups +// resource. +func (client IPGroupsClient) Get(ctx context.Context, resourceGroupName string, IPGroupsName string, expand string) (result IPGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, IPGroupsName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client IPGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, IPGroupsName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipGroupsName": autorest.Encode("path", IPGroupsName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) GetResponder(resp *http.Response) (result IPGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all IpGroups in a subscription. +func (client IPGroupsClient) List(ctx context.Context) (result IPGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.List") + defer func() { + sc := -1 + if result.iglr.Response.Response != nil { + sc = result.iglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.iglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "List", resp, "Failure sending request") + return + } + + result.iglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.iglr.hasNextLink() && result.iglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client IPGroupsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ipGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) ListResponder(resp *http.Response) (result IPGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client IPGroupsClient) listNextResults(ctx context.Context, lastResults IPGroupListResult) (result IPGroupListResult, err error) { + req, err := lastResults.iPGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.IPGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.IPGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client IPGroupsClient) ListComplete(ctx context.Context) (result IPGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all IpGroups in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client IPGroupsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result IPGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.iglr.Response.Response != nil { + sc = result.iglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.iglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.iglr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.iglr.hasNextLink() && result.iglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client IPGroupsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) ListByResourceGroupResponder(resp *http.Response) (result IPGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client IPGroupsClient) listByResourceGroupNextResults(ctx context.Context, lastResults IPGroupListResult) (result IPGroupListResult, err error) { + req, err := lastResults.iPGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.IPGroupsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.IPGroupsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client IPGroupsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result IPGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateGroups updates tags of an IpGroups resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// IPGroupsName - the name of the ipGroups. +// parameters - parameters supplied to the update ipGroups operation. +func (client IPGroupsClient) UpdateGroups(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters TagsObject) (result IPGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupsClient.UpdateGroups") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateGroupsPreparer(ctx, resourceGroupName, IPGroupsName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "UpdateGroups", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateGroupsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "UpdateGroups", resp, "Failure sending request") + return + } + + result, err = client.UpdateGroupsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsClient", "UpdateGroups", resp, "Failure responding to request") + return + } + + return +} + +// UpdateGroupsPreparer prepares the UpdateGroups request. +func (client IPGroupsClient) UpdateGroupsPreparer(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipGroupsName": autorest.Encode("path", IPGroupsName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ipGroups/{ipGroupsName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateGroupsSender sends the UpdateGroups request. The method will close the +// http.Response Body if it receives an error. +func (client IPGroupsClient) UpdateGroupsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateGroupsResponder handles the response to the UpdateGroups request. The method always +// closes the http.Response Body. +func (client IPGroupsClient) UpdateGroupsResponder(resp *http.Response) (result IPGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancerbackendaddresspools.go b/services/network/mgmt/2021-08-01/network/loadbalancerbackendaddresspools.go new file mode 100644 index 000000000000..8f5cf4c572b0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancerbackendaddresspools.go @@ -0,0 +1,394 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerBackendAddressPoolsClient is the network Client +type LoadBalancerBackendAddressPoolsClient struct { + BaseClient +} + +// NewLoadBalancerBackendAddressPoolsClient creates an instance of the LoadBalancerBackendAddressPoolsClient client. +func NewLoadBalancerBackendAddressPoolsClient(subscriptionID string) LoadBalancerBackendAddressPoolsClient { + return NewLoadBalancerBackendAddressPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerBackendAddressPoolsClientWithBaseURI creates an instance of the LoadBalancerBackendAddressPoolsClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewLoadBalancerBackendAddressPoolsClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerBackendAddressPoolsClient { + return LoadBalancerBackendAddressPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a load balancer backend address pool. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// backendAddressPoolName - the name of the backend address pool. +// parameters - parameters supplied to the create or update load balancer backend address pool operation. +func (client LoadBalancerBackendAddressPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool) (result LoadBalancerBackendAddressPoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LoadBalancerBackendAddressPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters BackendAddressPool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendAddressPoolName": autorest.Encode("path", backendAddressPoolName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerBackendAddressPoolsClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancerBackendAddressPoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LoadBalancerBackendAddressPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result BackendAddressPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified load balancer backend address pool. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// backendAddressPoolName - the name of the backend address pool. +func (client LoadBalancerBackendAddressPoolsClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result LoadBalancerBackendAddressPoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LoadBalancerBackendAddressPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendAddressPoolName": autorest.Encode("path", backendAddressPoolName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerBackendAddressPoolsClient) DeleteSender(req *http.Request) (future LoadBalancerBackendAddressPoolsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LoadBalancerBackendAddressPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets load balancer backend address pool. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// backendAddressPoolName - the name of the backend address pool. +func (client LoadBalancerBackendAddressPoolsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result BackendAddressPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendAddressPoolName": autorest.Encode("path", backendAddressPoolName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerBackendAddressPoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancerBackendAddressPoolsClient) GetResponder(resp *http.Response) (result BackendAddressPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancer backed address pools. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerBackendAddressPoolsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolsClient.List") + defer func() { + sc := -1 + if result.lbbaplr.Response.Response != nil { + sc = result.lbbaplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lbbaplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure sending request") + return + } + + result.lbbaplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure responding to request") + return + } + if result.lbbaplr.hasNextLink() && result.lbbaplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerBackendAddressPoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerBackendAddressPoolsClient) ListResponder(resp *http.Response) (result LoadBalancerBackendAddressPoolListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerBackendAddressPoolsClient) listNextResults(ctx context.Context, lastResults LoadBalancerBackendAddressPoolListResult) (result LoadBalancerBackendAddressPoolListResult, err error) { + req, err := lastResults.loadBalancerBackendAddressPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerBackendAddressPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancerfrontendipconfigurations.go b/services/network/mgmt/2021-08-01/network/loadbalancerfrontendipconfigurations.go new file mode 100644 index 000000000000..89fcfa437255 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancerfrontendipconfigurations.go @@ -0,0 +1,229 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerFrontendIPConfigurationsClient is the network Client +type LoadBalancerFrontendIPConfigurationsClient struct { + BaseClient +} + +// NewLoadBalancerFrontendIPConfigurationsClient creates an instance of the LoadBalancerFrontendIPConfigurationsClient +// client. +func NewLoadBalancerFrontendIPConfigurationsClient(subscriptionID string) LoadBalancerFrontendIPConfigurationsClient { + return NewLoadBalancerFrontendIPConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerFrontendIPConfigurationsClientWithBaseURI creates an instance of the +// LoadBalancerFrontendIPConfigurationsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLoadBalancerFrontendIPConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerFrontendIPConfigurationsClient { + return LoadBalancerFrontendIPConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets load balancer frontend IP configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// frontendIPConfigurationName - the name of the frontend IP configuration. +func (client LoadBalancerFrontendIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result FrontendIPConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, frontendIPConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "frontendIPConfigurationName": autorest.Encode("path", frontendIPConfigurationName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerFrontendIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancerFrontendIPConfigurationsClient) GetResponder(resp *http.Response) (result FrontendIPConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancer frontend IP configurations. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerFrontendIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationsClient.List") + defer func() { + sc := -1 + if result.lbficlr.Response.Response != nil { + sc = result.lbficlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lbficlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.lbficlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.lbficlr.hasNextLink() && result.lbficlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerFrontendIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerFrontendIPConfigurationsClient) ListResponder(resp *http.Response) (result LoadBalancerFrontendIPConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerFrontendIPConfigurationsClient) listNextResults(ctx context.Context, lastResults LoadBalancerFrontendIPConfigurationListResult) (result LoadBalancerFrontendIPConfigurationListResult, err error) { + req, err := lastResults.loadBalancerFrontendIPConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerFrontendIPConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancerloadbalancingrules.go b/services/network/mgmt/2021-08-01/network/loadbalancerloadbalancingrules.go new file mode 100644 index 000000000000..61d0a0eb6ad6 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancerloadbalancingrules.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerLoadBalancingRulesClient is the network Client +type LoadBalancerLoadBalancingRulesClient struct { + BaseClient +} + +// NewLoadBalancerLoadBalancingRulesClient creates an instance of the LoadBalancerLoadBalancingRulesClient client. +func NewLoadBalancerLoadBalancingRulesClient(subscriptionID string) LoadBalancerLoadBalancingRulesClient { + return NewLoadBalancerLoadBalancingRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerLoadBalancingRulesClientWithBaseURI creates an instance of the LoadBalancerLoadBalancingRulesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewLoadBalancerLoadBalancingRulesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerLoadBalancingRulesClient { + return LoadBalancerLoadBalancingRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified load balancer load balancing rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// loadBalancingRuleName - the name of the load balancing rule. +func (client LoadBalancerLoadBalancingRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result LoadBalancingRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, loadBalancingRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "loadBalancingRuleName": autorest.Encode("path", loadBalancingRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerLoadBalancingRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancerLoadBalancingRulesClient) GetResponder(resp *http.Response) (result LoadBalancingRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancing rules in a load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerLoadBalancingRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRulesClient.List") + defer func() { + sc := -1 + if result.lblbrlr.Response.Response != nil { + sc = result.lblbrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lblbrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure sending request") + return + } + + result.lblbrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure responding to request") + return + } + if result.lblbrlr.hasNextLink() && result.lblbrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerLoadBalancingRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerLoadBalancingRulesClient) ListResponder(resp *http.Response) (result LoadBalancerLoadBalancingRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerLoadBalancingRulesClient) listNextResults(ctx context.Context, lastResults LoadBalancerLoadBalancingRuleListResult) (result LoadBalancerLoadBalancingRuleListResult, err error) { + req, err := lastResults.loadBalancerLoadBalancingRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerLoadBalancingRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancernetworkinterfaces.go b/services/network/mgmt/2021-08-01/network/loadbalancernetworkinterfaces.go new file mode 100644 index 000000000000..979d6bbc8d46 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancernetworkinterfaces.go @@ -0,0 +1,150 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerNetworkInterfacesClient is the network Client +type LoadBalancerNetworkInterfacesClient struct { + BaseClient +} + +// NewLoadBalancerNetworkInterfacesClient creates an instance of the LoadBalancerNetworkInterfacesClient client. +func NewLoadBalancerNetworkInterfacesClient(subscriptionID string) LoadBalancerNetworkInterfacesClient { + return NewLoadBalancerNetworkInterfacesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerNetworkInterfacesClientWithBaseURI creates an instance of the LoadBalancerNetworkInterfacesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewLoadBalancerNetworkInterfacesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerNetworkInterfacesClient { + return LoadBalancerNetworkInterfacesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets associated load balancer network interfaces. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerNetworkInterfacesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InterfaceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerNetworkInterfacesClient.List") + defer func() { + sc := -1 + if result.ilr.Response.Response != nil { + sc = result.ilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure sending request") + return + } + + result.ilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure responding to request") + return + } + if result.ilr.hasNextLink() && result.ilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerNetworkInterfacesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerNetworkInterfacesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerNetworkInterfacesClient) ListResponder(resp *http.Response) (result InterfaceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerNetworkInterfacesClient) listNextResults(ctx context.Context, lastResults InterfaceListResult) (result InterfaceListResult, err error) { + req, err := lastResults.interfaceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerNetworkInterfacesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InterfaceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerNetworkInterfacesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalanceroutboundrules.go b/services/network/mgmt/2021-08-01/network/loadbalanceroutboundrules.go new file mode 100644 index 000000000000..c0a7ee956cb1 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalanceroutboundrules.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerOutboundRulesClient is the network Client +type LoadBalancerOutboundRulesClient struct { + BaseClient +} + +// NewLoadBalancerOutboundRulesClient creates an instance of the LoadBalancerOutboundRulesClient client. +func NewLoadBalancerOutboundRulesClient(subscriptionID string) LoadBalancerOutboundRulesClient { + return NewLoadBalancerOutboundRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerOutboundRulesClientWithBaseURI creates an instance of the LoadBalancerOutboundRulesClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewLoadBalancerOutboundRulesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerOutboundRulesClient { + return LoadBalancerOutboundRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified load balancer outbound rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// outboundRuleName - the name of the outbound rule. +func (client LoadBalancerOutboundRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, outboundRuleName string) (result OutboundRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, outboundRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancerOutboundRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, outboundRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "outboundRuleName": autorest.Encode("path", outboundRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerOutboundRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancerOutboundRulesClient) GetResponder(resp *http.Response) (result OutboundRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the outbound rules in a load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerOutboundRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerOutboundRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRulesClient.List") + defer func() { + sc := -1 + if result.lborlr.Response.Response != nil { + sc = result.lborlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lborlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "List", resp, "Failure sending request") + return + } + + result.lborlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "List", resp, "Failure responding to request") + return + } + if result.lborlr.hasNextLink() && result.lborlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerOutboundRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerOutboundRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerOutboundRulesClient) ListResponder(resp *http.Response) (result LoadBalancerOutboundRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerOutboundRulesClient) listNextResults(ctx context.Context, lastResults LoadBalancerOutboundRuleListResult) (result LoadBalancerOutboundRuleListResult, err error) { + req, err := lastResults.loadBalancerOutboundRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerOutboundRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerOutboundRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerOutboundRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancerprobes.go b/services/network/mgmt/2021-08-01/network/loadbalancerprobes.go new file mode 100644 index 000000000000..e6f4119d9d0a --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancerprobes.go @@ -0,0 +1,228 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancerProbesClient is the network Client +type LoadBalancerProbesClient struct { + BaseClient +} + +// NewLoadBalancerProbesClient creates an instance of the LoadBalancerProbesClient client. +func NewLoadBalancerProbesClient(subscriptionID string) LoadBalancerProbesClient { + return NewLoadBalancerProbesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancerProbesClientWithBaseURI creates an instance of the LoadBalancerProbesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewLoadBalancerProbesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerProbesClient { + return LoadBalancerProbesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets load balancer probe. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// probeName - the name of the probe. +func (client LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, probeName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancerProbesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "probeName": autorest.Encode("path", probeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerProbesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancerProbesClient) GetResponder(resp *http.Response) (result Probe, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancer probes. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancerProbesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbesClient.List") + defer func() { + sc := -1 + if result.lbplr.Response.Response != nil { + sc = result.lbplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lbplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure sending request") + return + } + + result.lbplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure responding to request") + return + } + if result.lbplr.hasNextLink() && result.lbplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancerProbesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancerProbesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancerProbesClient) ListResponder(resp *http.Response) (result LoadBalancerProbeListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancerProbesClient) listNextResults(ctx context.Context, lastResults LoadBalancerProbeListResult) (result LoadBalancerProbeListResult, err error) { + req, err := lastResults.loadBalancerProbeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancerProbesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/loadbalancers.go b/services/network/mgmt/2021-08-01/network/loadbalancers.go new file mode 100644 index 000000000000..47a59550a3ba --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/loadbalancers.go @@ -0,0 +1,743 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LoadBalancersClient is the network Client +type LoadBalancersClient struct { + BaseClient +} + +// NewLoadBalancersClient creates an instance of the LoadBalancersClient client. +func NewLoadBalancersClient(subscriptionID string) LoadBalancersClient { + return NewLoadBalancersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLoadBalancersClientWithBaseURI creates an instance of the LoadBalancersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancersClient { + return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// parameters - parameters supplied to the create or update load balancer operation. +func (client LoadBalancersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (result LoadBalancer, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +func (client LoadBalancersClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) DeleteSender(req *http.Request) (future LoadBalancersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified load balancer. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// expand - expands referenced resources. +func (client LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LoadBalancersClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) GetResponder(resp *http.Response) (result LoadBalancer, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the load balancers in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client LoadBalancersClient) List(ctx context.Context, resourceGroupName string) (result LoadBalancerListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.List") + defer func() { + sc := -1 + if result.lblr.Response.Response != nil { + sc = result.lblr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lblr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request") + return + } + + result.lblr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request") + return + } + if result.lblr.hasNextLink() && result.lblr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LoadBalancersClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) ListResponder(resp *http.Response) (result LoadBalancerListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LoadBalancersClient) listNextResults(ctx context.Context, lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { + req, err := lastResults.loadBalancerListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancersClient) ListComplete(ctx context.Context, resourceGroupName string) (result LoadBalancerListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the load balancers in a subscription. +func (client LoadBalancersClient) ListAll(ctx context.Context) (result LoadBalancerListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.ListAll") + defer func() { + sc := -1 + if result.lblr.Response.Response != nil { + sc = result.lblr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.lblr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request") + return + } + + result.lblr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request") + return + } + if result.lblr.hasNextLink() && result.lblr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client LoadBalancersClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result LoadBalancerListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client LoadBalancersClient) listAllNextResults(ctx context.Context, lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { + req, err := lastResults.loadBalancerListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client LoadBalancersClient) ListAllComplete(ctx context.Context) (result LoadBalancerListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListInboundNatRulePortMappings list of inbound NAT rule port mappings. +// Parameters: +// groupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// backendPoolName - the name of the load balancer backend address pool. +// parameters - query inbound NAT rule port mapping request. +func (client LoadBalancersClient) ListInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest) (result LoadBalancersListInboundNatRulePortMappingsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.ListInboundNatRulePortMappings") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListInboundNatRulePortMappingsPreparer(ctx, groupName, loadBalancerName, backendPoolName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListInboundNatRulePortMappings", nil, "Failure preparing request") + return + } + + result, err = client.ListInboundNatRulePortMappingsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListInboundNatRulePortMappings", result.Response(), "Failure sending request") + return + } + + return +} + +// ListInboundNatRulePortMappingsPreparer prepares the ListInboundNatRulePortMappings request. +func (client LoadBalancersClient) ListInboundNatRulePortMappingsPreparer(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "backendPoolName": autorest.Encode("path", backendPoolName), + "groupName": autorest.Encode("path", groupName), + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListInboundNatRulePortMappingsSender sends the ListInboundNatRulePortMappings request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) ListInboundNatRulePortMappingsSender(req *http.Request) (future LoadBalancersListInboundNatRulePortMappingsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListInboundNatRulePortMappingsResponder handles the response to the ListInboundNatRulePortMappings request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) ListInboundNatRulePortMappingsResponder(resp *http.Response) (result BackendAddressInboundNatRulePortMappings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SwapPublicIPAddresses swaps VIPs between two load balancers. +// Parameters: +// location - the region where load balancers are located at. +// parameters - parameters that define which VIPs should be swapped. +func (client LoadBalancersClient) SwapPublicIPAddresses(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest) (result LoadBalancersSwapPublicIPAddressesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.SwapPublicIPAddresses") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SwapPublicIPAddressesPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "SwapPublicIPAddresses", nil, "Failure preparing request") + return + } + + result, err = client.SwapPublicIPAddressesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "SwapPublicIPAddresses", result.Response(), "Failure sending request") + return + } + + return +} + +// SwapPublicIPAddressesPreparer prepares the SwapPublicIPAddresses request. +func (client LoadBalancersClient) SwapPublicIPAddressesPreparer(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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}/providers/Microsoft.Network/locations/{location}/setLoadBalancerFrontendPublicIpAddresses", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SwapPublicIPAddressesSender sends the SwapPublicIPAddresses request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) SwapPublicIPAddressesSender(req *http.Request) (future LoadBalancersSwapPublicIPAddressesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SwapPublicIPAddressesResponder handles the response to the SwapPublicIPAddresses request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) SwapPublicIPAddressesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateTags updates a load balancer tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// loadBalancerName - the name of the load balancer. +// parameters - parameters supplied to update load balancer tags. +func (client LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (result LoadBalancer, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancersClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, loadBalancerName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "loadBalancerName": autorest.Encode("path", loadBalancerName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client LoadBalancersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client LoadBalancersClient) UpdateTagsResponder(resp *http.Response) (result LoadBalancer, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/localnetworkgateways.go b/services/network/mgmt/2021-08-01/network/localnetworkgateways.go new file mode 100644 index 000000000000..c7cd62e8c913 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/localnetworkgateways.go @@ -0,0 +1,498 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// LocalNetworkGatewaysClient is the network Client +type LocalNetworkGatewaysClient struct { + BaseClient +} + +// NewLocalNetworkGatewaysClient creates an instance of the LocalNetworkGatewaysClient client. +func NewLocalNetworkGatewaysClient(subscriptionID string) LocalNetworkGatewaysClient { + return NewLocalNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocalNetworkGatewaysClientWithBaseURI creates an instance of the LocalNetworkGatewaysClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) LocalNetworkGatewaysClient { + return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a local network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +// parameters - parameters supplied to the create or update local network gateway operation. +func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (result LocalNetworkGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.LocalNetworkGatewaysClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result LocalNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified local network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.LocalNetworkGatewaysClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, localNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified local network gateway in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.LocalNetworkGatewaysClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, localNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (result LocalNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the local network gateways in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client LocalNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.List") + defer func() { + sc := -1 + if result.lnglr.Response.Response != nil { + sc = result.lnglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lnglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.lnglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.lnglr.hasNextLink() && result.lnglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (result LocalNetworkGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LocalNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) { + req, err := lastResults.localNetworkGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocalNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// UpdateTags updates a local network gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// localNetworkGatewayName - the name of the local network gateway. +// parameters - parameters supplied to update local network gateway tags. +func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (result LocalNetworkGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: localNetworkGatewayName, + Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.LocalNetworkGatewaysClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client LocalNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client LocalNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result LocalNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/models.go b/services/network/mgmt/2021-08-01/network/models.go new file mode 100644 index 000000000000..ee35642a9804 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/models.go @@ -0,0 +1,51679 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" + +// AadAuthenticationParameters AAD Vpn authentication type related parameters. +type AadAuthenticationParameters struct { + // AadTenant - AAD Vpn authentication parameter AAD tenant. + AadTenant *string `json:"aadTenant,omitempty"` + // AadAudience - AAD Vpn authentication parameter AAD audience. + AadAudience *string `json:"aadAudience,omitempty"` + // AadIssuer - AAD Vpn authentication parameter AAD issuer. + AadIssuer *string `json:"aadIssuer,omitempty"` +} + +// AddressSpace addressSpace contains an array of IP address ranges that can be used by subnets of the +// virtual network. +type AddressSpace struct { + // AddressPrefixes - A list of address blocks reserved for this virtual network in CIDR notation. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` +} + +// ApplicationGateway application gateway resource. +type ApplicationGateway struct { + autorest.Response `json:"-"` + // ApplicationGatewayPropertiesFormat - Properties of the application gateway. + *ApplicationGatewayPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting where the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // Identity - The identity of the application gateway, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGateway. +func (ag ApplicationGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ag.ApplicationGatewayPropertiesFormat != nil { + objectMap["properties"] = ag.ApplicationGatewayPropertiesFormat + } + if ag.Zones != nil { + objectMap["zones"] = ag.Zones + } + if ag.Identity != nil { + objectMap["identity"] = ag.Identity + } + if ag.ID != nil { + objectMap["id"] = ag.ID + } + if ag.Location != nil { + objectMap["location"] = ag.Location + } + if ag.Tags != nil { + objectMap["tags"] = ag.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGateway struct. +func (ag *ApplicationGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPropertiesFormat ApplicationGatewayPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayPropertiesFormat) + if err != nil { + return err + } + ag.ApplicationGatewayPropertiesFormat = &applicationGatewayPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ag.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + ag.Zones = &zones + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + ag.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ag.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ag.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ag.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ag.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ag.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayAuthenticationCertificate authentication certificates of an application gateway. +type ApplicationGatewayAuthenticationCertificate struct { + // ApplicationGatewayAuthenticationCertificatePropertiesFormat - Properties of the application gateway authentication certificate. + *ApplicationGatewayAuthenticationCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the authentication certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificate. +func (agac ApplicationGatewayAuthenticationCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat != nil { + objectMap["properties"] = agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat + } + if agac.Name != nil { + objectMap["name"] = agac.Name + } + if agac.ID != nil { + objectMap["id"] = agac.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAuthenticationCertificate struct. +func (agac *ApplicationGatewayAuthenticationCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayAuthenticationCertificatePropertiesFormat ApplicationGatewayAuthenticationCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayAuthenticationCertificatePropertiesFormat) + if err != nil { + return err + } + agac.ApplicationGatewayAuthenticationCertificatePropertiesFormat = &applicationGatewayAuthenticationCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agac.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agac.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agac.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agac.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayAuthenticationCertificatePropertiesFormat authentication certificates properties of an +// application gateway. +type ApplicationGatewayAuthenticationCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authentication certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAuthenticationCertificatePropertiesFormat. +func (agacpf ApplicationGatewayAuthenticationCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agacpf.Data != nil { + objectMap["data"] = agacpf.Data + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayAutoscaleConfiguration application Gateway autoscale configuration. +type ApplicationGatewayAutoscaleConfiguration struct { + // MinCapacity - Lower bound on number of Application Gateway capacity. + MinCapacity *int32 `json:"minCapacity,omitempty"` + // MaxCapacity - Upper bound on number of Application Gateway capacity. + MaxCapacity *int32 `json:"maxCapacity,omitempty"` +} + +// ApplicationGatewayAvailableSslOptions response for ApplicationGatewayAvailableSslOptions API service +// call. +type ApplicationGatewayAvailableSslOptions struct { + autorest.Response `json:"-"` + // ApplicationGatewayAvailableSslOptionsPropertiesFormat - Properties of the application gateway available SSL options. + *ApplicationGatewayAvailableSslOptionsPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayAvailableSslOptions. +func (agaso ApplicationGatewayAvailableSslOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat != nil { + objectMap["properties"] = agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat + } + if agaso.ID != nil { + objectMap["id"] = agaso.ID + } + if agaso.Location != nil { + objectMap["location"] = agaso.Location + } + if agaso.Tags != nil { + objectMap["tags"] = agaso.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayAvailableSslOptions struct. +func (agaso *ApplicationGatewayAvailableSslOptions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayAvailableSslOptionsPropertiesFormat ApplicationGatewayAvailableSslOptionsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayAvailableSslOptionsPropertiesFormat) + if err != nil { + return err + } + agaso.ApplicationGatewayAvailableSslOptionsPropertiesFormat = &applicationGatewayAvailableSslOptionsPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agaso.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agaso.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agaso.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agaso.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agaso.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayAvailableSslOptionsPropertiesFormat properties of +// ApplicationGatewayAvailableSslOptions. +type ApplicationGatewayAvailableSslOptionsPropertiesFormat struct { + // PredefinedPolicies - List of available Ssl predefined policy. + PredefinedPolicies *[]SubResource `json:"predefinedPolicies,omitempty"` + // DefaultPolicy - Name of the Ssl predefined policy applied by default to application gateway. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S' + DefaultPolicy ApplicationGatewaySslPolicyName `json:"defaultPolicy,omitempty"` + // AvailableCipherSuites - List of available Ssl cipher suites. + AvailableCipherSuites *[]ApplicationGatewaySslCipherSuite `json:"availableCipherSuites,omitempty"` + // AvailableProtocols - List of available Ssl protocols. + AvailableProtocols *[]ApplicationGatewaySslProtocol `json:"availableProtocols,omitempty"` +} + +// ApplicationGatewayAvailableSslPredefinedPolicies response for ApplicationGatewayAvailableSslOptions API +// service call. +type ApplicationGatewayAvailableSslPredefinedPolicies struct { + autorest.Response `json:"-"` + // Value - List of available Ssl predefined policy. + Value *[]ApplicationGatewaySslPredefinedPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayAvailableSslPredefinedPoliciesIterator provides access to a complete listing of +// ApplicationGatewaySslPredefinedPolicy values. +type ApplicationGatewayAvailableSslPredefinedPoliciesIterator struct { + i int + page ApplicationGatewayAvailableSslPredefinedPoliciesPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Response() ApplicationGatewayAvailableSslPredefinedPolicies { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayAvailableSslPredefinedPoliciesIterator) Value() ApplicationGatewaySslPredefinedPolicy { + if !iter.page.NotDone() { + return ApplicationGatewaySslPredefinedPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesIterator type. +func NewApplicationGatewayAvailableSslPredefinedPoliciesIterator(page ApplicationGatewayAvailableSslPredefinedPoliciesPage) ApplicationGatewayAvailableSslPredefinedPoliciesIterator { + return ApplicationGatewayAvailableSslPredefinedPoliciesIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) IsEmpty() bool { + return agaspp.Value == nil || len(*agaspp.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) hasNextLink() bool { + return agaspp.NextLink != nil && len(*agaspp.NextLink) != 0 +} + +// applicationGatewayAvailableSslPredefinedPoliciesPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agaspp ApplicationGatewayAvailableSslPredefinedPolicies) applicationGatewayAvailableSslPredefinedPoliciesPreparer(ctx context.Context) (*http.Request, error) { + if !agaspp.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agaspp.NextLink))) +} + +// ApplicationGatewayAvailableSslPredefinedPoliciesPage contains a page of +// ApplicationGatewaySslPredefinedPolicy values. +type ApplicationGatewayAvailableSslPredefinedPoliciesPage struct { + fn func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error) + agaspp ApplicationGatewayAvailableSslPredefinedPolicies +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayAvailableSslPredefinedPoliciesPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agaspp) + if err != nil { + return err + } + page.agaspp = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayAvailableSslPredefinedPoliciesPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) NotDone() bool { + return !page.agaspp.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Response() ApplicationGatewayAvailableSslPredefinedPolicies { + return page.agaspp +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayAvailableSslPredefinedPoliciesPage) Values() []ApplicationGatewaySslPredefinedPolicy { + if page.agaspp.IsEmpty() { + return nil + } + return *page.agaspp.Value +} + +// Creates a new instance of the ApplicationGatewayAvailableSslPredefinedPoliciesPage type. +func NewApplicationGatewayAvailableSslPredefinedPoliciesPage(cur ApplicationGatewayAvailableSslPredefinedPolicies, getNextPage func(context.Context, ApplicationGatewayAvailableSslPredefinedPolicies) (ApplicationGatewayAvailableSslPredefinedPolicies, error)) ApplicationGatewayAvailableSslPredefinedPoliciesPage { + return ApplicationGatewayAvailableSslPredefinedPoliciesPage{ + fn: getNextPage, + agaspp: cur, + } +} + +// ApplicationGatewayAvailableWafRuleSetsResult response for ApplicationGatewayAvailableWafRuleSets API +// service call. +type ApplicationGatewayAvailableWafRuleSetsResult struct { + autorest.Response `json:"-"` + // Value - The list of application gateway rule sets. + Value *[]ApplicationGatewayFirewallRuleSet `json:"value,omitempty"` +} + +// ApplicationGatewayBackendAddress backend address of an application gateway. +type ApplicationGatewayBackendAddress struct { + // Fqdn - Fully qualified domain name (FQDN). + Fqdn *string `json:"fqdn,omitempty"` + // IPAddress - IP address. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// ApplicationGatewayBackendAddressPool backend Address Pool of an application gateway. +type ApplicationGatewayBackendAddressPool struct { + // ApplicationGatewayBackendAddressPoolPropertiesFormat - Properties of the application gateway backend address pool. + *ApplicationGatewayBackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend address pool that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPool. +func (agbap ApplicationGatewayBackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat != nil { + objectMap["properties"] = agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat + } + if agbap.Name != nil { + objectMap["name"] = agbap.Name + } + if agbap.ID != nil { + objectMap["id"] = agbap.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendAddressPool struct. +func (agbap *ApplicationGatewayBackendAddressPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendAddressPoolPropertiesFormat ApplicationGatewayBackendAddressPoolPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendAddressPoolPropertiesFormat) + if err != nil { + return err + } + agbap.ApplicationGatewayBackendAddressPoolPropertiesFormat = &applicationGatewayBackendAddressPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbap.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbap.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbap.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbap.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendAddressPoolPropertiesFormat properties of Backend Address Pool of an +// application gateway. +type ApplicationGatewayBackendAddressPoolPropertiesFormat struct { + // BackendIPConfigurations - READ-ONLY; Collection of references to IPs defined in network interfaces. + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + // BackendAddresses - Backend addresses. + BackendAddresses *[]ApplicationGatewayBackendAddress `json:"backendAddresses,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendAddressPoolPropertiesFormat. +func (agbappf ApplicationGatewayBackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbappf.BackendAddresses != nil { + objectMap["backendAddresses"] = agbappf.BackendAddresses + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayBackendHealth response for ApplicationGatewayBackendHealth API service call. +type ApplicationGatewayBackendHealth struct { + autorest.Response `json:"-"` + // BackendAddressPools - A list of ApplicationGatewayBackendHealthPool resources. + BackendAddressPools *[]ApplicationGatewayBackendHealthPool `json:"backendAddressPools,omitempty"` +} + +// ApplicationGatewayBackendHealthHTTPSettings application gateway BackendHealthHttp settings. +type ApplicationGatewayBackendHealthHTTPSettings struct { + // BackendHTTPSettings - Reference to an ApplicationGatewayBackendHttpSettings resource. + BackendHTTPSettings *ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettings,omitempty"` + // Servers - List of ApplicationGatewayBackendHealthServer resources. + Servers *[]ApplicationGatewayBackendHealthServer `json:"servers,omitempty"` +} + +// ApplicationGatewayBackendHealthOnDemand result of on demand test probe. +type ApplicationGatewayBackendHealthOnDemand struct { + autorest.Response `json:"-"` + // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + // BackendHealthHTTPSettings - Application gateway BackendHealthHttp settings. + BackendHealthHTTPSettings *ApplicationGatewayBackendHealthHTTPSettings `json:"backendHealthHttpSettings,omitempty"` +} + +// ApplicationGatewayBackendHealthPool application gateway BackendHealth pool. +type ApplicationGatewayBackendHealthPool struct { + // BackendAddressPool - Reference to an ApplicationGatewayBackendAddressPool resource. + BackendAddressPool *ApplicationGatewayBackendAddressPool `json:"backendAddressPool,omitempty"` + // BackendHTTPSettingsCollection - List of ApplicationGatewayBackendHealthHttpSettings resources. + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHealthHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` +} + +// ApplicationGatewayBackendHealthServer application gateway backendhealth http settings. +type ApplicationGatewayBackendHealthServer struct { + // Address - IP address or FQDN of backend server. + Address *string `json:"address,omitempty"` + // IPConfiguration - Reference to IP configuration of backend server. + IPConfiguration *InterfaceIPConfiguration `json:"ipConfiguration,omitempty"` + // Health - Health of backend server. Possible values include: 'ApplicationGatewayBackendHealthServerHealthUnknown', 'ApplicationGatewayBackendHealthServerHealthUp', 'ApplicationGatewayBackendHealthServerHealthDown', 'ApplicationGatewayBackendHealthServerHealthPartial', 'ApplicationGatewayBackendHealthServerHealthDraining' + Health ApplicationGatewayBackendHealthServerHealth `json:"health,omitempty"` + // HealthProbeLog - Health Probe Log. + HealthProbeLog *string `json:"healthProbeLog,omitempty"` +} + +// ApplicationGatewayBackendHTTPSettings backend address pool settings of an application gateway. +type ApplicationGatewayBackendHTTPSettings struct { + // ApplicationGatewayBackendHTTPSettingsPropertiesFormat - Properties of the application gateway backend HTTP settings. + *ApplicationGatewayBackendHTTPSettingsPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend http settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettings. +func (agbhs ApplicationGatewayBackendHTTPSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat != nil { + objectMap["properties"] = agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat + } + if agbhs.Name != nil { + objectMap["name"] = agbhs.Name + } + if agbhs.ID != nil { + objectMap["id"] = agbhs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendHTTPSettings struct. +func (agbhs *ApplicationGatewayBackendHTTPSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendHTTPSettingsPropertiesFormat ApplicationGatewayBackendHTTPSettingsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendHTTPSettingsPropertiesFormat) + if err != nil { + return err + } + agbhs.ApplicationGatewayBackendHTTPSettingsPropertiesFormat = &applicationGatewayBackendHTTPSettingsPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbhs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbhs.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbhs.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbhs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendHTTPSettingsPropertiesFormat properties of Backend address pool settings of an +// application gateway. +type ApplicationGatewayBackendHTTPSettingsPropertiesFormat struct { + // Port - The destination port on the backend. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // CookieBasedAffinity - Cookie based affinity. Possible values include: 'ApplicationGatewayCookieBasedAffinityEnabled', 'ApplicationGatewayCookieBasedAffinityDisabled' + CookieBasedAffinity ApplicationGatewayCookieBasedAffinity `json:"cookieBasedAffinity,omitempty"` + // RequestTimeout - Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 seconds. + RequestTimeout *int32 `json:"requestTimeout,omitempty"` + // Probe - Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + // AuthenticationCertificates - Array of references to application gateway authentication certificates. + AuthenticationCertificates *[]SubResource `json:"authenticationCertificates,omitempty"` + // TrustedRootCertificates - Array of references to application gateway trusted root certificates. + TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` + // ConnectionDraining - Connection draining of the backend http settings resource. + ConnectionDraining *ApplicationGatewayConnectionDraining `json:"connectionDraining,omitempty"` + // HostName - Host header to be sent to the backend servers. + HostName *string `json:"hostName,omitempty"` + // PickHostNameFromBackendAddress - Whether to pick host header should be picked from the host name of the backend server. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + // AffinityCookieName - Cookie name to use for the affinity cookie. + AffinityCookieName *string `json:"affinityCookieName,omitempty"` + // ProbeEnabled - Whether the probe is enabled. Default value is false. + ProbeEnabled *bool `json:"probeEnabled,omitempty"` + // Path - Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. + Path *string `json:"path,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendHTTPSettingsPropertiesFormat. +func (agbhspf ApplicationGatewayBackendHTTPSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbhspf.Port != nil { + objectMap["port"] = agbhspf.Port + } + if agbhspf.Protocol != "" { + objectMap["protocol"] = agbhspf.Protocol + } + if agbhspf.CookieBasedAffinity != "" { + objectMap["cookieBasedAffinity"] = agbhspf.CookieBasedAffinity + } + if agbhspf.RequestTimeout != nil { + objectMap["requestTimeout"] = agbhspf.RequestTimeout + } + if agbhspf.Probe != nil { + objectMap["probe"] = agbhspf.Probe + } + if agbhspf.AuthenticationCertificates != nil { + objectMap["authenticationCertificates"] = agbhspf.AuthenticationCertificates + } + if agbhspf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agbhspf.TrustedRootCertificates + } + if agbhspf.ConnectionDraining != nil { + objectMap["connectionDraining"] = agbhspf.ConnectionDraining + } + if agbhspf.HostName != nil { + objectMap["hostName"] = agbhspf.HostName + } + if agbhspf.PickHostNameFromBackendAddress != nil { + objectMap["pickHostNameFromBackendAddress"] = agbhspf.PickHostNameFromBackendAddress + } + if agbhspf.AffinityCookieName != nil { + objectMap["affinityCookieName"] = agbhspf.AffinityCookieName + } + if agbhspf.ProbeEnabled != nil { + objectMap["probeEnabled"] = agbhspf.ProbeEnabled + } + if agbhspf.Path != nil { + objectMap["path"] = agbhspf.Path + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayBackendSettings backend address pool settings of an application gateway. +type ApplicationGatewayBackendSettings struct { + // ApplicationGatewayBackendSettingsPropertiesFormat - Properties of the application gateway backend settings. + *ApplicationGatewayBackendSettingsPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend settings that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettings. +func (agbs ApplicationGatewayBackendSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbs.ApplicationGatewayBackendSettingsPropertiesFormat != nil { + objectMap["properties"] = agbs.ApplicationGatewayBackendSettingsPropertiesFormat + } + if agbs.Name != nil { + objectMap["name"] = agbs.Name + } + if agbs.ID != nil { + objectMap["id"] = agbs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayBackendSettings struct. +func (agbs *ApplicationGatewayBackendSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayBackendSettingsPropertiesFormat ApplicationGatewayBackendSettingsPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayBackendSettingsPropertiesFormat) + if err != nil { + return err + } + agbs.ApplicationGatewayBackendSettingsPropertiesFormat = &applicationGatewayBackendSettingsPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agbs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agbs.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agbs.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agbs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayBackendSettingsPropertiesFormat properties of Backend address pool settings of an +// application gateway. +type ApplicationGatewayBackendSettingsPropertiesFormat struct { + // Port - The destination port on the backend. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used to communicate with the backend. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Timeout - Connection timeout in seconds. Application Gateway will fail the request if response is not received within ConnectionTimeout. Acceptable values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + // Probe - Probe resource of an application gateway. + Probe *SubResource `json:"probe,omitempty"` + // TrustedRootCertificates - Array of references to application gateway trusted root certificates. + TrustedRootCertificates *[]SubResource `json:"trustedRootCertificates,omitempty"` + // HostName - Server name indication to be sent to the backend servers for Tls protocol. + HostName *string `json:"hostName,omitempty"` + // PickHostNameFromBackendAddress - Whether to pick server name indication from the host name of the backend server for Tls protocol. Default value is false. + PickHostNameFromBackendAddress *bool `json:"pickHostNameFromBackendAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend HTTP settings resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayBackendSettingsPropertiesFormat. +func (agbspf ApplicationGatewayBackendSettingsPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agbspf.Port != nil { + objectMap["port"] = agbspf.Port + } + if agbspf.Protocol != "" { + objectMap["protocol"] = agbspf.Protocol + } + if agbspf.Timeout != nil { + objectMap["timeout"] = agbspf.Timeout + } + if agbspf.Probe != nil { + objectMap["probe"] = agbspf.Probe + } + if agbspf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agbspf.TrustedRootCertificates + } + if agbspf.HostName != nil { + objectMap["hostName"] = agbspf.HostName + } + if agbspf.PickHostNameFromBackendAddress != nil { + objectMap["pickHostNameFromBackendAddress"] = agbspf.PickHostNameFromBackendAddress + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayClientAuthConfiguration application gateway client authentication configuration. +type ApplicationGatewayClientAuthConfiguration struct { + // VerifyClientCertIssuerDN - Verify client certificate issuer name on the application gateway. + VerifyClientCertIssuerDN *bool `json:"verifyClientCertIssuerDN,omitempty"` +} + +// ApplicationGatewayConnectionDraining connection draining allows open connections to a backend server to +// be active for a specified time after the backend server got removed from the configuration. +type ApplicationGatewayConnectionDraining struct { + // Enabled - Whether connection draining is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // DrainTimeoutInSec - The number of seconds connection draining is active. Acceptable values are from 1 second to 3600 seconds. + DrainTimeoutInSec *int32 `json:"drainTimeoutInSec,omitempty"` +} + +// ApplicationGatewayCustomError customer error of an application gateway. +type ApplicationGatewayCustomError struct { + // StatusCode - Status code of the application gateway customer error. Possible values include: 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus403', 'ApplicationGatewayCustomErrorStatusCodeHTTPStatus502' + StatusCode ApplicationGatewayCustomErrorStatusCode `json:"statusCode,omitempty"` + // CustomErrorPageURL - Error page URL of the application gateway customer error. + CustomErrorPageURL *string `json:"customErrorPageUrl,omitempty"` +} + +// ApplicationGatewayFirewallDisabledRuleGroup allows to disable rules within a rule group or an entire +// rule group. +type ApplicationGatewayFirewallDisabledRuleGroup struct { + // RuleGroupName - The name of the rule group that will be disabled. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - The list of rules that will be disabled. If null, all rules of the rule group will be disabled. + Rules *[]int32 `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallExclusion allow to exclude some variable satisfy the condition for the WAF +// check. +type ApplicationGatewayFirewallExclusion struct { + // MatchVariable - The variable to be excluded. + MatchVariable *string `json:"matchVariable,omitempty"` + // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. + SelectorMatchOperator *string `json:"selectorMatchOperator,omitempty"` + // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. + Selector *string `json:"selector,omitempty"` +} + +// ApplicationGatewayFirewallRule a web application firewall rule. +type ApplicationGatewayFirewallRule struct { + // RuleID - The identifier of the web application firewall rule. + RuleID *int32 `json:"ruleId,omitempty"` + // Description - The description of the web application firewall rule. + Description *string `json:"description,omitempty"` +} + +// ApplicationGatewayFirewallRuleGroup a web application firewall rule group. +type ApplicationGatewayFirewallRuleGroup struct { + // RuleGroupName - The name of the web application firewall rule group. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Description - The description of the web application firewall rule group. + Description *string `json:"description,omitempty"` + // Rules - The rules of the web application firewall rule group. + Rules *[]ApplicationGatewayFirewallRule `json:"rules,omitempty"` +} + +// ApplicationGatewayFirewallRuleSet a web application firewall rule set. +type ApplicationGatewayFirewallRuleSet struct { + // ApplicationGatewayFirewallRuleSetPropertiesFormat - Properties of the application gateway firewall rule set. + *ApplicationGatewayFirewallRuleSetPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSet. +func (agfrs ApplicationGatewayFirewallRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat != nil { + objectMap["properties"] = agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat + } + if agfrs.ID != nil { + objectMap["id"] = agfrs.ID + } + if agfrs.Location != nil { + objectMap["location"] = agfrs.Location + } + if agfrs.Tags != nil { + objectMap["tags"] = agfrs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFirewallRuleSet struct. +func (agfrs *ApplicationGatewayFirewallRuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFirewallRuleSetPropertiesFormat ApplicationGatewayFirewallRuleSetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFirewallRuleSetPropertiesFormat) + if err != nil { + return err + } + agfrs.ApplicationGatewayFirewallRuleSetPropertiesFormat = &applicationGatewayFirewallRuleSetPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfrs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfrs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfrs.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + agfrs.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + agfrs.Tags = tags + } + } + } + + return nil +} + +// ApplicationGatewayFirewallRuleSetPropertiesFormat properties of the web application firewall rule set. +type ApplicationGatewayFirewallRuleSetPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall rule set. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // RuleSetType - The type of the web application firewall rule set. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the web application firewall rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - The rule groups of the web application firewall rule set. + RuleGroups *[]ApplicationGatewayFirewallRuleGroup `json:"ruleGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFirewallRuleSetPropertiesFormat. +func (agfrspf ApplicationGatewayFirewallRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfrspf.RuleSetType != nil { + objectMap["ruleSetType"] = agfrspf.RuleSetType + } + if agfrspf.RuleSetVersion != nil { + objectMap["ruleSetVersion"] = agfrspf.RuleSetVersion + } + if agfrspf.RuleGroups != nil { + objectMap["ruleGroups"] = agfrspf.RuleGroups + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayFrontendIPConfiguration frontend IP configuration of an application gateway. +type ApplicationGatewayFrontendIPConfiguration struct { + // ApplicationGatewayFrontendIPConfigurationPropertiesFormat - Properties of the application gateway frontend IP configuration. + *ApplicationGatewayFrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the frontend IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfiguration. +func (agfic ApplicationGatewayFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat + } + if agfic.Name != nil { + objectMap["name"] = agfic.Name + } + if agfic.ID != nil { + objectMap["id"] = agfic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendIPConfiguration struct. +func (agfic *ApplicationGatewayFrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFrontendIPConfigurationPropertiesFormat ApplicationGatewayFrontendIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFrontendIPConfigurationPropertiesFormat) + if err != nil { + return err + } + agfic.ApplicationGatewayFrontendIPConfigurationPropertiesFormat = &applicationGatewayFrontendIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agfic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayFrontendIPConfigurationPropertiesFormat properties of Frontend IP configuration of an +// application gateway. +type ApplicationGatewayFrontendIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - PrivateIPAddress of the network interface IP Configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference to the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // PrivateLinkConfiguration - Reference to the application gateway private link configuration. + PrivateLinkConfiguration *SubResource `json:"privateLinkConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendIPConfigurationPropertiesFormat. +func (agficpf ApplicationGatewayFrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agficpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = agficpf.PrivateIPAddress + } + if agficpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = agficpf.PrivateIPAllocationMethod + } + if agficpf.Subnet != nil { + objectMap["subnet"] = agficpf.Subnet + } + if agficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = agficpf.PublicIPAddress + } + if agficpf.PrivateLinkConfiguration != nil { + objectMap["privateLinkConfiguration"] = agficpf.PrivateLinkConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayFrontendPort frontend port of an application gateway. +type ApplicationGatewayFrontendPort struct { + // ApplicationGatewayFrontendPortPropertiesFormat - Properties of the application gateway frontend port. + *ApplicationGatewayFrontendPortPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the frontend port that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPort. +func (agfp ApplicationGatewayFrontendPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfp.ApplicationGatewayFrontendPortPropertiesFormat != nil { + objectMap["properties"] = agfp.ApplicationGatewayFrontendPortPropertiesFormat + } + if agfp.Name != nil { + objectMap["name"] = agfp.Name + } + if agfp.ID != nil { + objectMap["id"] = agfp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayFrontendPort struct. +func (agfp *ApplicationGatewayFrontendPort) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayFrontendPortPropertiesFormat ApplicationGatewayFrontendPortPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayFrontendPortPropertiesFormat) + if err != nil { + return err + } + agfp.ApplicationGatewayFrontendPortPropertiesFormat = &applicationGatewayFrontendPortPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agfp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agfp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agfp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agfp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayFrontendPortPropertiesFormat properties of Frontend port of an application gateway. +type ApplicationGatewayFrontendPortPropertiesFormat struct { + // Port - Frontend port. + Port *int32 `json:"port,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayFrontendPortPropertiesFormat. +func (agfppf ApplicationGatewayFrontendPortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agfppf.Port != nil { + objectMap["port"] = agfppf.Port + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayGlobalConfiguration application Gateway global configuration. +type ApplicationGatewayGlobalConfiguration struct { + // EnableRequestBuffering - Enable request buffering. + EnableRequestBuffering *bool `json:"enableRequestBuffering,omitempty"` + // EnableResponseBuffering - Enable response buffering. + EnableResponseBuffering *bool `json:"enableResponseBuffering,omitempty"` +} + +// ApplicationGatewayHeaderConfiguration header configuration of the Actions set in Application Gateway. +type ApplicationGatewayHeaderConfiguration struct { + // HeaderName - Header name of the header configuration. + HeaderName *string `json:"headerName,omitempty"` + // HeaderValue - Header value of the header configuration. + HeaderValue *string `json:"headerValue,omitempty"` +} + +// ApplicationGatewayHTTPListener http listener of an application gateway. +type ApplicationGatewayHTTPListener struct { + // ApplicationGatewayHTTPListenerPropertiesFormat - Properties of the application gateway HTTP listener. + *ApplicationGatewayHTTPListenerPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the HTTP listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListener. +func (aghl ApplicationGatewayHTTPListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aghl.ApplicationGatewayHTTPListenerPropertiesFormat != nil { + objectMap["properties"] = aghl.ApplicationGatewayHTTPListenerPropertiesFormat + } + if aghl.Name != nil { + objectMap["name"] = aghl.Name + } + if aghl.ID != nil { + objectMap["id"] = aghl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayHTTPListener struct. +func (aghl *ApplicationGatewayHTTPListener) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayHTTPListenerPropertiesFormat ApplicationGatewayHTTPListenerPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayHTTPListenerPropertiesFormat) + if err != nil { + return err + } + aghl.ApplicationGatewayHTTPListenerPropertiesFormat = &applicationGatewayHTTPListenerPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aghl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + aghl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aghl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aghl.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayHTTPListenerPropertiesFormat properties of HTTP listener of an application gateway. +type ApplicationGatewayHTTPListenerPropertiesFormat struct { + // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // FrontendPort - Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + // Protocol - Protocol of the HTTP listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // HostName - Host name of HTTP listener. + HostName *string `json:"hostName,omitempty"` + // SslCertificate - SSL certificate resource of an application gateway. + SslCertificate *SubResource `json:"sslCertificate,omitempty"` + // SslProfile - SSL profile resource of the application gateway. + SslProfile *SubResource `json:"sslProfile,omitempty"` + // RequireServerNameIndication - Applicable only if protocol is https. Enables SNI for multi-hosting. + RequireServerNameIndication *bool `json:"requireServerNameIndication,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CustomErrorConfigurations - Custom error configurations of the HTTP listener. + CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // HostNames - List of Host names for HTTP Listener that allows special wildcard characters as well. + HostNames *[]string `json:"hostNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayHTTPListenerPropertiesFormat. +func (aghlpf ApplicationGatewayHTTPListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aghlpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = aghlpf.FrontendIPConfiguration + } + if aghlpf.FrontendPort != nil { + objectMap["frontendPort"] = aghlpf.FrontendPort + } + if aghlpf.Protocol != "" { + objectMap["protocol"] = aghlpf.Protocol + } + if aghlpf.HostName != nil { + objectMap["hostName"] = aghlpf.HostName + } + if aghlpf.SslCertificate != nil { + objectMap["sslCertificate"] = aghlpf.SslCertificate + } + if aghlpf.SslProfile != nil { + objectMap["sslProfile"] = aghlpf.SslProfile + } + if aghlpf.RequireServerNameIndication != nil { + objectMap["requireServerNameIndication"] = aghlpf.RequireServerNameIndication + } + if aghlpf.CustomErrorConfigurations != nil { + objectMap["customErrorConfigurations"] = aghlpf.CustomErrorConfigurations + } + if aghlpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = aghlpf.FirewallPolicy + } + if aghlpf.HostNames != nil { + objectMap["hostNames"] = aghlpf.HostNames + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayIPConfiguration IP configuration of an application gateway. Currently 1 public and 1 +// private IP configuration is allowed. +type ApplicationGatewayIPConfiguration struct { + // ApplicationGatewayIPConfigurationPropertiesFormat - Properties of the application gateway IP configuration. + *ApplicationGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the IP configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfiguration. +func (agic ApplicationGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agic.ApplicationGatewayIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = agic.ApplicationGatewayIPConfigurationPropertiesFormat + } + if agic.Name != nil { + objectMap["name"] = agic.Name + } + if agic.ID != nil { + objectMap["id"] = agic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayIPConfiguration struct. +func (agic *ApplicationGatewayIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayIPConfigurationPropertiesFormat ApplicationGatewayIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayIPConfigurationPropertiesFormat) + if err != nil { + return err + } + agic.ApplicationGatewayIPConfigurationPropertiesFormat = &applicationGatewayIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayIPConfigurationPropertiesFormat properties of IP configuration of an application +// gateway. +type ApplicationGatewayIPConfigurationPropertiesFormat struct { + // Subnet - Reference to the subnet resource. A subnet from where application gateway gets its private address. + Subnet *SubResource `json:"subnet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayIPConfigurationPropertiesFormat. +func (agicpf ApplicationGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agicpf.Subnet != nil { + objectMap["subnet"] = agicpf.Subnet + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayListener listener of an application gateway. +type ApplicationGatewayListener struct { + // ApplicationGatewayListenerPropertiesFormat - Properties of the application gateway listener. + *ApplicationGatewayListenerPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the listener that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayListener. +func (agl ApplicationGatewayListener) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agl.ApplicationGatewayListenerPropertiesFormat != nil { + objectMap["properties"] = agl.ApplicationGatewayListenerPropertiesFormat + } + if agl.Name != nil { + objectMap["name"] = agl.Name + } + if agl.ID != nil { + objectMap["id"] = agl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayListener struct. +func (agl *ApplicationGatewayListener) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayListenerPropertiesFormat ApplicationGatewayListenerPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayListenerPropertiesFormat) + if err != nil { + return err + } + agl.ApplicationGatewayListenerPropertiesFormat = &applicationGatewayListenerPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agl.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayListenerPropertiesFormat properties of listener of an application gateway. +type ApplicationGatewayListenerPropertiesFormat struct { + // FrontendIPConfiguration - Frontend IP configuration resource of an application gateway. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // FrontendPort - Frontend port resource of an application gateway. + FrontendPort *SubResource `json:"frontendPort,omitempty"` + // Protocol - Protocol of the listener. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // SslCertificate - SSL certificate resource of an application gateway. + SslCertificate *SubResource `json:"sslCertificate,omitempty"` + // SslProfile - SSL profile resource of the application gateway. + SslProfile *SubResource `json:"sslProfile,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayListenerPropertiesFormat. +func (aglpf ApplicationGatewayListenerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aglpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = aglpf.FrontendIPConfiguration + } + if aglpf.FrontendPort != nil { + objectMap["frontendPort"] = aglpf.FrontendPort + } + if aglpf.Protocol != "" { + objectMap["protocol"] = aglpf.Protocol + } + if aglpf.SslCertificate != nil { + objectMap["sslCertificate"] = aglpf.SslCertificate + } + if aglpf.SslProfile != nil { + objectMap["sslProfile"] = aglpf.SslProfile + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayListResult response for ListApplicationGateways API service call. +type ApplicationGatewayListResult struct { + autorest.Response `json:"-"` + // Value - List of an application gateways in a resource group. + Value *[]ApplicationGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayListResultIterator provides access to a complete listing of ApplicationGateway values. +type ApplicationGatewayListResultIterator struct { + i int + page ApplicationGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayListResultIterator) Response() ApplicationGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayListResultIterator) Value() ApplicationGateway { + if !iter.page.NotDone() { + return ApplicationGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayListResultIterator type. +func NewApplicationGatewayListResultIterator(page ApplicationGatewayListResultPage) ApplicationGatewayListResultIterator { + return ApplicationGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aglr ApplicationGatewayListResult) IsEmpty() bool { + return aglr.Value == nil || len(*aglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aglr ApplicationGatewayListResult) hasNextLink() bool { + return aglr.NextLink != nil && len(*aglr.NextLink) != 0 +} + +// applicationGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aglr ApplicationGatewayListResult) applicationGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aglr.NextLink))) +} + +// ApplicationGatewayListResultPage contains a page of ApplicationGateway values. +type ApplicationGatewayListResultPage struct { + fn func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error) + aglr ApplicationGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aglr) + if err != nil { + return err + } + page.aglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayListResultPage) NotDone() bool { + return !page.aglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayListResultPage) Response() ApplicationGatewayListResult { + return page.aglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayListResultPage) Values() []ApplicationGateway { + if page.aglr.IsEmpty() { + return nil + } + return *page.aglr.Value +} + +// Creates a new instance of the ApplicationGatewayListResultPage type. +func NewApplicationGatewayListResultPage(cur ApplicationGatewayListResult, getNextPage func(context.Context, ApplicationGatewayListResult) (ApplicationGatewayListResult, error)) ApplicationGatewayListResultPage { + return ApplicationGatewayListResultPage{ + fn: getNextPage, + aglr: cur, + } +} + +// ApplicationGatewayLoadDistributionPolicy load Distribution Policy of an application gateway. +type ApplicationGatewayLoadDistributionPolicy struct { + // ApplicationGatewayLoadDistributionPolicyPropertiesFormat - Properties of the application gateway load distribution policy. + *ApplicationGatewayLoadDistributionPolicyPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicy. +func (agldp ApplicationGatewayLoadDistributionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat != nil { + objectMap["properties"] = agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat + } + if agldp.Name != nil { + objectMap["name"] = agldp.Name + } + if agldp.ID != nil { + objectMap["id"] = agldp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionPolicy struct. +func (agldp *ApplicationGatewayLoadDistributionPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayLoadDistributionPolicyPropertiesFormat ApplicationGatewayLoadDistributionPolicyPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayLoadDistributionPolicyPropertiesFormat) + if err != nil { + return err + } + agldp.ApplicationGatewayLoadDistributionPolicyPropertiesFormat = &applicationGatewayLoadDistributionPolicyPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agldp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agldp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agldp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agldp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayLoadDistributionPolicyPropertiesFormat properties of Load Distribution Policy of an +// application gateway. +type ApplicationGatewayLoadDistributionPolicyPropertiesFormat struct { + // LoadDistributionTargets - Load Distribution Targets resource of an application gateway. + LoadDistributionTargets *[]ApplicationGatewayLoadDistributionTarget `json:"loadDistributionTargets,omitempty"` + // LoadDistributionAlgorithm - Load Distribution Targets resource of an application gateway. Possible values include: 'ApplicationGatewayLoadDistributionAlgorithmRoundRobin', 'ApplicationGatewayLoadDistributionAlgorithmLeastConnections', 'ApplicationGatewayLoadDistributionAlgorithmIPHash' + LoadDistributionAlgorithm ApplicationGatewayLoadDistributionAlgorithm `json:"loadDistributionAlgorithm,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Load Distribution Policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionPolicyPropertiesFormat. +func (agldppf ApplicationGatewayLoadDistributionPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldppf.LoadDistributionTargets != nil { + objectMap["loadDistributionTargets"] = agldppf.LoadDistributionTargets + } + if agldppf.LoadDistributionAlgorithm != "" { + objectMap["loadDistributionAlgorithm"] = agldppf.LoadDistributionAlgorithm + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayLoadDistributionTarget load Distribution Target of an application gateway. +type ApplicationGatewayLoadDistributionTarget struct { + // ApplicationGatewayLoadDistributionTargetPropertiesFormat - Properties of the application gateway load distribution target. + *ApplicationGatewayLoadDistributionTargetPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the load distribution policy that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayLoadDistributionTarget. +func (agldt ApplicationGatewayLoadDistributionTarget) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat != nil { + objectMap["properties"] = agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat + } + if agldt.Name != nil { + objectMap["name"] = agldt.Name + } + if agldt.ID != nil { + objectMap["id"] = agldt.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayLoadDistributionTarget struct. +func (agldt *ApplicationGatewayLoadDistributionTarget) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayLoadDistributionTargetPropertiesFormat ApplicationGatewayLoadDistributionTargetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayLoadDistributionTargetPropertiesFormat) + if err != nil { + return err + } + agldt.ApplicationGatewayLoadDistributionTargetPropertiesFormat = &applicationGatewayLoadDistributionTargetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agldt.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agldt.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agldt.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agldt.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayLoadDistributionTargetPropertiesFormat ... +type ApplicationGatewayLoadDistributionTargetPropertiesFormat struct { + // WeightPerServer - Weight per server. Range between 1 and 100. + WeightPerServer *int32 `json:"weightPerServer,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` +} + +// ApplicationGatewayOnDemandProbe details of on demand test probe request. +type ApplicationGatewayOnDemandProbe struct { + // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Host - Host name to send the probe to. + Host *string `json:"host,omitempty"` + // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + // Timeout - The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + // Match - Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + // BackendAddressPool - Reference to backend pool of application gateway to which probe request will be sent. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Reference to backend http setting of application gateway to be used for test probe. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` +} + +// ApplicationGatewayPathRule path rule of URL path map of an application gateway. +type ApplicationGatewayPathRule struct { + // ApplicationGatewayPathRulePropertiesFormat - Properties of the application gateway path rule. + *ApplicationGatewayPathRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the path rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPathRule. +func (agpr ApplicationGatewayPathRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpr.ApplicationGatewayPathRulePropertiesFormat != nil { + objectMap["properties"] = agpr.ApplicationGatewayPathRulePropertiesFormat + } + if agpr.Name != nil { + objectMap["name"] = agpr.Name + } + if agpr.ID != nil { + objectMap["id"] = agpr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPathRule struct. +func (agpr *ApplicationGatewayPathRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPathRulePropertiesFormat ApplicationGatewayPathRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayPathRulePropertiesFormat) + if err != nil { + return err + } + agpr.ApplicationGatewayPathRulePropertiesFormat = &applicationGatewayPathRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agpr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agpr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agpr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agpr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPathRulePropertiesFormat properties of path rule of an application gateway. +type ApplicationGatewayPathRulePropertiesFormat struct { + // Paths - Path rules of URL path map. + Paths *[]string `json:"paths,omitempty"` + // BackendAddressPool - Backend address pool resource of URL path map path rule. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Backend http settings resource of URL path map path rule. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + // RedirectConfiguration - Redirect configuration resource of URL path map path rule. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + // RewriteRuleSet - Rewrite rule set resource of URL path map path rule. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + // LoadDistributionPolicy - Load Distribution Policy resource of URL path map path rule. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the path rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPathRulePropertiesFormat. +func (agprpf ApplicationGatewayPathRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agprpf.Paths != nil { + objectMap["paths"] = agprpf.Paths + } + if agprpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agprpf.BackendAddressPool + } + if agprpf.BackendHTTPSettings != nil { + objectMap["backendHttpSettings"] = agprpf.BackendHTTPSettings + } + if agprpf.RedirectConfiguration != nil { + objectMap["redirectConfiguration"] = agprpf.RedirectConfiguration + } + if agprpf.RewriteRuleSet != nil { + objectMap["rewriteRuleSet"] = agprpf.RewriteRuleSet + } + if agprpf.LoadDistributionPolicy != nil { + objectMap["loadDistributionPolicy"] = agprpf.LoadDistributionPolicy + } + if agprpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = agprpf.FirewallPolicy + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateEndpointConnection private Endpoint connection on an application gateway. +type ApplicationGatewayPrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ApplicationGatewayPrivateEndpointConnectionProperties - Properties of the application gateway private endpoint connection. + *ApplicationGatewayPrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Name - Name of the private endpoint connection on an application gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnection. +func (agpec ApplicationGatewayPrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpec.ApplicationGatewayPrivateEndpointConnectionProperties != nil { + objectMap["properties"] = agpec.ApplicationGatewayPrivateEndpointConnectionProperties + } + if agpec.Name != nil { + objectMap["name"] = agpec.Name + } + if agpec.ID != nil { + objectMap["id"] = agpec.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateEndpointConnection struct. +func (agpec *ApplicationGatewayPrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateEndpointConnectionProperties ApplicationGatewayPrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateEndpointConnectionProperties) + if err != nil { + return err + } + agpec.ApplicationGatewayPrivateEndpointConnectionProperties = &applicationGatewayPrivateEndpointConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agpec.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agpec.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agpec.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agpec.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateEndpointConnectionListResult response for +// ListApplicationGatewayPrivateEndpointConnection API service call. Gets all private endpoint connections +// for an application gateway. +type ApplicationGatewayPrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - List of private endpoint connections on an application gateway. + Value *[]ApplicationGatewayPrivateEndpointConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayPrivateEndpointConnectionListResultIterator provides access to a complete listing of +// ApplicationGatewayPrivateEndpointConnection values. +type ApplicationGatewayPrivateEndpointConnectionListResultIterator struct { + i int + page ApplicationGatewayPrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayPrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Response() ApplicationGatewayPrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayPrivateEndpointConnectionListResultIterator) Value() ApplicationGatewayPrivateEndpointConnection { + if !iter.page.NotDone() { + return ApplicationGatewayPrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultIterator type. +func NewApplicationGatewayPrivateEndpointConnectionListResultIterator(page ApplicationGatewayPrivateEndpointConnectionListResultPage) ApplicationGatewayPrivateEndpointConnectionListResultIterator { + return ApplicationGatewayPrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) IsEmpty() bool { + return agpeclr.Value == nil || len(*agpeclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) hasNextLink() bool { + return agpeclr.NextLink != nil && len(*agpeclr.NextLink) != 0 +} + +// applicationGatewayPrivateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agpeclr ApplicationGatewayPrivateEndpointConnectionListResult) applicationGatewayPrivateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !agpeclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agpeclr.NextLink))) +} + +// ApplicationGatewayPrivateEndpointConnectionListResultPage contains a page of +// ApplicationGatewayPrivateEndpointConnection values. +type ApplicationGatewayPrivateEndpointConnectionListResultPage struct { + fn func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error) + agpeclr ApplicationGatewayPrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agpeclr) + if err != nil { + return err + } + page.agpeclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayPrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.agpeclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Response() ApplicationGatewayPrivateEndpointConnectionListResult { + return page.agpeclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayPrivateEndpointConnectionListResultPage) Values() []ApplicationGatewayPrivateEndpointConnection { + if page.agpeclr.IsEmpty() { + return nil + } + return *page.agpeclr.Value +} + +// Creates a new instance of the ApplicationGatewayPrivateEndpointConnectionListResultPage type. +func NewApplicationGatewayPrivateEndpointConnectionListResultPage(cur ApplicationGatewayPrivateEndpointConnectionListResult, getNextPage func(context.Context, ApplicationGatewayPrivateEndpointConnectionListResult) (ApplicationGatewayPrivateEndpointConnectionListResult, error)) ApplicationGatewayPrivateEndpointConnectionListResultPage { + return ApplicationGatewayPrivateEndpointConnectionListResultPage{ + fn: getNextPage, + agpeclr: cur, + } +} + +// ApplicationGatewayPrivateEndpointConnectionProperties properties of Private Link Resource of an +// application gateway. +type ApplicationGatewayPrivateEndpointConnectionProperties struct { + // PrivateEndpoint - READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // LinkIdentifier - READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateEndpointConnectionProperties. +func (agpecp ApplicationGatewayPrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = agpecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ApplicationGatewayPrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsDeleteFuture.Result. +func (future *ApplicationGatewayPrivateEndpointConnectionsDeleteFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewayPrivateEndpointConnectionsUpdateFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ApplicationGatewayPrivateEndpointConnectionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewayPrivateEndpointConnectionsClient) (ApplicationGatewayPrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewayPrivateEndpointConnectionsUpdateFuture.Result. +func (future *ApplicationGatewayPrivateEndpointConnectionsUpdateFuture) result(client ApplicationGatewayPrivateEndpointConnectionsClient) (agpec ApplicationGatewayPrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agpec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agpec.Response.Response, err = future.GetResult(sender); err == nil && agpec.Response.Response.StatusCode != http.StatusNoContent { + agpec, err = client.UpdateResponder(agpec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture", "Result", agpec.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewayPrivateLinkConfiguration private Link Configuration on an application gateway. +type ApplicationGatewayPrivateLinkConfiguration struct { + // ApplicationGatewayPrivateLinkConfigurationProperties - Properties of the application gateway private link configuration. + *ApplicationGatewayPrivateLinkConfigurationProperties `json:"properties,omitempty"` + // Name - Name of the private link configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfiguration. +func (agplc ApplicationGatewayPrivateLinkConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplc.ApplicationGatewayPrivateLinkConfigurationProperties != nil { + objectMap["properties"] = agplc.ApplicationGatewayPrivateLinkConfigurationProperties + } + if agplc.Name != nil { + objectMap["name"] = agplc.Name + } + if agplc.ID != nil { + objectMap["id"] = agplc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkConfiguration struct. +func (agplc *ApplicationGatewayPrivateLinkConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkConfigurationProperties ApplicationGatewayPrivateLinkConfigurationProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkConfigurationProperties) + if err != nil { + return err + } + agplc.ApplicationGatewayPrivateLinkConfigurationProperties = &applicationGatewayPrivateLinkConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkConfigurationProperties properties of private link configuration on an +// application gateway. +type ApplicationGatewayPrivateLinkConfigurationProperties struct { + // IPConfigurations - An array of application gateway private link ip configurations. + IPConfigurations *[]ApplicationGatewayPrivateLinkIPConfiguration `json:"ipConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkConfigurationProperties. +func (agplcp ApplicationGatewayPrivateLinkConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplcp.IPConfigurations != nil { + objectMap["ipConfigurations"] = agplcp.IPConfigurations + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateLinkIPConfiguration the application gateway private link ip configuration. +type ApplicationGatewayPrivateLinkIPConfiguration struct { + // ApplicationGatewayPrivateLinkIPConfigurationProperties - Properties of an application gateway private link ip configuration. + *ApplicationGatewayPrivateLinkIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of application gateway private link ip configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfiguration. +func (agplic ApplicationGatewayPrivateLinkIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties != nil { + objectMap["properties"] = agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties + } + if agplic.Name != nil { + objectMap["name"] = agplic.Name + } + if agplic.ID != nil { + objectMap["id"] = agplic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkIPConfiguration struct. +func (agplic *ApplicationGatewayPrivateLinkIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkIPConfigurationProperties ApplicationGatewayPrivateLinkIPConfigurationProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkIPConfigurationProperties) + if err != nil { + return err + } + agplic.ApplicationGatewayPrivateLinkIPConfigurationProperties = &applicationGatewayPrivateLinkIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplic.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkIPConfigurationProperties properties of an application gateway private link +// IP configuration. +type ApplicationGatewayPrivateLinkIPConfigurationProperties struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - Reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // Primary - Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway private link IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkIPConfigurationProperties. +func (agplicp ApplicationGatewayPrivateLinkIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplicp.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = agplicp.PrivateIPAddress + } + if agplicp.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = agplicp.PrivateIPAllocationMethod + } + if agplicp.Subnet != nil { + objectMap["subnet"] = agplicp.Subnet + } + if agplicp.Primary != nil { + objectMap["primary"] = agplicp.Primary + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPrivateLinkResource privateLink Resource of an application gateway. +type ApplicationGatewayPrivateLinkResource struct { + // ApplicationGatewayPrivateLinkResourceProperties - Properties of the application gateway private link resource. + *ApplicationGatewayPrivateLinkResourceProperties `json:"properties,omitempty"` + // Name - Name of the private link resource that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResource. +func (agplr ApplicationGatewayPrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplr.ApplicationGatewayPrivateLinkResourceProperties != nil { + objectMap["properties"] = agplr.ApplicationGatewayPrivateLinkResourceProperties + } + if agplr.Name != nil { + objectMap["name"] = agplr.Name + } + if agplr.ID != nil { + objectMap["id"] = agplr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayPrivateLinkResource struct. +func (agplr *ApplicationGatewayPrivateLinkResource) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayPrivateLinkResourceProperties ApplicationGatewayPrivateLinkResourceProperties + err = json.Unmarshal(*v, &applicationGatewayPrivateLinkResourceProperties) + if err != nil { + return err + } + agplr.ApplicationGatewayPrivateLinkResourceProperties = &applicationGatewayPrivateLinkResourceProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agplr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agplr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agplr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agplr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayPrivateLinkResourceListResult response for ListApplicationGatewayPrivateLinkResources +// API service call. Gets all private link resources for an application gateway. +type ApplicationGatewayPrivateLinkResourceListResult struct { + autorest.Response `json:"-"` + // Value - List of private link resources of an application gateway. + Value *[]ApplicationGatewayPrivateLinkResource `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ApplicationGatewayPrivateLinkResourceListResultIterator provides access to a complete listing of +// ApplicationGatewayPrivateLinkResource values. +type ApplicationGatewayPrivateLinkResourceListResultIterator struct { + i int + page ApplicationGatewayPrivateLinkResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationGatewayPrivateLinkResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Response() ApplicationGatewayPrivateLinkResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationGatewayPrivateLinkResourceListResultIterator) Value() ApplicationGatewayPrivateLinkResource { + if !iter.page.NotDone() { + return ApplicationGatewayPrivateLinkResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultIterator type. +func NewApplicationGatewayPrivateLinkResourceListResultIterator(page ApplicationGatewayPrivateLinkResourceListResultPage) ApplicationGatewayPrivateLinkResourceListResultIterator { + return ApplicationGatewayPrivateLinkResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) IsEmpty() bool { + return agplrlr.Value == nil || len(*agplrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) hasNextLink() bool { + return agplrlr.NextLink != nil && len(*agplrlr.NextLink) != 0 +} + +// applicationGatewayPrivateLinkResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (agplrlr ApplicationGatewayPrivateLinkResourceListResult) applicationGatewayPrivateLinkResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !agplrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(agplrlr.NextLink))) +} + +// ApplicationGatewayPrivateLinkResourceListResultPage contains a page of +// ApplicationGatewayPrivateLinkResource values. +type ApplicationGatewayPrivateLinkResourceListResultPage struct { + fn func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error) + agplrlr ApplicationGatewayPrivateLinkResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationGatewayPrivateLinkResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationGatewayPrivateLinkResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.agplrlr) + if err != nil { + return err + } + page.agplrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationGatewayPrivateLinkResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) NotDone() bool { + return !page.agplrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) Response() ApplicationGatewayPrivateLinkResourceListResult { + return page.agplrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationGatewayPrivateLinkResourceListResultPage) Values() []ApplicationGatewayPrivateLinkResource { + if page.agplrlr.IsEmpty() { + return nil + } + return *page.agplrlr.Value +} + +// Creates a new instance of the ApplicationGatewayPrivateLinkResourceListResultPage type. +func NewApplicationGatewayPrivateLinkResourceListResultPage(cur ApplicationGatewayPrivateLinkResourceListResult, getNextPage func(context.Context, ApplicationGatewayPrivateLinkResourceListResult) (ApplicationGatewayPrivateLinkResourceListResult, error)) ApplicationGatewayPrivateLinkResourceListResultPage { + return ApplicationGatewayPrivateLinkResourceListResultPage{ + fn: getNextPage, + agplrlr: cur, + } +} + +// ApplicationGatewayPrivateLinkResourceProperties properties of a private link resource. +type ApplicationGatewayPrivateLinkResourceProperties struct { + // GroupID - READ-ONLY; Group identifier of private link resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - READ-ONLY; Required member names of private link resource. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - Required DNS zone names of the the private link resource. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPrivateLinkResourceProperties. +func (agplrp ApplicationGatewayPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agplrp.RequiredZoneNames != nil { + objectMap["requiredZoneNames"] = agplrp.RequiredZoneNames + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayProbe probe of the application gateway. +type ApplicationGatewayProbe struct { + // ApplicationGatewayProbePropertiesFormat - Properties of the application gateway probe. + *ApplicationGatewayProbePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the probe that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayProbe. +func (agp ApplicationGatewayProbe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agp.ApplicationGatewayProbePropertiesFormat != nil { + objectMap["properties"] = agp.ApplicationGatewayProbePropertiesFormat + } + if agp.Name != nil { + objectMap["name"] = agp.Name + } + if agp.ID != nil { + objectMap["id"] = agp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayProbe struct. +func (agp *ApplicationGatewayProbe) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayProbePropertiesFormat ApplicationGatewayProbePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayProbePropertiesFormat) + if err != nil { + return err + } + agp.ApplicationGatewayProbePropertiesFormat = &applicationGatewayProbePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayProbeHealthResponseMatch application gateway probe health response match. +type ApplicationGatewayProbeHealthResponseMatch struct { + // Body - Body that must be contained in the health response. Default value is empty. + Body *string `json:"body,omitempty"` + // StatusCodes - Allowed ranges of healthy status codes. Default range of healthy status codes is 200-399. + StatusCodes *[]string `json:"statusCodes,omitempty"` +} + +// ApplicationGatewayProbePropertiesFormat properties of probe of an application gateway. +type ApplicationGatewayProbePropertiesFormat struct { + // Protocol - The protocol used for the probe. Possible values include: 'ApplicationGatewayProtocolHTTP', 'ApplicationGatewayProtocolHTTPS', 'ApplicationGatewayProtocolTCP', 'ApplicationGatewayProtocolTLS' + Protocol ApplicationGatewayProtocol `json:"protocol,omitempty"` + // Host - Host name to send the probe to. + Host *string `json:"host,omitempty"` + // Path - Relative path of probe. Valid path starts from '/'. Probe is sent to ://:. + Path *string `json:"path,omitempty"` + // Interval - The probing interval in seconds. This is the time interval between two consecutive probes. Acceptable values are from 1 second to 86400 seconds. + Interval *int32 `json:"interval,omitempty"` + // Timeout - The probe timeout in seconds. Probe marked as failed if valid response is not received with this timeout period. Acceptable values are from 1 second to 86400 seconds. + Timeout *int32 `json:"timeout,omitempty"` + // UnhealthyThreshold - The probe retry count. Backend server is marked down after consecutive probe failure count reaches UnhealthyThreshold. Acceptable values are from 1 second to 20. + UnhealthyThreshold *int32 `json:"unhealthyThreshold,omitempty"` + // PickHostNameFromBackendHTTPSettings - Whether the host header should be picked from the backend http settings. Default value is false. + PickHostNameFromBackendHTTPSettings *bool `json:"pickHostNameFromBackendHttpSettings,omitempty"` + // PickHostNameFromBackendSettings - Whether the server name indication should be picked from the backend settings for Tls protocol. Default value is false. + PickHostNameFromBackendSettings *bool `json:"pickHostNameFromBackendSettings,omitempty"` + // MinServers - Minimum number of servers that are always marked healthy. Default value is 0. + MinServers *int32 `json:"minServers,omitempty"` + // Match - Criterion for classifying a healthy probe response. + Match *ApplicationGatewayProbeHealthResponseMatch `json:"match,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Port - Custom port which will be used for probing the backend servers. The valid value ranges from 1 to 65535. In case not set, port from http settings will be used. This property is valid for Standard_v2 and WAF_v2 only. + Port *int32 `json:"port,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayProbePropertiesFormat. +func (agppf ApplicationGatewayProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agppf.Protocol != "" { + objectMap["protocol"] = agppf.Protocol + } + if agppf.Host != nil { + objectMap["host"] = agppf.Host + } + if agppf.Path != nil { + objectMap["path"] = agppf.Path + } + if agppf.Interval != nil { + objectMap["interval"] = agppf.Interval + } + if agppf.Timeout != nil { + objectMap["timeout"] = agppf.Timeout + } + if agppf.UnhealthyThreshold != nil { + objectMap["unhealthyThreshold"] = agppf.UnhealthyThreshold + } + if agppf.PickHostNameFromBackendHTTPSettings != nil { + objectMap["pickHostNameFromBackendHttpSettings"] = agppf.PickHostNameFromBackendHTTPSettings + } + if agppf.PickHostNameFromBackendSettings != nil { + objectMap["pickHostNameFromBackendSettings"] = agppf.PickHostNameFromBackendSettings + } + if agppf.MinServers != nil { + objectMap["minServers"] = agppf.MinServers + } + if agppf.Match != nil { + objectMap["match"] = agppf.Match + } + if agppf.Port != nil { + objectMap["port"] = agppf.Port + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayPropertiesFormat properties of the application gateway. +type ApplicationGatewayPropertiesFormat struct { + // Sku - SKU of the application gateway resource. + Sku *ApplicationGatewaySku `json:"sku,omitempty"` + // SslPolicy - SSL policy of the application gateway resource. + SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` + // OperationalState - READ-ONLY; Operational state of the application gateway resource. Possible values include: 'ApplicationGatewayOperationalStateStopped', 'ApplicationGatewayOperationalStateStarting', 'ApplicationGatewayOperationalStateRunning', 'ApplicationGatewayOperationalStateStopping' + OperationalState ApplicationGatewayOperationalState `json:"operationalState,omitempty"` + // GatewayIPConfigurations - Subnets of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + GatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"gatewayIPConfigurations,omitempty"` + // AuthenticationCertificates - Authentication certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + AuthenticationCertificates *[]ApplicationGatewayAuthenticationCertificate `json:"authenticationCertificates,omitempty"` + // TrustedRootCertificates - Trusted Root certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + TrustedRootCertificates *[]ApplicationGatewayTrustedRootCertificate `json:"trustedRootCertificates,omitempty"` + // TrustedClientCertificates - Trusted client certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + TrustedClientCertificates *[]ApplicationGatewayTrustedClientCertificate `json:"trustedClientCertificates,omitempty"` + // SslCertificates - SSL certificates of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + SslCertificates *[]ApplicationGatewaySslCertificate `json:"sslCertificates,omitempty"` + // FrontendIPConfigurations - Frontend IP addresses of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + FrontendIPConfigurations *[]ApplicationGatewayFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + // FrontendPorts - Frontend ports of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + FrontendPorts *[]ApplicationGatewayFrontendPort `json:"frontendPorts,omitempty"` + // Probes - Probes of the application gateway resource. + Probes *[]ApplicationGatewayProbe `json:"probes,omitempty"` + // BackendAddressPools - Backend address pool of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + BackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"backendAddressPools,omitempty"` + // BackendHTTPSettingsCollection - Backend http settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + BackendHTTPSettingsCollection *[]ApplicationGatewayBackendHTTPSettings `json:"backendHttpSettingsCollection,omitempty"` + // BackendSettingsCollection - Backend settings of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + BackendSettingsCollection *[]ApplicationGatewayBackendSettings `json:"backendSettingsCollection,omitempty"` + // HTTPListeners - Http listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + HTTPListeners *[]ApplicationGatewayHTTPListener `json:"httpListeners,omitempty"` + // Listeners - Listeners of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + Listeners *[]ApplicationGatewayListener `json:"listeners,omitempty"` + // SslProfiles - SSL profiles of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + SslProfiles *[]ApplicationGatewaySslProfile `json:"sslProfiles,omitempty"` + // URLPathMaps - URL path map of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + URLPathMaps *[]ApplicationGatewayURLPathMap `json:"urlPathMaps,omitempty"` + // RequestRoutingRules - Request routing rules of the application gateway resource. + RequestRoutingRules *[]ApplicationGatewayRequestRoutingRule `json:"requestRoutingRules,omitempty"` + // RoutingRules - Routing rules of the application gateway resource. + RoutingRules *[]ApplicationGatewayRoutingRule `json:"routingRules,omitempty"` + // RewriteRuleSets - Rewrite rules for the application gateway resource. + RewriteRuleSets *[]ApplicationGatewayRewriteRuleSet `json:"rewriteRuleSets,omitempty"` + // RedirectConfigurations - Redirect configurations of the application gateway resource. For default limits, see [Application Gateway limits](https://docs.microsoft.com/azure/azure-subscription-service-limits#application-gateway-limits). + RedirectConfigurations *[]ApplicationGatewayRedirectConfiguration `json:"redirectConfigurations,omitempty"` + // WebApplicationFirewallConfiguration - Web application firewall configuration. + WebApplicationFirewallConfiguration *ApplicationGatewayWebApplicationFirewallConfiguration `json:"webApplicationFirewallConfiguration,omitempty"` + // FirewallPolicy - Reference to the FirewallPolicy resource. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // EnableHTTP2 - Whether HTTP2 is enabled on the application gateway resource. + EnableHTTP2 *bool `json:"enableHttp2,omitempty"` + // EnableFips - Whether FIPS is enabled on the application gateway resource. + EnableFips *bool `json:"enableFips,omitempty"` + // AutoscaleConfiguration - Autoscale Configuration. + AutoscaleConfiguration *ApplicationGatewayAutoscaleConfiguration `json:"autoscaleConfiguration,omitempty"` + // PrivateLinkConfigurations - PrivateLink configurations on application gateway. + PrivateLinkConfigurations *[]ApplicationGatewayPrivateLinkConfiguration `json:"privateLinkConfigurations,omitempty"` + // PrivateEndpointConnections - READ-ONLY; Private Endpoint connections on application gateway. + PrivateEndpointConnections *[]ApplicationGatewayPrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the application gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // CustomErrorConfigurations - Custom error configurations of the application gateway resource. + CustomErrorConfigurations *[]ApplicationGatewayCustomError `json:"customErrorConfigurations,omitempty"` + // ForceFirewallPolicyAssociation - If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. + ForceFirewallPolicyAssociation *bool `json:"forceFirewallPolicyAssociation,omitempty"` + // LoadDistributionPolicies - Load distribution policies of the application gateway resource. + LoadDistributionPolicies *[]ApplicationGatewayLoadDistributionPolicy `json:"loadDistributionPolicies,omitempty"` + // GlobalConfiguration - Global Configuration. + GlobalConfiguration *ApplicationGatewayGlobalConfiguration `json:"globalConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayPropertiesFormat. +func (agpf ApplicationGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agpf.Sku != nil { + objectMap["sku"] = agpf.Sku + } + if agpf.SslPolicy != nil { + objectMap["sslPolicy"] = agpf.SslPolicy + } + if agpf.GatewayIPConfigurations != nil { + objectMap["gatewayIPConfigurations"] = agpf.GatewayIPConfigurations + } + if agpf.AuthenticationCertificates != nil { + objectMap["authenticationCertificates"] = agpf.AuthenticationCertificates + } + if agpf.TrustedRootCertificates != nil { + objectMap["trustedRootCertificates"] = agpf.TrustedRootCertificates + } + if agpf.TrustedClientCertificates != nil { + objectMap["trustedClientCertificates"] = agpf.TrustedClientCertificates + } + if agpf.SslCertificates != nil { + objectMap["sslCertificates"] = agpf.SslCertificates + } + if agpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = agpf.FrontendIPConfigurations + } + if agpf.FrontendPorts != nil { + objectMap["frontendPorts"] = agpf.FrontendPorts + } + if agpf.Probes != nil { + objectMap["probes"] = agpf.Probes + } + if agpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = agpf.BackendAddressPools + } + if agpf.BackendHTTPSettingsCollection != nil { + objectMap["backendHttpSettingsCollection"] = agpf.BackendHTTPSettingsCollection + } + if agpf.BackendSettingsCollection != nil { + objectMap["backendSettingsCollection"] = agpf.BackendSettingsCollection + } + if agpf.HTTPListeners != nil { + objectMap["httpListeners"] = agpf.HTTPListeners + } + if agpf.Listeners != nil { + objectMap["listeners"] = agpf.Listeners + } + if agpf.SslProfiles != nil { + objectMap["sslProfiles"] = agpf.SslProfiles + } + if agpf.URLPathMaps != nil { + objectMap["urlPathMaps"] = agpf.URLPathMaps + } + if agpf.RequestRoutingRules != nil { + objectMap["requestRoutingRules"] = agpf.RequestRoutingRules + } + if agpf.RoutingRules != nil { + objectMap["routingRules"] = agpf.RoutingRules + } + if agpf.RewriteRuleSets != nil { + objectMap["rewriteRuleSets"] = agpf.RewriteRuleSets + } + if agpf.RedirectConfigurations != nil { + objectMap["redirectConfigurations"] = agpf.RedirectConfigurations + } + if agpf.WebApplicationFirewallConfiguration != nil { + objectMap["webApplicationFirewallConfiguration"] = agpf.WebApplicationFirewallConfiguration + } + if agpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = agpf.FirewallPolicy + } + if agpf.EnableHTTP2 != nil { + objectMap["enableHttp2"] = agpf.EnableHTTP2 + } + if agpf.EnableFips != nil { + objectMap["enableFips"] = agpf.EnableFips + } + if agpf.AutoscaleConfiguration != nil { + objectMap["autoscaleConfiguration"] = agpf.AutoscaleConfiguration + } + if agpf.PrivateLinkConfigurations != nil { + objectMap["privateLinkConfigurations"] = agpf.PrivateLinkConfigurations + } + if agpf.CustomErrorConfigurations != nil { + objectMap["customErrorConfigurations"] = agpf.CustomErrorConfigurations + } + if agpf.ForceFirewallPolicyAssociation != nil { + objectMap["forceFirewallPolicyAssociation"] = agpf.ForceFirewallPolicyAssociation + } + if agpf.LoadDistributionPolicies != nil { + objectMap["loadDistributionPolicies"] = agpf.LoadDistributionPolicies + } + if agpf.GlobalConfiguration != nil { + objectMap["globalConfiguration"] = agpf.GlobalConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRedirectConfiguration redirect configuration of an application gateway. +type ApplicationGatewayRedirectConfiguration struct { + // ApplicationGatewayRedirectConfigurationPropertiesFormat - Properties of the application gateway redirect configuration. + *ApplicationGatewayRedirectConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the redirect configuration that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRedirectConfiguration. +func (agrc ApplicationGatewayRedirectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat != nil { + objectMap["properties"] = agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat + } + if agrc.Name != nil { + objectMap["name"] = agrc.Name + } + if agrc.ID != nil { + objectMap["id"] = agrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRedirectConfiguration struct. +func (agrc *ApplicationGatewayRedirectConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRedirectConfigurationPropertiesFormat ApplicationGatewayRedirectConfigurationPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRedirectConfigurationPropertiesFormat) + if err != nil { + return err + } + agrc.ApplicationGatewayRedirectConfigurationPropertiesFormat = &applicationGatewayRedirectConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRedirectConfigurationPropertiesFormat properties of redirect configuration of the +// application gateway. +type ApplicationGatewayRedirectConfigurationPropertiesFormat struct { + // RedirectType - HTTP redirection type. Possible values include: 'ApplicationGatewayRedirectTypePermanent', 'ApplicationGatewayRedirectTypeFound', 'ApplicationGatewayRedirectTypeSeeOther', 'ApplicationGatewayRedirectTypeTemporary' + RedirectType ApplicationGatewayRedirectType `json:"redirectType,omitempty"` + // TargetListener - Reference to a listener to redirect the request to. + TargetListener *SubResource `json:"targetListener,omitempty"` + // TargetURL - Url to redirect the request to. + TargetURL *string `json:"targetUrl,omitempty"` + // IncludePath - Include path in the redirected url. + IncludePath *bool `json:"includePath,omitempty"` + // IncludeQueryString - Include query string in the redirected url. + IncludeQueryString *bool `json:"includeQueryString,omitempty"` + // RequestRoutingRules - Request routing specifying redirect configuration. + RequestRoutingRules *[]SubResource `json:"requestRoutingRules,omitempty"` + // URLPathMaps - Url path maps specifying default redirect configuration. + URLPathMaps *[]SubResource `json:"urlPathMaps,omitempty"` + // PathRules - Path rules specifying redirect configuration. + PathRules *[]SubResource `json:"pathRules,omitempty"` +} + +// ApplicationGatewayRequestRoutingRule request routing rule of an application gateway. +type ApplicationGatewayRequestRoutingRule struct { + // ApplicationGatewayRequestRoutingRulePropertiesFormat - Properties of the application gateway request routing rule. + *ApplicationGatewayRequestRoutingRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the request routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRule. +func (agrrr ApplicationGatewayRequestRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat != nil { + objectMap["properties"] = agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat + } + if agrrr.Name != nil { + objectMap["name"] = agrrr.Name + } + if agrrr.ID != nil { + objectMap["id"] = agrrr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRequestRoutingRule struct. +func (agrrr *ApplicationGatewayRequestRoutingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRequestRoutingRulePropertiesFormat ApplicationGatewayRequestRoutingRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRequestRoutingRulePropertiesFormat) + if err != nil { + return err + } + agrrr.ApplicationGatewayRequestRoutingRulePropertiesFormat = &applicationGatewayRequestRoutingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrrr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrrr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrrr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrrr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRequestRoutingRulePropertiesFormat properties of request routing rule of the +// application gateway. +type ApplicationGatewayRequestRoutingRulePropertiesFormat struct { + // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' + RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + // Priority - Priority of the request routing rule. + Priority *int32 `json:"priority,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendHTTPSettings - Backend http settings resource of the application gateway. + BackendHTTPSettings *SubResource `json:"backendHttpSettings,omitempty"` + // HTTPListener - Http listener resource of the application gateway. + HTTPListener *SubResource `json:"httpListener,omitempty"` + // URLPathMap - URL path map resource of the application gateway. + URLPathMap *SubResource `json:"urlPathMap,omitempty"` + // RewriteRuleSet - Rewrite Rule Set resource in Basic rule of the application gateway. + RewriteRuleSet *SubResource `json:"rewriteRuleSet,omitempty"` + // RedirectConfiguration - Redirect configuration resource of the application gateway. + RedirectConfiguration *SubResource `json:"redirectConfiguration,omitempty"` + // LoadDistributionPolicy - Load Distribution Policy resource of the application gateway. + LoadDistributionPolicy *SubResource `json:"loadDistributionPolicy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRequestRoutingRulePropertiesFormat. +func (agrrrpf ApplicationGatewayRequestRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrrpf.RuleType != "" { + objectMap["ruleType"] = agrrrpf.RuleType + } + if agrrrpf.Priority != nil { + objectMap["priority"] = agrrrpf.Priority + } + if agrrrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agrrrpf.BackendAddressPool + } + if agrrrpf.BackendHTTPSettings != nil { + objectMap["backendHttpSettings"] = agrrrpf.BackendHTTPSettings + } + if agrrrpf.HTTPListener != nil { + objectMap["httpListener"] = agrrrpf.HTTPListener + } + if agrrrpf.URLPathMap != nil { + objectMap["urlPathMap"] = agrrrpf.URLPathMap + } + if agrrrpf.RewriteRuleSet != nil { + objectMap["rewriteRuleSet"] = agrrrpf.RewriteRuleSet + } + if agrrrpf.RedirectConfiguration != nil { + objectMap["redirectConfiguration"] = agrrrpf.RedirectConfiguration + } + if agrrrpf.LoadDistributionPolicy != nil { + objectMap["loadDistributionPolicy"] = agrrrpf.LoadDistributionPolicy + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRewriteRule rewrite rule of an application gateway. +type ApplicationGatewayRewriteRule struct { + // Name - Name of the rewrite rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // RuleSequence - Rule Sequence of the rewrite rule that determines the order of execution of a particular rule in a RewriteRuleSet. + RuleSequence *int32 `json:"ruleSequence,omitempty"` + // Conditions - Conditions based on which the action set execution will be evaluated. + Conditions *[]ApplicationGatewayRewriteRuleCondition `json:"conditions,omitempty"` + // ActionSet - Set of actions to be done as part of the rewrite Rule. + ActionSet *ApplicationGatewayRewriteRuleActionSet `json:"actionSet,omitempty"` +} + +// ApplicationGatewayRewriteRuleActionSet set of actions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleActionSet struct { + // RequestHeaderConfigurations - Request Header Actions in the Action Set. + RequestHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"requestHeaderConfigurations,omitempty"` + // ResponseHeaderConfigurations - Response Header Actions in the Action Set. + ResponseHeaderConfigurations *[]ApplicationGatewayHeaderConfiguration `json:"responseHeaderConfigurations,omitempty"` + // URLConfiguration - Url Configuration Action in the Action Set. + URLConfiguration *ApplicationGatewayURLConfiguration `json:"urlConfiguration,omitempty"` +} + +// ApplicationGatewayRewriteRuleCondition set of conditions in the Rewrite Rule in Application Gateway. +type ApplicationGatewayRewriteRuleCondition struct { + // Variable - The condition parameter of the RewriteRuleCondition. + Variable *string `json:"variable,omitempty"` + // Pattern - The pattern, either fixed string or regular expression, that evaluates the truthfulness of the condition. + Pattern *string `json:"pattern,omitempty"` + // IgnoreCase - Setting this parameter to truth value with force the pattern to do a case in-sensitive comparison. + IgnoreCase *bool `json:"ignoreCase,omitempty"` + // Negate - Setting this value as truth will force to check the negation of the condition given by the user. + Negate *bool `json:"negate,omitempty"` +} + +// ApplicationGatewayRewriteRuleSet rewrite rule set of an application gateway. +type ApplicationGatewayRewriteRuleSet struct { + // ApplicationGatewayRewriteRuleSetPropertiesFormat - Properties of the application gateway rewrite rule set. + *ApplicationGatewayRewriteRuleSetPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the rewrite rule set that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSet. +func (agrrs ApplicationGatewayRewriteRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat != nil { + objectMap["properties"] = agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat + } + if agrrs.Name != nil { + objectMap["name"] = agrrs.Name + } + if agrrs.ID != nil { + objectMap["id"] = agrrs.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRewriteRuleSet struct. +func (agrrs *ApplicationGatewayRewriteRuleSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRewriteRuleSetPropertiesFormat ApplicationGatewayRewriteRuleSetPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRewriteRuleSetPropertiesFormat) + if err != nil { + return err + } + agrrs.ApplicationGatewayRewriteRuleSetPropertiesFormat = &applicationGatewayRewriteRuleSetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrrs.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrrs.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrrs.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRewriteRuleSetPropertiesFormat properties of rewrite rule set of the application +// gateway. +type ApplicationGatewayRewriteRuleSetPropertiesFormat struct { + // RewriteRules - Rewrite rules in the rewrite rule set. + RewriteRules *[]ApplicationGatewayRewriteRule `json:"rewriteRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the rewrite rule set resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRewriteRuleSetPropertiesFormat. +func (agrrspf ApplicationGatewayRewriteRuleSetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrspf.RewriteRules != nil { + objectMap["rewriteRules"] = agrrspf.RewriteRules + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayRoutingRule routing rule of an application gateway. +type ApplicationGatewayRoutingRule struct { + // ApplicationGatewayRoutingRulePropertiesFormat - Properties of the application gateway routing rule. + *ApplicationGatewayRoutingRulePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the routing rule that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRule. +func (agrr ApplicationGatewayRoutingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrr.ApplicationGatewayRoutingRulePropertiesFormat != nil { + objectMap["properties"] = agrr.ApplicationGatewayRoutingRulePropertiesFormat + } + if agrr.Name != nil { + objectMap["name"] = agrr.Name + } + if agrr.ID != nil { + objectMap["id"] = agrr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayRoutingRule struct. +func (agrr *ApplicationGatewayRoutingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayRoutingRulePropertiesFormat ApplicationGatewayRoutingRulePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayRoutingRulePropertiesFormat) + if err != nil { + return err + } + agrr.ApplicationGatewayRoutingRulePropertiesFormat = &applicationGatewayRoutingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agrr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agrr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agrr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agrr.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayRoutingRulePropertiesFormat properties of routing rule of the application gateway. +type ApplicationGatewayRoutingRulePropertiesFormat struct { + // RuleType - Rule type. Possible values include: 'ApplicationGatewayRequestRoutingRuleTypeBasic', 'ApplicationGatewayRequestRoutingRuleTypePathBasedRouting' + RuleType ApplicationGatewayRequestRoutingRuleType `json:"ruleType,omitempty"` + // BackendAddressPool - Backend address pool resource of the application gateway. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendSettings - Backend settings resource of the application gateway. + BackendSettings *SubResource `json:"backendSettings,omitempty"` + // Listener - Listener resource of the application gateway. + Listener *SubResource `json:"listener,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the request routing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayRoutingRulePropertiesFormat. +func (agrrpf ApplicationGatewayRoutingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agrrpf.RuleType != "" { + objectMap["ruleType"] = agrrpf.RuleType + } + if agrrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = agrrpf.BackendAddressPool + } + if agrrpf.BackendSettings != nil { + objectMap["backendSettings"] = agrrpf.BackendSettings + } + if agrrpf.Listener != nil { + objectMap["listener"] = agrrpf.Listener + } + return json.Marshal(objectMap) +} + +// ApplicationGatewaysBackendHealthFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysBackendHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealth, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysBackendHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysBackendHealthFuture.Result. +func (future *ApplicationGatewaysBackendHealthFuture) result(client ApplicationGatewaysClient) (agbh ApplicationGatewayBackendHealth, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agbh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbh.Response.Response, err = future.GetResult(sender); err == nil && agbh.Response.Response.StatusCode != http.StatusNoContent { + agbh, err = client.BackendHealthResponder(agbh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthFuture", "Result", agbh.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysBackendHealthOnDemandFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ApplicationGatewaysBackendHealthOnDemandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGatewayBackendHealthOnDemand, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysBackendHealthOnDemandFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysBackendHealthOnDemandFuture.Result. +func (future *ApplicationGatewaysBackendHealthOnDemandFuture) result(client ApplicationGatewaysClient) (agbhod ApplicationGatewayBackendHealthOnDemand, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + agbhod.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysBackendHealthOnDemandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if agbhod.Response.Response, err = future.GetResult(sender); err == nil && agbhod.Response.Response.StatusCode != http.StatusNoContent { + agbhod, err = client.BackendHealthOnDemandResponder(agbhod.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysBackendHealthOnDemandFuture", "Result", agbhod.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (ApplicationGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysCreateOrUpdateFuture.Result. +func (future *ApplicationGatewaysCreateOrUpdateFuture) result(client ApplicationGatewaysClient) (ag ApplicationGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ag.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ag.Response.Response, err = future.GetResult(sender); err == nil && ag.Response.Response.StatusCode != http.StatusNoContent { + ag, err = client.CreateOrUpdateResponder(ag.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysCreateOrUpdateFuture", "Result", ag.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysDeleteFuture.Result. +func (future *ApplicationGatewaysDeleteFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewaySku SKU of an application gateway. +type ApplicationGatewaySku struct { + // Name - Name of an application gateway SKU. Possible values include: 'ApplicationGatewaySkuNameStandardSmall', 'ApplicationGatewaySkuNameStandardMedium', 'ApplicationGatewaySkuNameStandardLarge', 'ApplicationGatewaySkuNameWAFMedium', 'ApplicationGatewaySkuNameWAFLarge', 'ApplicationGatewaySkuNameStandardV2', 'ApplicationGatewaySkuNameWAFV2' + Name ApplicationGatewaySkuName `json:"name,omitempty"` + // Tier - Tier of an application gateway. Possible values include: 'ApplicationGatewayTierStandard', 'ApplicationGatewayTierWAF', 'ApplicationGatewayTierStandardV2', 'ApplicationGatewayTierWAFV2' + Tier ApplicationGatewayTier `json:"tier,omitempty"` + // Capacity - Capacity (instance count) of an application gateway. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ApplicationGatewaySslCertificate SSL certificates of an application gateway. +type ApplicationGatewaySslCertificate struct { + // ApplicationGatewaySslCertificatePropertiesFormat - Properties of the application gateway SSL certificate. + *ApplicationGatewaySslCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the SSL certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificate. +func (agsc ApplicationGatewaySslCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsc.ApplicationGatewaySslCertificatePropertiesFormat != nil { + objectMap["properties"] = agsc.ApplicationGatewaySslCertificatePropertiesFormat + } + if agsc.Name != nil { + objectMap["name"] = agsc.Name + } + if agsc.ID != nil { + objectMap["id"] = agsc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslCertificate struct. +func (agsc *ApplicationGatewaySslCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewaySslCertificatePropertiesFormat ApplicationGatewaySslCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslCertificatePropertiesFormat) + if err != nil { + return err + } + agsc.ApplicationGatewaySslCertificatePropertiesFormat = &applicationGatewaySslCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agsc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agsc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agsc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agsc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslCertificatePropertiesFormat properties of SSL certificates of an application +// gateway. +type ApplicationGatewaySslCertificatePropertiesFormat struct { + // Data - Base-64 encoded pfx certificate. Only applicable in PUT Request. + Data *string `json:"data,omitempty"` + // Password - Password for the pfx file specified in data. Only applicable in PUT request. + Password *string `json:"password,omitempty"` + // PublicCertData - READ-ONLY; Base-64 encoded Public cert data corresponding to pfx specified in data. Only applicable in GET request. + PublicCertData *string `json:"publicCertData,omitempty"` + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the SSL certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslCertificatePropertiesFormat. +func (agscpf ApplicationGatewaySslCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agscpf.Data != nil { + objectMap["data"] = agscpf.Data + } + if agscpf.Password != nil { + objectMap["password"] = agscpf.Password + } + if agscpf.KeyVaultSecretID != nil { + objectMap["keyVaultSecretId"] = agscpf.KeyVaultSecretID + } + return json.Marshal(objectMap) +} + +// ApplicationGatewaySslPolicy application Gateway Ssl policy. +type ApplicationGatewaySslPolicy struct { + // DisabledSslProtocols - Ssl protocols to be disabled on application gateway. + DisabledSslProtocols *[]ApplicationGatewaySslProtocol `json:"disabledSslProtocols,omitempty"` + // PolicyType - Type of Ssl Policy. Possible values include: 'ApplicationGatewaySslPolicyTypePredefined', 'ApplicationGatewaySslPolicyTypeCustom' + PolicyType ApplicationGatewaySslPolicyType `json:"policyType,omitempty"` + // PolicyName - Name of Ssl predefined policy. Possible values include: 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20150501', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401', 'ApplicationGatewaySslPolicyNameAppGwSslPolicy20170401S' + PolicyName ApplicationGatewaySslPolicyName `json:"policyName,omitempty"` + // CipherSuites - Ssl cipher suites to be enabled in the specified order to application gateway. + CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` + // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12' + MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` +} + +// ApplicationGatewaySslPredefinedPolicy an Ssl predefined policy. +type ApplicationGatewaySslPredefinedPolicy struct { + autorest.Response `json:"-"` + // Name - Name of the Ssl predefined policy. + Name *string `json:"name,omitempty"` + // ApplicationGatewaySslPredefinedPolicyPropertiesFormat - Properties of the application gateway SSL predefined policy. + *ApplicationGatewaySslPredefinedPolicyPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslPredefinedPolicy. +func (agspp ApplicationGatewaySslPredefinedPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agspp.Name != nil { + objectMap["name"] = agspp.Name + } + if agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat != nil { + objectMap["properties"] = agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat + } + if agspp.ID != nil { + objectMap["id"] = agspp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslPredefinedPolicy struct. +func (agspp *ApplicationGatewaySslPredefinedPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agspp.Name = &name + } + case "properties": + if v != nil { + var applicationGatewaySslPredefinedPolicyPropertiesFormat ApplicationGatewaySslPredefinedPolicyPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslPredefinedPolicyPropertiesFormat) + if err != nil { + return err + } + agspp.ApplicationGatewaySslPredefinedPolicyPropertiesFormat = &applicationGatewaySslPredefinedPolicyPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agspp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslPredefinedPolicyPropertiesFormat properties of +// ApplicationGatewaySslPredefinedPolicy. +type ApplicationGatewaySslPredefinedPolicyPropertiesFormat struct { + // CipherSuites - Ssl cipher suites to be enabled in the specified order for application gateway. + CipherSuites *[]ApplicationGatewaySslCipherSuite `json:"cipherSuites,omitempty"` + // MinProtocolVersion - Minimum version of Ssl protocol to be supported on application gateway. Possible values include: 'ApplicationGatewaySslProtocolTLSv10', 'ApplicationGatewaySslProtocolTLSv11', 'ApplicationGatewaySslProtocolTLSv12' + MinProtocolVersion ApplicationGatewaySslProtocol `json:"minProtocolVersion,omitempty"` +} + +// ApplicationGatewaySslProfile SSL profile of an application gateway. +type ApplicationGatewaySslProfile struct { + // ApplicationGatewaySslProfilePropertiesFormat - Properties of the application gateway SSL profile. + *ApplicationGatewaySslProfilePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the SSL profile that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfile. +func (agsp ApplicationGatewaySslProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsp.ApplicationGatewaySslProfilePropertiesFormat != nil { + objectMap["properties"] = agsp.ApplicationGatewaySslProfilePropertiesFormat + } + if agsp.Name != nil { + objectMap["name"] = agsp.Name + } + if agsp.ID != nil { + objectMap["id"] = agsp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewaySslProfile struct. +func (agsp *ApplicationGatewaySslProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewaySslProfilePropertiesFormat ApplicationGatewaySslProfilePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewaySslProfilePropertiesFormat) + if err != nil { + return err + } + agsp.ApplicationGatewaySslProfilePropertiesFormat = &applicationGatewaySslProfilePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agsp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agsp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agsp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agsp.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewaySslProfilePropertiesFormat properties of SSL profile of an application gateway. +type ApplicationGatewaySslProfilePropertiesFormat struct { + // TrustedClientCertificates - Array of references to application gateway trusted client certificates. + TrustedClientCertificates *[]SubResource `json:"trustedClientCertificates,omitempty"` + // SslPolicy - SSL policy of the application gateway resource. + SslPolicy *ApplicationGatewaySslPolicy `json:"sslPolicy,omitempty"` + // ClientAuthConfiguration - Client authentication configuration of the application gateway resource. + ClientAuthConfiguration *ApplicationGatewayClientAuthConfiguration `json:"clientAuthConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the HTTP listener resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewaySslProfilePropertiesFormat. +func (agsppf ApplicationGatewaySslProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agsppf.TrustedClientCertificates != nil { + objectMap["trustedClientCertificates"] = agsppf.TrustedClientCertificates + } + if agsppf.SslPolicy != nil { + objectMap["sslPolicy"] = agsppf.SslPolicy + } + if agsppf.ClientAuthConfiguration != nil { + objectMap["clientAuthConfiguration"] = agsppf.ClientAuthConfiguration + } + return json.Marshal(objectMap) +} + +// ApplicationGatewaysStartFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationGatewaysStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysStartFuture.Result. +func (future *ApplicationGatewaysStartFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewaysStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ApplicationGatewaysStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationGatewaysStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationGatewaysStopFuture.Result. +func (future *ApplicationGatewaysStopFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationGatewaysStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationGatewaysStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ApplicationGatewayTrustedClientCertificate trusted client certificates of an application gateway. +type ApplicationGatewayTrustedClientCertificate struct { + // ApplicationGatewayTrustedClientCertificatePropertiesFormat - Properties of the application gateway trusted client certificate. + *ApplicationGatewayTrustedClientCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the trusted client certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificate. +func (agtcc ApplicationGatewayTrustedClientCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat != nil { + objectMap["properties"] = agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat + } + if agtcc.Name != nil { + objectMap["name"] = agtcc.Name + } + if agtcc.ID != nil { + objectMap["id"] = agtcc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedClientCertificate struct. +func (agtcc *ApplicationGatewayTrustedClientCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayTrustedClientCertificatePropertiesFormat ApplicationGatewayTrustedClientCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayTrustedClientCertificatePropertiesFormat) + if err != nil { + return err + } + agtcc.ApplicationGatewayTrustedClientCertificatePropertiesFormat = &applicationGatewayTrustedClientCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agtcc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agtcc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agtcc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agtcc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayTrustedClientCertificatePropertiesFormat trusted client certificates properties of an +// application gateway. +type ApplicationGatewayTrustedClientCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // ValidatedCertData - READ-ONLY; Validated certificate data. + ValidatedCertData *string `json:"validatedCertData,omitempty"` + // ClientCertIssuerDN - READ-ONLY; Distinguished name of client certificate issuer. + ClientCertIssuerDN *string `json:"clientCertIssuerDN,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the trusted client certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedClientCertificatePropertiesFormat. +func (agtccpf ApplicationGatewayTrustedClientCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtccpf.Data != nil { + objectMap["data"] = agtccpf.Data + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayTrustedRootCertificate trusted Root certificates of an application gateway. +type ApplicationGatewayTrustedRootCertificate struct { + // ApplicationGatewayTrustedRootCertificatePropertiesFormat - Properties of the application gateway trusted root certificate. + *ApplicationGatewayTrustedRootCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - Name of the trusted root certificate that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificate. +func (agtrc ApplicationGatewayTrustedRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat != nil { + objectMap["properties"] = agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat + } + if agtrc.Name != nil { + objectMap["name"] = agtrc.Name + } + if agtrc.ID != nil { + objectMap["id"] = agtrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayTrustedRootCertificate struct. +func (agtrc *ApplicationGatewayTrustedRootCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayTrustedRootCertificatePropertiesFormat ApplicationGatewayTrustedRootCertificatePropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayTrustedRootCertificatePropertiesFormat) + if err != nil { + return err + } + agtrc.ApplicationGatewayTrustedRootCertificatePropertiesFormat = &applicationGatewayTrustedRootCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agtrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agtrc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agtrc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agtrc.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayTrustedRootCertificatePropertiesFormat trusted Root certificates properties of an +// application gateway. +type ApplicationGatewayTrustedRootCertificatePropertiesFormat struct { + // Data - Certificate public data. + Data *string `json:"data,omitempty"` + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the trusted root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayTrustedRootCertificatePropertiesFormat. +func (agtrcpf ApplicationGatewayTrustedRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agtrcpf.Data != nil { + objectMap["data"] = agtrcpf.Data + } + if agtrcpf.KeyVaultSecretID != nil { + objectMap["keyVaultSecretId"] = agtrcpf.KeyVaultSecretID + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayURLConfiguration url configuration of the Actions set in Application Gateway. +type ApplicationGatewayURLConfiguration struct { + // ModifiedPath - Url path which user has provided for url rewrite. Null means no path will be updated. Default value is null. + ModifiedPath *string `json:"modifiedPath,omitempty"` + // ModifiedQueryString - Query string which user has provided for url rewrite. Null means no query string will be updated. Default value is null. + ModifiedQueryString *string `json:"modifiedQueryString,omitempty"` + // Reroute - If set as true, it will re-evaluate the url path map provided in path based request routing rules using modified path. Default value is false. + Reroute *bool `json:"reroute,omitempty"` +} + +// ApplicationGatewayURLPathMap urlPathMaps give a url path to the backend mapping information for +// PathBasedRouting. +type ApplicationGatewayURLPathMap struct { + // ApplicationGatewayURLPathMapPropertiesFormat - Properties of the application gateway URL path map. + *ApplicationGatewayURLPathMapPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the URL path map that is unique within an Application Gateway. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMap. +func (agupm ApplicationGatewayURLPathMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agupm.ApplicationGatewayURLPathMapPropertiesFormat != nil { + objectMap["properties"] = agupm.ApplicationGatewayURLPathMapPropertiesFormat + } + if agupm.Name != nil { + objectMap["name"] = agupm.Name + } + if agupm.ID != nil { + objectMap["id"] = agupm.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationGatewayURLPathMap struct. +func (agupm *ApplicationGatewayURLPathMap) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationGatewayURLPathMapPropertiesFormat ApplicationGatewayURLPathMapPropertiesFormat + err = json.Unmarshal(*v, &applicationGatewayURLPathMapPropertiesFormat) + if err != nil { + return err + } + agupm.ApplicationGatewayURLPathMapPropertiesFormat = &applicationGatewayURLPathMapPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + agupm.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + agupm.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + agupm.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + agupm.ID = &ID + } + } + } + + return nil +} + +// ApplicationGatewayURLPathMapPropertiesFormat properties of UrlPathMap of the application gateway. +type ApplicationGatewayURLPathMapPropertiesFormat struct { + // DefaultBackendAddressPool - Default backend address pool resource of URL path map. + DefaultBackendAddressPool *SubResource `json:"defaultBackendAddressPool,omitempty"` + // DefaultBackendHTTPSettings - Default backend http settings resource of URL path map. + DefaultBackendHTTPSettings *SubResource `json:"defaultBackendHttpSettings,omitempty"` + // DefaultRewriteRuleSet - Default Rewrite rule set resource of URL path map. + DefaultRewriteRuleSet *SubResource `json:"defaultRewriteRuleSet,omitempty"` + // DefaultRedirectConfiguration - Default redirect configuration resource of URL path map. + DefaultRedirectConfiguration *SubResource `json:"defaultRedirectConfiguration,omitempty"` + // DefaultLoadDistributionPolicy - Default Load Distribution Policy resource of URL path map. + DefaultLoadDistributionPolicy *SubResource `json:"defaultLoadDistributionPolicy,omitempty"` + // PathRules - Path rule of URL path map resource. + PathRules *[]ApplicationGatewayPathRule `json:"pathRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the URL path map resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationGatewayURLPathMapPropertiesFormat. +func (agupmpf ApplicationGatewayURLPathMapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if agupmpf.DefaultBackendAddressPool != nil { + objectMap["defaultBackendAddressPool"] = agupmpf.DefaultBackendAddressPool + } + if agupmpf.DefaultBackendHTTPSettings != nil { + objectMap["defaultBackendHttpSettings"] = agupmpf.DefaultBackendHTTPSettings + } + if agupmpf.DefaultRewriteRuleSet != nil { + objectMap["defaultRewriteRuleSet"] = agupmpf.DefaultRewriteRuleSet + } + if agupmpf.DefaultRedirectConfiguration != nil { + objectMap["defaultRedirectConfiguration"] = agupmpf.DefaultRedirectConfiguration + } + if agupmpf.DefaultLoadDistributionPolicy != nil { + objectMap["defaultLoadDistributionPolicy"] = agupmpf.DefaultLoadDistributionPolicy + } + if agupmpf.PathRules != nil { + objectMap["pathRules"] = agupmpf.PathRules + } + return json.Marshal(objectMap) +} + +// ApplicationGatewayWebApplicationFirewallConfiguration application gateway web application firewall +// configuration. +type ApplicationGatewayWebApplicationFirewallConfiguration struct { + // Enabled - Whether the web application firewall is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // FirewallMode - Web application firewall mode. Possible values include: 'ApplicationGatewayFirewallModeDetection', 'ApplicationGatewayFirewallModePrevention' + FirewallMode ApplicationGatewayFirewallMode `json:"firewallMode,omitempty"` + // RuleSetType - The type of the web application firewall rule set. Possible values are: 'OWASP'. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - The version of the rule set type. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // DisabledRuleGroups - The disabled rule groups. + DisabledRuleGroups *[]ApplicationGatewayFirewallDisabledRuleGroup `json:"disabledRuleGroups,omitempty"` + // RequestBodyCheck - Whether allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` + // MaxRequestBodySize - Maximum request body size for WAF. + MaxRequestBodySize *int32 `json:"maxRequestBodySize,omitempty"` + // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` + // Exclusions - The exclusion list. + Exclusions *[]ApplicationGatewayFirewallExclusion `json:"exclusions,omitempty"` +} + +// ApplicationRule rule of type application. +type ApplicationRule struct { + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // Protocols - Array of Application Protocols. + Protocols *[]FirewallPolicyRuleApplicationProtocol `json:"protocols,omitempty"` + // TargetFqdns - List of FQDNs for this rule. + TargetFqdns *[]string `json:"targetFqdns,omitempty"` + // TargetUrls - List of Urls for this rule condition. + TargetUrls *[]string `json:"targetUrls,omitempty"` + // FqdnTags - List of FQDN Tags for this rule. + FqdnTags *[]string `json:"fqdnTags,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // TerminateTLS - Terminate TLS connections for this rule. + TerminateTLS *bool `json:"terminateTLS,omitempty"` + // WebCategories - List of destination azure web categories. + WebCategories *[]string `json:"webCategories,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationRule. +func (ar ApplicationRule) MarshalJSON() ([]byte, error) { + ar.RuleType = RuleTypeApplicationRule + objectMap := make(map[string]interface{}) + if ar.SourceAddresses != nil { + objectMap["sourceAddresses"] = ar.SourceAddresses + } + if ar.DestinationAddresses != nil { + objectMap["destinationAddresses"] = ar.DestinationAddresses + } + if ar.Protocols != nil { + objectMap["protocols"] = ar.Protocols + } + if ar.TargetFqdns != nil { + objectMap["targetFqdns"] = ar.TargetFqdns + } + if ar.TargetUrls != nil { + objectMap["targetUrls"] = ar.TargetUrls + } + if ar.FqdnTags != nil { + objectMap["fqdnTags"] = ar.FqdnTags + } + if ar.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = ar.SourceIPGroups + } + if ar.TerminateTLS != nil { + objectMap["terminateTLS"] = ar.TerminateTLS + } + if ar.WebCategories != nil { + objectMap["webCategories"] = ar.WebCategories + } + if ar.Name != nil { + objectMap["name"] = ar.Name + } + if ar.Description != nil { + objectMap["description"] = ar.Description + } + if ar.RuleType != "" { + objectMap["ruleType"] = ar.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsApplicationRule() (*ApplicationRule, bool) { + return &ar, true +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for ApplicationRule. +func (ar ApplicationRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &ar, true +} + +// ApplicationSecurityGroup an application security group in a resource group. +type ApplicationSecurityGroup struct { + autorest.Response `json:"-"` + // ApplicationSecurityGroupPropertiesFormat - Properties of the application security group. + *ApplicationSecurityGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroup. +func (asg ApplicationSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asg.ApplicationSecurityGroupPropertiesFormat != nil { + objectMap["properties"] = asg.ApplicationSecurityGroupPropertiesFormat + } + if asg.ID != nil { + objectMap["id"] = asg.ID + } + if asg.Location != nil { + objectMap["location"] = asg.Location + } + if asg.Tags != nil { + objectMap["tags"] = asg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ApplicationSecurityGroup struct. +func (asg *ApplicationSecurityGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var applicationSecurityGroupPropertiesFormat ApplicationSecurityGroupPropertiesFormat + err = json.Unmarshal(*v, &applicationSecurityGroupPropertiesFormat) + if err != nil { + return err + } + asg.ApplicationSecurityGroupPropertiesFormat = &applicationSecurityGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + asg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + asg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + asg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + asg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + asg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + asg.Tags = tags + } + } + } + + return nil +} + +// ApplicationSecurityGroupListResult a list of application security groups. +type ApplicationSecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of application security groups. + Value *[]ApplicationSecurityGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroupListResult. +func (asglr ApplicationSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asglr.Value != nil { + objectMap["value"] = asglr.Value + } + return json.Marshal(objectMap) +} + +// ApplicationSecurityGroupListResultIterator provides access to a complete listing of +// ApplicationSecurityGroup values. +type ApplicationSecurityGroupListResultIterator struct { + i int + page ApplicationSecurityGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ApplicationSecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ApplicationSecurityGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ApplicationSecurityGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ApplicationSecurityGroupListResultIterator) Response() ApplicationSecurityGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ApplicationSecurityGroupListResultIterator) Value() ApplicationSecurityGroup { + if !iter.page.NotDone() { + return ApplicationSecurityGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ApplicationSecurityGroupListResultIterator type. +func NewApplicationSecurityGroupListResultIterator(page ApplicationSecurityGroupListResultPage) ApplicationSecurityGroupListResultIterator { + return ApplicationSecurityGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asglr ApplicationSecurityGroupListResult) IsEmpty() bool { + return asglr.Value == nil || len(*asglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asglr ApplicationSecurityGroupListResult) hasNextLink() bool { + return asglr.NextLink != nil && len(*asglr.NextLink) != 0 +} + +// applicationSecurityGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asglr ApplicationSecurityGroupListResult) applicationSecurityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !asglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asglr.NextLink))) +} + +// ApplicationSecurityGroupListResultPage contains a page of ApplicationSecurityGroup values. +type ApplicationSecurityGroupListResultPage struct { + fn func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error) + asglr ApplicationSecurityGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ApplicationSecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationSecurityGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asglr) + if err != nil { + return err + } + page.asglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ApplicationSecurityGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ApplicationSecurityGroupListResultPage) NotDone() bool { + return !page.asglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ApplicationSecurityGroupListResultPage) Response() ApplicationSecurityGroupListResult { + return page.asglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ApplicationSecurityGroupListResultPage) Values() []ApplicationSecurityGroup { + if page.asglr.IsEmpty() { + return nil + } + return *page.asglr.Value +} + +// Creates a new instance of the ApplicationSecurityGroupListResultPage type. +func NewApplicationSecurityGroupListResultPage(cur ApplicationSecurityGroupListResult, getNextPage func(context.Context, ApplicationSecurityGroupListResult) (ApplicationSecurityGroupListResult, error)) ApplicationSecurityGroupListResultPage { + return ApplicationSecurityGroupListResultPage{ + fn: getNextPage, + asglr: cur, + } +} + +// ApplicationSecurityGroupPropertiesFormat application security group properties. +type ApplicationSecurityGroupPropertiesFormat struct { + // ResourceGUID - READ-ONLY; The resource GUID property of the application security group resource. It uniquely identifies a resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ApplicationSecurityGroupPropertiesFormat. +func (asgpf ApplicationSecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApplicationSecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ApplicationSecurityGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationSecurityGroupsClient) (ApplicationSecurityGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationSecurityGroupsCreateOrUpdateFuture.Result. +func (future *ApplicationSecurityGroupsCreateOrUpdateFuture) result(client ApplicationSecurityGroupsClient) (asg ApplicationSecurityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + asg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asg.Response.Response, err = future.GetResult(sender); err == nil && asg.Response.Response.StatusCode != http.StatusNoContent { + asg, err = client.CreateOrUpdateResponder(asg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsCreateOrUpdateFuture", "Result", asg.Response.Response, "Failure responding to request") + } + } + return +} + +// ApplicationSecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ApplicationSecurityGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ApplicationSecurityGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ApplicationSecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ApplicationSecurityGroupsDeleteFuture.Result. +func (future *ApplicationSecurityGroupsDeleteFuture) result(client ApplicationSecurityGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ApplicationSecurityGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AuthorizationListResult response for ListAuthorizations API service call retrieves all authorizations +// that belongs to an ExpressRouteCircuit. +type AuthorizationListResult struct { + autorest.Response `json:"-"` + // Value - The authorizations in an ExpressRoute Circuit. + Value *[]ExpressRouteCircuitAuthorization `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AuthorizationListResultIterator provides access to a complete listing of +// ExpressRouteCircuitAuthorization values. +type AuthorizationListResultIterator struct { + i int + page AuthorizationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AuthorizationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AuthorizationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AuthorizationListResultIterator) Response() AuthorizationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AuthorizationListResultIterator) Value() ExpressRouteCircuitAuthorization { + if !iter.page.NotDone() { + return ExpressRouteCircuitAuthorization{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AuthorizationListResultIterator type. +func NewAuthorizationListResultIterator(page AuthorizationListResultPage) AuthorizationListResultIterator { + return AuthorizationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (alr AuthorizationListResult) IsEmpty() bool { + return alr.Value == nil || len(*alr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (alr AuthorizationListResult) hasNextLink() bool { + return alr.NextLink != nil && len(*alr.NextLink) != 0 +} + +// authorizationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (alr AuthorizationListResult) authorizationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !alr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(alr.NextLink))) +} + +// AuthorizationListResultPage contains a page of ExpressRouteCircuitAuthorization values. +type AuthorizationListResultPage struct { + fn func(context.Context, AuthorizationListResult) (AuthorizationListResult, error) + alr AuthorizationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AuthorizationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.alr) + if err != nil { + return err + } + page.alr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AuthorizationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AuthorizationListResultPage) NotDone() bool { + return !page.alr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AuthorizationListResultPage) Response() AuthorizationListResult { + return page.alr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AuthorizationListResultPage) Values() []ExpressRouteCircuitAuthorization { + if page.alr.IsEmpty() { + return nil + } + return *page.alr.Value +} + +// Creates a new instance of the AuthorizationListResultPage type. +func NewAuthorizationListResultPage(cur AuthorizationListResult, getNextPage func(context.Context, AuthorizationListResult) (AuthorizationListResult, error)) AuthorizationListResultPage { + return AuthorizationListResultPage{ + fn: getNextPage, + alr: cur, + } +} + +// AuthorizationPropertiesFormat properties of ExpressRouteCircuitAuthorization. +type AuthorizationPropertiesFormat struct { + // AuthorizationKey - The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // AuthorizationUseStatus - The authorization use status. Possible values include: 'AuthorizationUseStatusAvailable', 'AuthorizationUseStatusInUse' + AuthorizationUseStatus AuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AuthorizationPropertiesFormat. +func (apf AuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apf.AuthorizationKey != nil { + objectMap["authorizationKey"] = apf.AuthorizationKey + } + if apf.AuthorizationUseStatus != "" { + objectMap["authorizationUseStatus"] = apf.AuthorizationUseStatus + } + return json.Marshal(objectMap) +} + +// AutoApprovedPrivateLinkService the information of an AutoApprovedPrivateLinkService. +type AutoApprovedPrivateLinkService struct { + // PrivateLinkService - The id of the private link service resource. + PrivateLinkService *string `json:"privateLinkService,omitempty"` +} + +// AutoApprovedPrivateLinkServicesResult an array of private link service id that can be linked to a +// private end point with auto approved. +type AutoApprovedPrivateLinkServicesResult struct { + autorest.Response `json:"-"` + // Value - An array of auto approved private link service. + Value *[]AutoApprovedPrivateLinkService `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AutoApprovedPrivateLinkServicesResult. +func (aaplsr AutoApprovedPrivateLinkServicesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aaplsr.Value != nil { + objectMap["value"] = aaplsr.Value + } + return json.Marshal(objectMap) +} + +// AutoApprovedPrivateLinkServicesResultIterator provides access to a complete listing of +// AutoApprovedPrivateLinkService values. +type AutoApprovedPrivateLinkServicesResultIterator struct { + i int + page AutoApprovedPrivateLinkServicesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AutoApprovedPrivateLinkServicesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AutoApprovedPrivateLinkServicesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AutoApprovedPrivateLinkServicesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AutoApprovedPrivateLinkServicesResultIterator) Response() AutoApprovedPrivateLinkServicesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AutoApprovedPrivateLinkServicesResultIterator) Value() AutoApprovedPrivateLinkService { + if !iter.page.NotDone() { + return AutoApprovedPrivateLinkService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AutoApprovedPrivateLinkServicesResultIterator type. +func NewAutoApprovedPrivateLinkServicesResultIterator(page AutoApprovedPrivateLinkServicesResultPage) AutoApprovedPrivateLinkServicesResultIterator { + return AutoApprovedPrivateLinkServicesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aaplsr AutoApprovedPrivateLinkServicesResult) IsEmpty() bool { + return aaplsr.Value == nil || len(*aaplsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aaplsr AutoApprovedPrivateLinkServicesResult) hasNextLink() bool { + return aaplsr.NextLink != nil && len(*aaplsr.NextLink) != 0 +} + +// autoApprovedPrivateLinkServicesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aaplsr AutoApprovedPrivateLinkServicesResult) autoApprovedPrivateLinkServicesResultPreparer(ctx context.Context) (*http.Request, error) { + if !aaplsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aaplsr.NextLink))) +} + +// AutoApprovedPrivateLinkServicesResultPage contains a page of AutoApprovedPrivateLinkService values. +type AutoApprovedPrivateLinkServicesResultPage struct { + fn func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error) + aaplsr AutoApprovedPrivateLinkServicesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AutoApprovedPrivateLinkServicesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AutoApprovedPrivateLinkServicesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aaplsr) + if err != nil { + return err + } + page.aaplsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AutoApprovedPrivateLinkServicesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AutoApprovedPrivateLinkServicesResultPage) NotDone() bool { + return !page.aaplsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AutoApprovedPrivateLinkServicesResultPage) Response() AutoApprovedPrivateLinkServicesResult { + return page.aaplsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AutoApprovedPrivateLinkServicesResultPage) Values() []AutoApprovedPrivateLinkService { + if page.aaplsr.IsEmpty() { + return nil + } + return *page.aaplsr.Value +} + +// Creates a new instance of the AutoApprovedPrivateLinkServicesResultPage type. +func NewAutoApprovedPrivateLinkServicesResultPage(cur AutoApprovedPrivateLinkServicesResult, getNextPage func(context.Context, AutoApprovedPrivateLinkServicesResult) (AutoApprovedPrivateLinkServicesResult, error)) AutoApprovedPrivateLinkServicesResultPage { + return AutoApprovedPrivateLinkServicesResultPage{ + fn: getNextPage, + aaplsr: cur, + } +} + +// Availability availability of the metric. +type Availability struct { + // TimeGrain - The time grain of the availability. + TimeGrain *string `json:"timeGrain,omitempty"` + // Retention - The retention of the availability. + Retention *string `json:"retention,omitempty"` + // BlobDuration - Duration of the availability blob. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// AvailableDelegation the serviceName of an AvailableDelegation indicates a possible delegation for a +// subnet. +type AvailableDelegation struct { + // Name - The name of the AvailableDelegation resource. + Name *string `json:"name,omitempty"` + // ID - A unique identifier of the AvailableDelegation resource. + ID *string `json:"id,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ServiceName - The name of the service and resource. + ServiceName *string `json:"serviceName,omitempty"` + // Actions - The actions permitted to the service upon delegation. + Actions *[]string `json:"actions,omitempty"` +} + +// AvailableDelegationsResult an array of available delegations. +type AvailableDelegationsResult struct { + autorest.Response `json:"-"` + // Value - An array of available delegations. + Value *[]AvailableDelegation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableDelegationsResult. +func (adr AvailableDelegationsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if adr.Value != nil { + objectMap["value"] = adr.Value + } + return json.Marshal(objectMap) +} + +// AvailableDelegationsResultIterator provides access to a complete listing of AvailableDelegation values. +type AvailableDelegationsResultIterator struct { + i int + page AvailableDelegationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableDelegationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableDelegationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableDelegationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableDelegationsResultIterator) Response() AvailableDelegationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableDelegationsResultIterator) Value() AvailableDelegation { + if !iter.page.NotDone() { + return AvailableDelegation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableDelegationsResultIterator type. +func NewAvailableDelegationsResultIterator(page AvailableDelegationsResultPage) AvailableDelegationsResultIterator { + return AvailableDelegationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (adr AvailableDelegationsResult) IsEmpty() bool { + return adr.Value == nil || len(*adr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (adr AvailableDelegationsResult) hasNextLink() bool { + return adr.NextLink != nil && len(*adr.NextLink) != 0 +} + +// availableDelegationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (adr AvailableDelegationsResult) availableDelegationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !adr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(adr.NextLink))) +} + +// AvailableDelegationsResultPage contains a page of AvailableDelegation values. +type AvailableDelegationsResultPage struct { + fn func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error) + adr AvailableDelegationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableDelegationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableDelegationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.adr) + if err != nil { + return err + } + page.adr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableDelegationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableDelegationsResultPage) NotDone() bool { + return !page.adr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableDelegationsResultPage) Response() AvailableDelegationsResult { + return page.adr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableDelegationsResultPage) Values() []AvailableDelegation { + if page.adr.IsEmpty() { + return nil + } + return *page.adr.Value +} + +// Creates a new instance of the AvailableDelegationsResultPage type. +func NewAvailableDelegationsResultPage(cur AvailableDelegationsResult, getNextPage func(context.Context, AvailableDelegationsResult) (AvailableDelegationsResult, error)) AvailableDelegationsResultPage { + return AvailableDelegationsResultPage{ + fn: getNextPage, + adr: cur, + } +} + +// AvailablePrivateEndpointType the information of an AvailablePrivateEndpointType. +type AvailablePrivateEndpointType struct { + // Name - The name of the service and resource. + Name *string `json:"name,omitempty"` + // ID - A unique identifier of the AvailablePrivateEndpoint Type resource. + ID *string `json:"id,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ResourceName - The name of the service and resource. + ResourceName *string `json:"resourceName,omitempty"` + // DisplayName - Display name of the resource. + DisplayName *string `json:"displayName,omitempty"` +} + +// AvailablePrivateEndpointTypesResult an array of available PrivateEndpoint types. +type AvailablePrivateEndpointTypesResult struct { + autorest.Response `json:"-"` + // Value - An array of available privateEndpoint type. + Value *[]AvailablePrivateEndpointType `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailablePrivateEndpointTypesResult. +func (apetr AvailablePrivateEndpointTypesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apetr.Value != nil { + objectMap["value"] = apetr.Value + } + return json.Marshal(objectMap) +} + +// AvailablePrivateEndpointTypesResultIterator provides access to a complete listing of +// AvailablePrivateEndpointType values. +type AvailablePrivateEndpointTypesResultIterator struct { + i int + page AvailablePrivateEndpointTypesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailablePrivateEndpointTypesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailablePrivateEndpointTypesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailablePrivateEndpointTypesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailablePrivateEndpointTypesResultIterator) Response() AvailablePrivateEndpointTypesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailablePrivateEndpointTypesResultIterator) Value() AvailablePrivateEndpointType { + if !iter.page.NotDone() { + return AvailablePrivateEndpointType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailablePrivateEndpointTypesResultIterator type. +func NewAvailablePrivateEndpointTypesResultIterator(page AvailablePrivateEndpointTypesResultPage) AvailablePrivateEndpointTypesResultIterator { + return AvailablePrivateEndpointTypesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (apetr AvailablePrivateEndpointTypesResult) IsEmpty() bool { + return apetr.Value == nil || len(*apetr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (apetr AvailablePrivateEndpointTypesResult) hasNextLink() bool { + return apetr.NextLink != nil && len(*apetr.NextLink) != 0 +} + +// availablePrivateEndpointTypesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (apetr AvailablePrivateEndpointTypesResult) availablePrivateEndpointTypesResultPreparer(ctx context.Context) (*http.Request, error) { + if !apetr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(apetr.NextLink))) +} + +// AvailablePrivateEndpointTypesResultPage contains a page of AvailablePrivateEndpointType values. +type AvailablePrivateEndpointTypesResultPage struct { + fn func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error) + apetr AvailablePrivateEndpointTypesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailablePrivateEndpointTypesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailablePrivateEndpointTypesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.apetr) + if err != nil { + return err + } + page.apetr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailablePrivateEndpointTypesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailablePrivateEndpointTypesResultPage) NotDone() bool { + return !page.apetr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailablePrivateEndpointTypesResultPage) Response() AvailablePrivateEndpointTypesResult { + return page.apetr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailablePrivateEndpointTypesResultPage) Values() []AvailablePrivateEndpointType { + if page.apetr.IsEmpty() { + return nil + } + return *page.apetr.Value +} + +// Creates a new instance of the AvailablePrivateEndpointTypesResultPage type. +func NewAvailablePrivateEndpointTypesResultPage(cur AvailablePrivateEndpointTypesResult, getNextPage func(context.Context, AvailablePrivateEndpointTypesResult) (AvailablePrivateEndpointTypesResult, error)) AvailablePrivateEndpointTypesResultPage { + return AvailablePrivateEndpointTypesResultPage{ + fn: getNextPage, + apetr: cur, + } +} + +// AvailableProvidersList list of available countries with details. +type AvailableProvidersList struct { + autorest.Response `json:"-"` + // Countries - List of available countries. + Countries *[]AvailableProvidersListCountry `json:"countries,omitempty"` +} + +// AvailableProvidersListCity city or town details. +type AvailableProvidersListCity struct { + // CityName - The city or town name. + CityName *string `json:"cityName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` +} + +// AvailableProvidersListCountry country details. +type AvailableProvidersListCountry struct { + // CountryName - The country name. + CountryName *string `json:"countryName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // States - List of available states in the country. + States *[]AvailableProvidersListState `json:"states,omitempty"` +} + +// AvailableProvidersListParameters constraints that determine the list of available Internet service +// providers. +type AvailableProvidersListParameters struct { + // AzureLocations - A list of Azure regions. + AzureLocations *[]string `json:"azureLocations,omitempty"` + // Country - The country for available providers list. + Country *string `json:"country,omitempty"` + // State - The state for available providers list. + State *string `json:"state,omitempty"` + // City - The city or town for available providers list. + City *string `json:"city,omitempty"` +} + +// AvailableProvidersListState state details. +type AvailableProvidersListState struct { + // StateName - The state name. + StateName *string `json:"stateName,omitempty"` + // Providers - A list of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // Cities - List of available cities or towns in the state. + Cities *[]AvailableProvidersListCity `json:"cities,omitempty"` +} + +// AvailableServiceAlias the available service alias. +type AvailableServiceAlias struct { + // Name - The name of the service alias. + Name *string `json:"name,omitempty"` + // ID - The ID of the service alias. + ID *string `json:"id,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ResourceName - The resource name of the service alias. + ResourceName *string `json:"resourceName,omitempty"` +} + +// AvailableServiceAliasesResult an array of available service aliases. +type AvailableServiceAliasesResult struct { + autorest.Response `json:"-"` + // Value - An array of available service aliases. + Value *[]AvailableServiceAlias `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AvailableServiceAliasesResult. +func (asar AvailableServiceAliasesResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if asar.Value != nil { + objectMap["value"] = asar.Value + } + return json.Marshal(objectMap) +} + +// AvailableServiceAliasesResultIterator provides access to a complete listing of AvailableServiceAlias +// values. +type AvailableServiceAliasesResultIterator struct { + i int + page AvailableServiceAliasesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AvailableServiceAliasesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AvailableServiceAliasesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AvailableServiceAliasesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AvailableServiceAliasesResultIterator) Response() AvailableServiceAliasesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AvailableServiceAliasesResultIterator) Value() AvailableServiceAlias { + if !iter.page.NotDone() { + return AvailableServiceAlias{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AvailableServiceAliasesResultIterator type. +func NewAvailableServiceAliasesResultIterator(page AvailableServiceAliasesResultPage) AvailableServiceAliasesResultIterator { + return AvailableServiceAliasesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (asar AvailableServiceAliasesResult) IsEmpty() bool { + return asar.Value == nil || len(*asar.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (asar AvailableServiceAliasesResult) hasNextLink() bool { + return asar.NextLink != nil && len(*asar.NextLink) != 0 +} + +// availableServiceAliasesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (asar AvailableServiceAliasesResult) availableServiceAliasesResultPreparer(ctx context.Context) (*http.Request, error) { + if !asar.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(asar.NextLink))) +} + +// AvailableServiceAliasesResultPage contains a page of AvailableServiceAlias values. +type AvailableServiceAliasesResultPage struct { + fn func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error) + asar AvailableServiceAliasesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AvailableServiceAliasesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableServiceAliasesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.asar) + if err != nil { + return err + } + page.asar = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AvailableServiceAliasesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AvailableServiceAliasesResultPage) NotDone() bool { + return !page.asar.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AvailableServiceAliasesResultPage) Response() AvailableServiceAliasesResult { + return page.asar +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AvailableServiceAliasesResultPage) Values() []AvailableServiceAlias { + if page.asar.IsEmpty() { + return nil + } + return *page.asar.Value +} + +// Creates a new instance of the AvailableServiceAliasesResultPage type. +func NewAvailableServiceAliasesResultPage(cur AvailableServiceAliasesResult, getNextPage func(context.Context, AvailableServiceAliasesResult) (AvailableServiceAliasesResult, error)) AvailableServiceAliasesResultPage { + return AvailableServiceAliasesResultPage{ + fn: getNextPage, + asar: cur, + } +} + +// AzureAsyncOperationResult the response body contains the status of the specified asynchronous operation, +// indicating whether it has succeeded, is in progress, or has failed. Note that this status is distinct +// from the HTTP status code returned for the Get Operation Status operation itself. If the asynchronous +// operation succeeded, the response body includes the HTTP status code for the successful request. If the +// asynchronous operation failed, the response body includes the HTTP status code for the failed request +// and error information regarding the failure. +type AzureAsyncOperationResult struct { + // Status - Status of the Azure async operation. Possible values include: 'OperationStatusInProgress', 'OperationStatusSucceeded', 'OperationStatusFailed' + Status OperationStatus `json:"status,omitempty"` + // Error - Details of the error occurred during specified asynchronous operation. + Error *Error `json:"error,omitempty"` +} + +// AzureFirewall azure Firewall resource. +type AzureFirewall struct { + autorest.Response `json:"-"` + // AzureFirewallPropertiesFormat - Properties of the azure firewall. + *AzureFirewallPropertiesFormat `json:"properties,omitempty"` + // Zones - A list of availability zones denoting where the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureFirewall. +func (af AzureFirewall) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if af.AzureFirewallPropertiesFormat != nil { + objectMap["properties"] = af.AzureFirewallPropertiesFormat + } + if af.Zones != nil { + objectMap["zones"] = af.Zones + } + if af.ID != nil { + objectMap["id"] = af.ID + } + if af.Location != nil { + objectMap["location"] = af.Location + } + if af.Tags != nil { + objectMap["tags"] = af.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewall struct. +func (af *AzureFirewall) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallPropertiesFormat AzureFirewallPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallPropertiesFormat) + if err != nil { + return err + } + af.AzureFirewallPropertiesFormat = &azureFirewallPropertiesFormat + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + af.Zones = &zones + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + af.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + af.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + af.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + af.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + af.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + af.Tags = tags + } + } + } + + return nil +} + +// AzureFirewallApplicationRule properties of an application rule. +type AzureFirewallApplicationRule struct { + // Name - Name of the application rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // Protocols - Array of ApplicationRuleProtocols. + Protocols *[]AzureFirewallApplicationRuleProtocol `json:"protocols,omitempty"` + // TargetFqdns - List of FQDNs for this rule. + TargetFqdns *[]string `json:"targetFqdns,omitempty"` + // FqdnTags - List of FQDN Tags for this rule. + FqdnTags *[]string `json:"fqdnTags,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` +} + +// AzureFirewallApplicationRuleCollection application rule collection resource. +type AzureFirewallApplicationRuleCollection struct { + // AzureFirewallApplicationRuleCollectionPropertiesFormat - Properties of the azure firewall application rule collection. + *AzureFirewallApplicationRuleCollectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollection. +func (afarc AzureFirewallApplicationRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat != nil { + objectMap["properties"] = afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat + } + if afarc.Name != nil { + objectMap["name"] = afarc.Name + } + if afarc.ID != nil { + objectMap["id"] = afarc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallApplicationRuleCollection struct. +func (afarc *AzureFirewallApplicationRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallApplicationRuleCollectionPropertiesFormat AzureFirewallApplicationRuleCollectionPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallApplicationRuleCollectionPropertiesFormat) + if err != nil { + return err + } + afarc.AzureFirewallApplicationRuleCollectionPropertiesFormat = &azureFirewallApplicationRuleCollectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afarc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afarc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afarc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallApplicationRuleCollectionPropertiesFormat properties of the application rule collection. +type AzureFirewallApplicationRuleCollectionPropertiesFormat struct { + // Priority - Priority of the application rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a application rule collection. + Rules *[]AzureFirewallApplicationRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the application rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallApplicationRuleCollectionPropertiesFormat. +func (afarcpf AzureFirewallApplicationRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afarcpf.Priority != nil { + objectMap["priority"] = afarcpf.Priority + } + if afarcpf.Action != nil { + objectMap["action"] = afarcpf.Action + } + if afarcpf.Rules != nil { + objectMap["rules"] = afarcpf.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallApplicationRuleProtocol properties of the application rule protocol. +type AzureFirewallApplicationRuleProtocol struct { + // ProtocolType - Protocol type. Possible values include: 'AzureFirewallApplicationRuleProtocolTypeHTTP', 'AzureFirewallApplicationRuleProtocolTypeHTTPS', 'AzureFirewallApplicationRuleProtocolTypeMssql' + ProtocolType AzureFirewallApplicationRuleProtocolType `json:"protocolType,omitempty"` + // Port - Port number for the protocol, cannot be greater than 64000. This field is optional. + Port *int32 `json:"port,omitempty"` +} + +// AzureFirewallFqdnTag azure Firewall FQDN Tag Resource. +type AzureFirewallFqdnTag struct { + // AzureFirewallFqdnTagPropertiesFormat - Properties of the azure firewall FQDN tag. + *AzureFirewallFqdnTagPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallFqdnTag. +func (afft AzureFirewallFqdnTag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afft.AzureFirewallFqdnTagPropertiesFormat != nil { + objectMap["properties"] = afft.AzureFirewallFqdnTagPropertiesFormat + } + if afft.ID != nil { + objectMap["id"] = afft.ID + } + if afft.Location != nil { + objectMap["location"] = afft.Location + } + if afft.Tags != nil { + objectMap["tags"] = afft.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallFqdnTag struct. +func (afft *AzureFirewallFqdnTag) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallFqdnTagPropertiesFormat AzureFirewallFqdnTagPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallFqdnTagPropertiesFormat) + if err != nil { + return err + } + afft.AzureFirewallFqdnTagPropertiesFormat = &azureFirewallFqdnTagPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afft.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afft.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afft.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + afft.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + afft.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + afft.Tags = tags + } + } + } + + return nil +} + +// AzureFirewallFqdnTagListResult response for ListAzureFirewallFqdnTags API service call. +type AzureFirewallFqdnTagListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Firewall FQDN Tags in a resource group. + Value *[]AzureFirewallFqdnTag `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureFirewallFqdnTagListResultIterator provides access to a complete listing of AzureFirewallFqdnTag +// values. +type AzureFirewallFqdnTagListResultIterator struct { + i int + page AzureFirewallFqdnTagListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureFirewallFqdnTagListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureFirewallFqdnTagListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureFirewallFqdnTagListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureFirewallFqdnTagListResultIterator) Response() AzureFirewallFqdnTagListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureFirewallFqdnTagListResultIterator) Value() AzureFirewallFqdnTag { + if !iter.page.NotDone() { + return AzureFirewallFqdnTag{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureFirewallFqdnTagListResultIterator type. +func NewAzureFirewallFqdnTagListResultIterator(page AzureFirewallFqdnTagListResultPage) AzureFirewallFqdnTagListResultIterator { + return AzureFirewallFqdnTagListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (afftlr AzureFirewallFqdnTagListResult) IsEmpty() bool { + return afftlr.Value == nil || len(*afftlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (afftlr AzureFirewallFqdnTagListResult) hasNextLink() bool { + return afftlr.NextLink != nil && len(*afftlr.NextLink) != 0 +} + +// azureFirewallFqdnTagListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (afftlr AzureFirewallFqdnTagListResult) azureFirewallFqdnTagListResultPreparer(ctx context.Context) (*http.Request, error) { + if !afftlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(afftlr.NextLink))) +} + +// AzureFirewallFqdnTagListResultPage contains a page of AzureFirewallFqdnTag values. +type AzureFirewallFqdnTagListResultPage struct { + fn func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error) + afftlr AzureFirewallFqdnTagListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureFirewallFqdnTagListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallFqdnTagListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.afftlr) + if err != nil { + return err + } + page.afftlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureFirewallFqdnTagListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureFirewallFqdnTagListResultPage) NotDone() bool { + return !page.afftlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureFirewallFqdnTagListResultPage) Response() AzureFirewallFqdnTagListResult { + return page.afftlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureFirewallFqdnTagListResultPage) Values() []AzureFirewallFqdnTag { + if page.afftlr.IsEmpty() { + return nil + } + return *page.afftlr.Value +} + +// Creates a new instance of the AzureFirewallFqdnTagListResultPage type. +func NewAzureFirewallFqdnTagListResultPage(cur AzureFirewallFqdnTagListResult, getNextPage func(context.Context, AzureFirewallFqdnTagListResult) (AzureFirewallFqdnTagListResult, error)) AzureFirewallFqdnTagListResultPage { + return AzureFirewallFqdnTagListResultPage{ + fn: getNextPage, + afftlr: cur, + } +} + +// AzureFirewallFqdnTagPropertiesFormat azure Firewall FQDN Tag Properties. +type AzureFirewallFqdnTagPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall FQDN tag resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // FqdnTagName - READ-ONLY; The name of this FQDN Tag. + FqdnTagName *string `json:"fqdnTagName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallFqdnTagPropertiesFormat. +func (afftpf AzureFirewallFqdnTagPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirewallIPConfiguration IP configuration of an Azure Firewall. +type AzureFirewallIPConfiguration struct { + // AzureFirewallIPConfigurationPropertiesFormat - Properties of the azure firewall IP configuration. + *AzureFirewallIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPConfiguration. +func (afic AzureFirewallIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afic.AzureFirewallIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = afic.AzureFirewallIPConfigurationPropertiesFormat + } + if afic.Name != nil { + objectMap["name"] = afic.Name + } + if afic.ID != nil { + objectMap["id"] = afic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallIPConfiguration struct. +func (afic *AzureFirewallIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallIPConfigurationPropertiesFormat AzureFirewallIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallIPConfigurationPropertiesFormat) + if err != nil { + return err + } + afic.AzureFirewallIPConfigurationPropertiesFormat = &azureFirewallIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + afic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afic.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallIPConfigurationPropertiesFormat properties of IP configuration of an Azure Firewall. +type AzureFirewallIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - READ-ONLY; The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // Subnet - Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPConfigurationPropertiesFormat. +func (aficpf AzureFirewallIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aficpf.Subnet != nil { + objectMap["subnet"] = aficpf.Subnet + } + if aficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = aficpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// AzureFirewallIPGroups ipGroups associated with azure firewall. +type AzureFirewallIPGroups struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // ChangeNumber - READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallIPGroups. +func (afig AzureFirewallIPGroups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureFirewallListResult response for ListAzureFirewalls API service call. +type AzureFirewallListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Firewalls in a resource group. + Value *[]AzureFirewall `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureFirewallListResultIterator provides access to a complete listing of AzureFirewall values. +type AzureFirewallListResultIterator struct { + i int + page AzureFirewallListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureFirewallListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureFirewallListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureFirewallListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureFirewallListResultIterator) Response() AzureFirewallListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureFirewallListResultIterator) Value() AzureFirewall { + if !iter.page.NotDone() { + return AzureFirewall{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureFirewallListResultIterator type. +func NewAzureFirewallListResultIterator(page AzureFirewallListResultPage) AzureFirewallListResultIterator { + return AzureFirewallListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aflr AzureFirewallListResult) IsEmpty() bool { + return aflr.Value == nil || len(*aflr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aflr AzureFirewallListResult) hasNextLink() bool { + return aflr.NextLink != nil && len(*aflr.NextLink) != 0 +} + +// azureFirewallListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aflr AzureFirewallListResult) azureFirewallListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aflr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aflr.NextLink))) +} + +// AzureFirewallListResultPage contains a page of AzureFirewall values. +type AzureFirewallListResultPage struct { + fn func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error) + aflr AzureFirewallListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureFirewallListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureFirewallListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aflr) + if err != nil { + return err + } + page.aflr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureFirewallListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureFirewallListResultPage) NotDone() bool { + return !page.aflr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureFirewallListResultPage) Response() AzureFirewallListResult { + return page.aflr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureFirewallListResultPage) Values() []AzureFirewall { + if page.aflr.IsEmpty() { + return nil + } + return *page.aflr.Value +} + +// Creates a new instance of the AzureFirewallListResultPage type. +func NewAzureFirewallListResultPage(cur AzureFirewallListResult, getNextPage func(context.Context, AzureFirewallListResult) (AzureFirewallListResult, error)) AzureFirewallListResultPage { + return AzureFirewallListResultPage{ + fn: getNextPage, + aflr: cur, + } +} + +// AzureFirewallNatRCAction azureFirewall NAT Rule Collection Action. +type AzureFirewallNatRCAction struct { + // Type - The type of action. Possible values include: 'AzureFirewallNatRCActionTypeSnat', 'AzureFirewallNatRCActionTypeDnat' + Type AzureFirewallNatRCActionType `json:"type,omitempty"` +} + +// AzureFirewallNatRule properties of a NAT rule. +type AzureFirewallNatRule struct { + // Name - Name of the NAT rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses for this rule. Supports IP ranges, prefixes, and service tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // Protocols - Array of AzureFirewallNetworkRuleProtocols applicable to this NAT rule. + Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + // TranslatedAddress - The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + // TranslatedPort - The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` + // TranslatedFqdn - The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` +} + +// AzureFirewallNatRuleCollection NAT rule collection resource. +type AzureFirewallNatRuleCollection struct { + // AzureFirewallNatRuleCollectionProperties - Properties of the azure firewall NAT rule collection. + *AzureFirewallNatRuleCollectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollection. +func (afnrc AzureFirewallNatRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrc.AzureFirewallNatRuleCollectionProperties != nil { + objectMap["properties"] = afnrc.AzureFirewallNatRuleCollectionProperties + } + if afnrc.Name != nil { + objectMap["name"] = afnrc.Name + } + if afnrc.ID != nil { + objectMap["id"] = afnrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallNatRuleCollection struct. +func (afnrc *AzureFirewallNatRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallNatRuleCollectionProperties AzureFirewallNatRuleCollectionProperties + err = json.Unmarshal(*v, &azureFirewallNatRuleCollectionProperties) + if err != nil { + return err + } + afnrc.AzureFirewallNatRuleCollectionProperties = &azureFirewallNatRuleCollectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afnrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afnrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afnrc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallNatRuleCollectionProperties properties of the NAT rule collection. +type AzureFirewallNatRuleCollectionProperties struct { + // Priority - Priority of the NAT rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a NAT rule collection. + Action *AzureFirewallNatRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a NAT rule collection. + Rules *[]AzureFirewallNatRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the NAT rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNatRuleCollectionProperties. +func (afnrcp AzureFirewallNatRuleCollectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrcp.Priority != nil { + objectMap["priority"] = afnrcp.Priority + } + if afnrcp.Action != nil { + objectMap["action"] = afnrcp.Action + } + if afnrcp.Rules != nil { + objectMap["rules"] = afnrcp.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallNetworkRule properties of the network rule. +type AzureFirewallNetworkRule struct { + // Name - Name of the network rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // Protocols - Array of AzureFirewallNetworkRuleProtocols. + Protocols *[]AzureFirewallNetworkRuleProtocol `json:"protocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // DestinationFqdns - List of destination FQDNs. + DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` +} + +// AzureFirewallNetworkRuleCollection network rule collection resource. +type AzureFirewallNetworkRuleCollection struct { + // AzureFirewallNetworkRuleCollectionPropertiesFormat - Properties of the azure firewall network rule collection. + *AzureFirewallNetworkRuleCollectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollection. +func (afnrc AzureFirewallNetworkRuleCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat != nil { + objectMap["properties"] = afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat + } + if afnrc.Name != nil { + objectMap["name"] = afnrc.Name + } + if afnrc.ID != nil { + objectMap["id"] = afnrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureFirewallNetworkRuleCollection struct. +func (afnrc *AzureFirewallNetworkRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureFirewallNetworkRuleCollectionPropertiesFormat AzureFirewallNetworkRuleCollectionPropertiesFormat + err = json.Unmarshal(*v, &azureFirewallNetworkRuleCollectionPropertiesFormat) + if err != nil { + return err + } + afnrc.AzureFirewallNetworkRuleCollectionPropertiesFormat = &azureFirewallNetworkRuleCollectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + afnrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + afnrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + afnrc.ID = &ID + } + } + } + + return nil +} + +// AzureFirewallNetworkRuleCollectionPropertiesFormat properties of the network rule collection. +type AzureFirewallNetworkRuleCollectionPropertiesFormat struct { + // Priority - Priority of the network rule collection resource. + Priority *int32 `json:"priority,omitempty"` + // Action - The action type of a rule collection. + Action *AzureFirewallRCAction `json:"action,omitempty"` + // Rules - Collection of rules used by a network rule collection. + Rules *[]AzureFirewallNetworkRule `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network rule collection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallNetworkRuleCollectionPropertiesFormat. +func (afnrcpf AzureFirewallNetworkRuleCollectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afnrcpf.Priority != nil { + objectMap["priority"] = afnrcpf.Priority + } + if afnrcpf.Action != nil { + objectMap["action"] = afnrcpf.Action + } + if afnrcpf.Rules != nil { + objectMap["rules"] = afnrcpf.Rules + } + return json.Marshal(objectMap) +} + +// AzureFirewallPropertiesFormat properties of the Azure Firewall. +type AzureFirewallPropertiesFormat struct { + // ApplicationRuleCollections - Collection of application rule collections used by Azure Firewall. + ApplicationRuleCollections *[]AzureFirewallApplicationRuleCollection `json:"applicationRuleCollections,omitempty"` + // NatRuleCollections - Collection of NAT rule collections used by Azure Firewall. + NatRuleCollections *[]AzureFirewallNatRuleCollection `json:"natRuleCollections,omitempty"` + // NetworkRuleCollections - Collection of network rule collections used by Azure Firewall. + NetworkRuleCollections *[]AzureFirewallNetworkRuleCollection `json:"networkRuleCollections,omitempty"` + // IPConfigurations - IP configuration of the Azure Firewall resource. + IPConfigurations *[]AzureFirewallIPConfiguration `json:"ipConfigurations,omitempty"` + // ManagementIPConfiguration - IP configuration of the Azure Firewall used for management traffic. + ManagementIPConfiguration *AzureFirewallIPConfiguration `json:"managementIpConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the Azure firewall resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' + ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + // VirtualHub - The virtualHub to which the firewall belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // FirewallPolicy - The firewallPolicy associated with this azure firewall. + FirewallPolicy *SubResource `json:"firewallPolicy,omitempty"` + // HubIPAddresses - IP addresses associated with AzureFirewall. + HubIPAddresses *HubIPAddresses `json:"hubIPAddresses,omitempty"` + // IPGroups - READ-ONLY; IpGroups associated with AzureFirewall. + IPGroups *[]AzureFirewallIPGroups `json:"ipGroups,omitempty"` + // Sku - The Azure Firewall Resource SKU. + Sku *AzureFirewallSku `json:"sku,omitempty"` + // AdditionalProperties - The additional properties used to further config this azure firewall. + AdditionalProperties map[string]*string `json:"additionalProperties"` +} + +// MarshalJSON is the custom marshaler for AzureFirewallPropertiesFormat. +func (afpf AzureFirewallPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if afpf.ApplicationRuleCollections != nil { + objectMap["applicationRuleCollections"] = afpf.ApplicationRuleCollections + } + if afpf.NatRuleCollections != nil { + objectMap["natRuleCollections"] = afpf.NatRuleCollections + } + if afpf.NetworkRuleCollections != nil { + objectMap["networkRuleCollections"] = afpf.NetworkRuleCollections + } + if afpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = afpf.IPConfigurations + } + if afpf.ManagementIPConfiguration != nil { + objectMap["managementIpConfiguration"] = afpf.ManagementIPConfiguration + } + if afpf.ThreatIntelMode != "" { + objectMap["threatIntelMode"] = afpf.ThreatIntelMode + } + if afpf.VirtualHub != nil { + objectMap["virtualHub"] = afpf.VirtualHub + } + if afpf.FirewallPolicy != nil { + objectMap["firewallPolicy"] = afpf.FirewallPolicy + } + if afpf.HubIPAddresses != nil { + objectMap["hubIPAddresses"] = afpf.HubIPAddresses + } + if afpf.Sku != nil { + objectMap["sku"] = afpf.Sku + } + if afpf.AdditionalProperties != nil { + objectMap["additionalProperties"] = afpf.AdditionalProperties + } + return json.Marshal(objectMap) +} + +// AzureFirewallPublicIPAddress public IP Address associated with azure firewall. +type AzureFirewallPublicIPAddress struct { + // Address - Public IP Address value. + Address *string `json:"address,omitempty"` +} + +// AzureFirewallRCAction properties of the AzureFirewallRCAction. +type AzureFirewallRCAction struct { + // Type - The type of action. Possible values include: 'AzureFirewallRCActionTypeAllow', 'AzureFirewallRCActionTypeDeny' + Type AzureFirewallRCActionType `json:"type,omitempty"` +} + +// AzureFirewallsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AzureFirewallsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (AzureFirewall, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsCreateOrUpdateFuture.Result. +func (future *AzureFirewallsCreateOrUpdateFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + af.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { + af, err = client.CreateOrUpdateResponder(af.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsCreateOrUpdateFuture", "Result", af.Response.Response, "Failure responding to request") + } + } + return +} + +// AzureFirewallsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AzureFirewallsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsDeleteFuture.Result. +func (future *AzureFirewallsDeleteFuture) result(client AzureFirewallsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AzureFirewallSku SKU of an Azure Firewall. +type AzureFirewallSku struct { + // Name - Name of an Azure Firewall SKU. Possible values include: 'AzureFirewallSkuNameAZFWVNet', 'AzureFirewallSkuNameAZFWHub' + Name AzureFirewallSkuName `json:"name,omitempty"` + // Tier - Tier of an Azure Firewall. Possible values include: 'AzureFirewallSkuTierStandard', 'AzureFirewallSkuTierPremium', 'AzureFirewallSkuTierBasic' + Tier AzureFirewallSkuTier `json:"tier,omitempty"` +} + +// AzureFirewallsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AzureFirewallsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AzureFirewallsClient) (AzureFirewall, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AzureFirewallsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AzureFirewallsUpdateTagsFuture.Result. +func (future *AzureFirewallsUpdateTagsFuture) result(client AzureFirewallsClient) (af AzureFirewall, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + af.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.AzureFirewallsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if af.Response.Response, err = future.GetResult(sender); err == nil && af.Response.Response.StatusCode != http.StatusNoContent { + af, err = client.UpdateTagsResponder(af.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.AzureFirewallsUpdateTagsFuture", "Result", af.Response.Response, "Failure responding to request") + } + } + return +} + +// AzureReachabilityReport azure reachability report details. +type AzureReachabilityReport struct { + autorest.Response `json:"-"` + // AggregationLevel - The aggregation level of Azure reachability report. Can be Country, State or City. + AggregationLevel *string `json:"aggregationLevel,omitempty"` + // ProviderLocation - Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + // ReachabilityReport - List of Azure reachability report items. + ReachabilityReport *[]AzureReachabilityReportItem `json:"reachabilityReport,omitempty"` +} + +// AzureReachabilityReportItem azure reachability report details for a given provider location. +type AzureReachabilityReportItem struct { + // Provider - The Internet service provider. + Provider *string `json:"provider,omitempty"` + // AzureLocation - The Azure region. + AzureLocation *string `json:"azureLocation,omitempty"` + // Latencies - List of latency details for each of the time series. + Latencies *[]AzureReachabilityReportLatencyInfo `json:"latencies,omitempty"` +} + +// AzureReachabilityReportLatencyInfo details on latency for a time series. +type AzureReachabilityReportLatencyInfo struct { + // TimeStamp - The time stamp. + TimeStamp *date.Time `json:"timeStamp,omitempty"` + // Score - The relative latency score between 1 and 100, higher values indicating a faster connection. + Score *int32 `json:"score,omitempty"` +} + +// AzureReachabilityReportLocation parameters that define a geographic location. +type AzureReachabilityReportLocation struct { + // Country - The name of the country. + Country *string `json:"country,omitempty"` + // State - The name of the state. + State *string `json:"state,omitempty"` + // City - The name of the city or town. + City *string `json:"city,omitempty"` +} + +// AzureReachabilityReportParameters geographic and time constraints for Azure reachability report. +type AzureReachabilityReportParameters struct { + // ProviderLocation - Parameters that define a geographic location. + ProviderLocation *AzureReachabilityReportLocation `json:"providerLocation,omitempty"` + // Providers - List of Internet service providers. + Providers *[]string `json:"providers,omitempty"` + // AzureLocations - Optional Azure regions to scope the query to. + AzureLocations *[]string `json:"azureLocations,omitempty"` + // StartTime - The start time for the Azure reachability report. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time for the Azure reachability report. + EndTime *date.Time `json:"endTime,omitempty"` +} + +// AzureWebCategory azure Web Category Resource. +type AzureWebCategory struct { + autorest.Response `json:"-"` + // AzureWebCategoryPropertiesFormat - Properties of the Azure Web Category. + *AzureWebCategoryPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureWebCategory. +func (awc AzureWebCategory) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if awc.AzureWebCategoryPropertiesFormat != nil { + objectMap["properties"] = awc.AzureWebCategoryPropertiesFormat + } + if awc.ID != nil { + objectMap["id"] = awc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AzureWebCategory struct. +func (awc *AzureWebCategory) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var azureWebCategoryPropertiesFormat AzureWebCategoryPropertiesFormat + err = json.Unmarshal(*v, &azureWebCategoryPropertiesFormat) + if err != nil { + return err + } + awc.AzureWebCategoryPropertiesFormat = &azureWebCategoryPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + awc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + awc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + awc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + awc.Etag = &etag + } + } + } + + return nil +} + +// AzureWebCategoryListResult response for ListAzureWebCategories API service call. +type AzureWebCategoryListResult struct { + autorest.Response `json:"-"` + // Value - List of Azure Web Categories for a given Subscription. + Value *[]AzureWebCategory `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AzureWebCategoryListResultIterator provides access to a complete listing of AzureWebCategory values. +type AzureWebCategoryListResultIterator struct { + i int + page AzureWebCategoryListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AzureWebCategoryListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AzureWebCategoryListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AzureWebCategoryListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AzureWebCategoryListResultIterator) Response() AzureWebCategoryListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AzureWebCategoryListResultIterator) Value() AzureWebCategory { + if !iter.page.NotDone() { + return AzureWebCategory{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AzureWebCategoryListResultIterator type. +func NewAzureWebCategoryListResultIterator(page AzureWebCategoryListResultPage) AzureWebCategoryListResultIterator { + return AzureWebCategoryListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (awclr AzureWebCategoryListResult) IsEmpty() bool { + return awclr.Value == nil || len(*awclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (awclr AzureWebCategoryListResult) hasNextLink() bool { + return awclr.NextLink != nil && len(*awclr.NextLink) != 0 +} + +// azureWebCategoryListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (awclr AzureWebCategoryListResult) azureWebCategoryListResultPreparer(ctx context.Context) (*http.Request, error) { + if !awclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(awclr.NextLink))) +} + +// AzureWebCategoryListResultPage contains a page of AzureWebCategory values. +type AzureWebCategoryListResultPage struct { + fn func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error) + awclr AzureWebCategoryListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AzureWebCategoryListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AzureWebCategoryListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.awclr) + if err != nil { + return err + } + page.awclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AzureWebCategoryListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AzureWebCategoryListResultPage) NotDone() bool { + return !page.awclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AzureWebCategoryListResultPage) Response() AzureWebCategoryListResult { + return page.awclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AzureWebCategoryListResultPage) Values() []AzureWebCategory { + if page.awclr.IsEmpty() { + return nil + } + return *page.awclr.Value +} + +// Creates a new instance of the AzureWebCategoryListResultPage type. +func NewAzureWebCategoryListResultPage(cur AzureWebCategoryListResult, getNextPage func(context.Context, AzureWebCategoryListResult) (AzureWebCategoryListResult, error)) AzureWebCategoryListResultPage { + return AzureWebCategoryListResultPage{ + fn: getNextPage, + awclr: cur, + } +} + +// AzureWebCategoryPropertiesFormat azure Web Category Properties. +type AzureWebCategoryPropertiesFormat struct { + // Group - READ-ONLY; The name of the group that the category belongs to. + Group *string `json:"group,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureWebCategoryPropertiesFormat. +func (awcpf AzureWebCategoryPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BackendAddressInboundNatRulePortMappings the response for a QueryInboundNatRulePortMapping API. +type BackendAddressInboundNatRulePortMappings struct { + autorest.Response `json:"-"` + // InboundNatRulePortMappings - Collection of inbound NAT rule port mappings. + InboundNatRulePortMappings *[]InboundNatRulePortMapping `json:"inboundNatRulePortMappings,omitempty"` +} + +// BackendAddressPool pool of backend IP addresses. +type BackendAddressPool struct { + autorest.Response `json:"-"` + // BackendAddressPoolPropertiesFormat - Properties of load balancer backend address pool. + *BackendAddressPoolPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendAddressPool. +func (bap BackendAddressPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bap.BackendAddressPoolPropertiesFormat != nil { + objectMap["properties"] = bap.BackendAddressPoolPropertiesFormat + } + if bap.Name != nil { + objectMap["name"] = bap.Name + } + if bap.ID != nil { + objectMap["id"] = bap.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BackendAddressPool struct. +func (bap *BackendAddressPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var backendAddressPoolPropertiesFormat BackendAddressPoolPropertiesFormat + err = json.Unmarshal(*v, &backendAddressPoolPropertiesFormat) + if err != nil { + return err + } + bap.BackendAddressPoolPropertiesFormat = &backendAddressPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bap.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bap.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bap.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bap.ID = &ID + } + } + } + + return nil +} + +// BackendAddressPoolPropertiesFormat properties of the backend address pool. +type BackendAddressPoolPropertiesFormat struct { + // Location - The location of the backend address pool. + Location *string `json:"location,omitempty"` + // TunnelInterfaces - An array of gateway load balancer tunnel interfaces. + TunnelInterfaces *[]GatewayLoadBalancerTunnelInterface `json:"tunnelInterfaces,omitempty"` + // LoadBalancerBackendAddresses - An array of backend addresses. + LoadBalancerBackendAddresses *[]LoadBalancerBackendAddress `json:"loadBalancerBackendAddresses,omitempty"` + // BackendIPConfigurations - READ-ONLY; An array of references to IP addresses defined in network interfaces. + BackendIPConfigurations *[]InterfaceIPConfiguration `json:"backendIPConfigurations,omitempty"` + // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this backend address pool. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // OutboundRule - READ-ONLY; A reference to an outbound rule that uses this backend address pool. + OutboundRule *SubResource `json:"outboundRule,omitempty"` + // OutboundRules - READ-ONLY; An array of references to outbound rules that use this backend address pool. + OutboundRules *[]SubResource `json:"outboundRules,omitempty"` + // InboundNatRules - READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. + InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the backend address pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DrainPeriodInSeconds - Amount of seconds Load Balancer waits for before sending RESET to client and backend address. + DrainPeriodInSeconds *int32 `json:"drainPeriodInSeconds,omitempty"` +} + +// MarshalJSON is the custom marshaler for BackendAddressPoolPropertiesFormat. +func (bappf BackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bappf.Location != nil { + objectMap["location"] = bappf.Location + } + if bappf.TunnelInterfaces != nil { + objectMap["tunnelInterfaces"] = bappf.TunnelInterfaces + } + if bappf.LoadBalancerBackendAddresses != nil { + objectMap["loadBalancerBackendAddresses"] = bappf.LoadBalancerBackendAddresses + } + if bappf.DrainPeriodInSeconds != nil { + objectMap["drainPeriodInSeconds"] = bappf.DrainPeriodInSeconds + } + return json.Marshal(objectMap) +} + +// BastionActiveSession the session detail for a target. +type BastionActiveSession struct { + // SessionID - READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty"` + // StartTime - READ-ONLY; The time when the session started. + StartTime interface{} `json:"startTime,omitempty"` + // TargetSubscriptionID - READ-ONLY; The subscription id for the target virtual machine. + TargetSubscriptionID *string `json:"targetSubscriptionId,omitempty"` + // ResourceType - READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` + // TargetHostName - READ-ONLY; The host name of the target. + TargetHostName *string `json:"targetHostName,omitempty"` + // TargetResourceGroup - READ-ONLY; The resource group of the target. + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + // UserName - READ-ONLY; The user name who is active on this session. + UserName *string `json:"userName,omitempty"` + // TargetIPAddress - READ-ONLY; The IP Address of the target. + TargetIPAddress *string `json:"targetIpAddress,omitempty"` + // Protocol - READ-ONLY; The protocol used to connect to the target. Possible values include: 'BastionConnectProtocolSSH', 'BastionConnectProtocolRDP' + Protocol BastionConnectProtocol `json:"protocol,omitempty"` + // TargetResourceID - READ-ONLY; The resource id of the target. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // SessionDurationInMins - READ-ONLY; Duration in mins the session has been active. + SessionDurationInMins *float64 `json:"sessionDurationInMins,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionActiveSession. +func (bas BastionActiveSession) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BastionActiveSessionListResult response for GetActiveSessions. +type BastionActiveSessionListResult struct { + autorest.Response `json:"-"` + // Value - List of active sessions on the bastion. + Value *[]BastionActiveSession `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionActiveSessionListResultIterator provides access to a complete listing of BastionActiveSession +// values. +type BastionActiveSessionListResultIterator struct { + i int + page BastionActiveSessionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionActiveSessionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionActiveSessionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionActiveSessionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionActiveSessionListResultIterator) Response() BastionActiveSessionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionActiveSessionListResultIterator) Value() BastionActiveSession { + if !iter.page.NotDone() { + return BastionActiveSession{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionActiveSessionListResultIterator type. +func NewBastionActiveSessionListResultIterator(page BastionActiveSessionListResultPage) BastionActiveSessionListResultIterator { + return BastionActiveSessionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (baslr BastionActiveSessionListResult) IsEmpty() bool { + return baslr.Value == nil || len(*baslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (baslr BastionActiveSessionListResult) hasNextLink() bool { + return baslr.NextLink != nil && len(*baslr.NextLink) != 0 +} + +// bastionActiveSessionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (baslr BastionActiveSessionListResult) bastionActiveSessionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !baslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(baslr.NextLink))) +} + +// BastionActiveSessionListResultPage contains a page of BastionActiveSession values. +type BastionActiveSessionListResultPage struct { + fn func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error) + baslr BastionActiveSessionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionActiveSessionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionActiveSessionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.baslr) + if err != nil { + return err + } + page.baslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionActiveSessionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionActiveSessionListResultPage) NotDone() bool { + return !page.baslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionActiveSessionListResultPage) Response() BastionActiveSessionListResult { + return page.baslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionActiveSessionListResultPage) Values() []BastionActiveSession { + if page.baslr.IsEmpty() { + return nil + } + return *page.baslr.Value +} + +// Creates a new instance of the BastionActiveSessionListResultPage type. +func NewBastionActiveSessionListResultPage(cur BastionActiveSessionListResult, getNextPage func(context.Context, BastionActiveSessionListResult) (BastionActiveSessionListResult, error)) BastionActiveSessionListResultPage { + return BastionActiveSessionListResultPage{ + fn: getNextPage, + baslr: cur, + } +} + +// BastionHost bastion Host resource. +type BastionHost struct { + autorest.Response `json:"-"` + // BastionHostPropertiesFormat - Represents the bastion host resource. + *BastionHostPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Sku - The sku of this Bastion Host. + Sku *Sku `json:"sku,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for BastionHost. +func (bh BastionHost) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bh.BastionHostPropertiesFormat != nil { + objectMap["properties"] = bh.BastionHostPropertiesFormat + } + if bh.Sku != nil { + objectMap["sku"] = bh.Sku + } + if bh.ID != nil { + objectMap["id"] = bh.ID + } + if bh.Location != nil { + objectMap["location"] = bh.Location + } + if bh.Tags != nil { + objectMap["tags"] = bh.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BastionHost struct. +func (bh *BastionHost) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bastionHostPropertiesFormat BastionHostPropertiesFormat + err = json.Unmarshal(*v, &bastionHostPropertiesFormat) + if err != nil { + return err + } + bh.BastionHostPropertiesFormat = &bastionHostPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bh.Etag = &etag + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + bh.Sku = &sku + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bh.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bh.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bh.Tags = tags + } + } + } + + return nil +} + +// BastionHostIPConfiguration IP configuration of an Bastion Host. +type BastionHostIPConfiguration struct { + // BastionHostIPConfigurationPropertiesFormat - Represents the ip configuration associated with the resource. + *BastionHostIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Ip configuration type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostIPConfiguration. +func (bhic BastionHostIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhic.BastionHostIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = bhic.BastionHostIPConfigurationPropertiesFormat + } + if bhic.Name != nil { + objectMap["name"] = bhic.Name + } + if bhic.ID != nil { + objectMap["id"] = bhic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BastionHostIPConfiguration struct. +func (bhic *BastionHostIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bastionHostIPConfigurationPropertiesFormat BastionHostIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &bastionHostIPConfigurationPropertiesFormat) + if err != nil { + return err + } + bhic.BastionHostIPConfigurationPropertiesFormat = &bastionHostIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bhic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bhic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bhic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bhic.ID = &ID + } + } + } + + return nil +} + +// BastionHostIPConfigurationPropertiesFormat properties of IP configuration of an Bastion Host. +type BastionHostIPConfigurationPropertiesFormat struct { + // Subnet - Reference of the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - Reference of the PublicIP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the bastion host IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateIPAllocationMethod - Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostIPConfigurationPropertiesFormat. +func (bhicpf BastionHostIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhicpf.Subnet != nil { + objectMap["subnet"] = bhicpf.Subnet + } + if bhicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = bhicpf.PublicIPAddress + } + if bhicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = bhicpf.PrivateIPAllocationMethod + } + return json.Marshal(objectMap) +} + +// BastionHostListResult response for ListBastionHosts API service call. +type BastionHostListResult struct { + autorest.Response `json:"-"` + // Value - List of Bastion Hosts in a resource group. + Value *[]BastionHost `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionHostListResultIterator provides access to a complete listing of BastionHost values. +type BastionHostListResultIterator struct { + i int + page BastionHostListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionHostListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionHostListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionHostListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionHostListResultIterator) Response() BastionHostListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionHostListResultIterator) Value() BastionHost { + if !iter.page.NotDone() { + return BastionHost{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionHostListResultIterator type. +func NewBastionHostListResultIterator(page BastionHostListResultPage) BastionHostListResultIterator { + return BastionHostListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bhlr BastionHostListResult) IsEmpty() bool { + return bhlr.Value == nil || len(*bhlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bhlr BastionHostListResult) hasNextLink() bool { + return bhlr.NextLink != nil && len(*bhlr.NextLink) != 0 +} + +// bastionHostListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bhlr BastionHostListResult) bastionHostListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bhlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bhlr.NextLink))) +} + +// BastionHostListResultPage contains a page of BastionHost values. +type BastionHostListResultPage struct { + fn func(context.Context, BastionHostListResult) (BastionHostListResult, error) + bhlr BastionHostListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionHostListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionHostListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bhlr) + if err != nil { + return err + } + page.bhlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionHostListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionHostListResultPage) NotDone() bool { + return !page.bhlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionHostListResultPage) Response() BastionHostListResult { + return page.bhlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionHostListResultPage) Values() []BastionHost { + if page.bhlr.IsEmpty() { + return nil + } + return *page.bhlr.Value +} + +// Creates a new instance of the BastionHostListResultPage type. +func NewBastionHostListResultPage(cur BastionHostListResult, getNextPage func(context.Context, BastionHostListResult) (BastionHostListResult, error)) BastionHostListResultPage { + return BastionHostListResultPage{ + fn: getNextPage, + bhlr: cur, + } +} + +// BastionHostPropertiesFormat properties of the Bastion Host. +type BastionHostPropertiesFormat struct { + // IPConfigurations - IP configuration of the Bastion Host resource. + IPConfigurations *[]BastionHostIPConfiguration `json:"ipConfigurations,omitempty"` + // DNSName - FQDN for the endpoint on which bastion host is accessible. + DNSName *string `json:"dnsName,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the bastion host resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ScaleUnits - The scale units for the Bastion Host resource. + ScaleUnits *int32 `json:"scaleUnits,omitempty"` + // DisableCopyPaste - Enable/Disable Copy/Paste feature of the Bastion Host resource. + DisableCopyPaste *bool `json:"disableCopyPaste,omitempty"` + // EnableFileCopy - Enable/Disable File Copy feature of the Bastion Host resource. + EnableFileCopy *bool `json:"enableFileCopy,omitempty"` + // EnableIPConnect - Enable/Disable IP Connect feature of the Bastion Host resource. + EnableIPConnect *bool `json:"enableIpConnect,omitempty"` + // EnableShareableLink - Enable/Disable Shareable Link of the Bastion Host resource. + EnableShareableLink *bool `json:"enableShareableLink,omitempty"` + // EnableTunneling - Enable/Disable Tunneling feature of the Bastion Host resource. + EnableTunneling *bool `json:"enableTunneling,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionHostPropertiesFormat. +func (bhpf BastionHostPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bhpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = bhpf.IPConfigurations + } + if bhpf.DNSName != nil { + objectMap["dnsName"] = bhpf.DNSName + } + if bhpf.ScaleUnits != nil { + objectMap["scaleUnits"] = bhpf.ScaleUnits + } + if bhpf.DisableCopyPaste != nil { + objectMap["disableCopyPaste"] = bhpf.DisableCopyPaste + } + if bhpf.EnableFileCopy != nil { + objectMap["enableFileCopy"] = bhpf.EnableFileCopy + } + if bhpf.EnableIPConnect != nil { + objectMap["enableIpConnect"] = bhpf.EnableIPConnect + } + if bhpf.EnableShareableLink != nil { + objectMap["enableShareableLink"] = bhpf.EnableShareableLink + } + if bhpf.EnableTunneling != nil { + objectMap["enableTunneling"] = bhpf.EnableTunneling + } + return json.Marshal(objectMap) +} + +// BastionHostsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BastionHostsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (BastionHost, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsCreateOrUpdateFuture.Result. +func (future *BastionHostsCreateOrUpdateFuture) result(client BastionHostsClient) (bh BastionHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { + bh, err = client.CreateOrUpdateResponder(bh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsCreateOrUpdateFuture", "Result", bh.Response.Response, "Failure responding to request") + } + } + return +} + +// BastionHostsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BastionHostsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsDeleteFuture.Result. +func (future *BastionHostsDeleteFuture) result(client BastionHostsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// BastionHostsUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type BastionHostsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BastionHostsClient) (BastionHost, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *BastionHostsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for BastionHostsUpdateTagsFuture.Result. +func (future *BastionHostsUpdateTagsFuture) result(client BastionHostsClient) (bh BastionHost, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.BastionHostsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bh.Response.Response, err = future.GetResult(sender); err == nil && bh.Response.Response.StatusCode != http.StatusNoContent { + bh, err = client.UpdateTagsResponder(bh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BastionHostsUpdateTagsFuture", "Result", bh.Response.Response, "Failure responding to request") + } + } + return +} + +// BastionSessionDeleteResult response for DisconnectActiveSessions. +type BastionSessionDeleteResult struct { + autorest.Response `json:"-"` + // Value - List of sessions with their corresponding state. + Value *[]BastionSessionState `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionSessionDeleteResultIterator provides access to a complete listing of BastionSessionState values. +type BastionSessionDeleteResultIterator struct { + i int + page BastionSessionDeleteResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionSessionDeleteResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionSessionDeleteResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionSessionDeleteResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionSessionDeleteResultIterator) Response() BastionSessionDeleteResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionSessionDeleteResultIterator) Value() BastionSessionState { + if !iter.page.NotDone() { + return BastionSessionState{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionSessionDeleteResultIterator type. +func NewBastionSessionDeleteResultIterator(page BastionSessionDeleteResultPage) BastionSessionDeleteResultIterator { + return BastionSessionDeleteResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsdr BastionSessionDeleteResult) IsEmpty() bool { + return bsdr.Value == nil || len(*bsdr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsdr BastionSessionDeleteResult) hasNextLink() bool { + return bsdr.NextLink != nil && len(*bsdr.NextLink) != 0 +} + +// bastionSessionDeleteResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsdr BastionSessionDeleteResult) bastionSessionDeleteResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsdr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsdr.NextLink))) +} + +// BastionSessionDeleteResultPage contains a page of BastionSessionState values. +type BastionSessionDeleteResultPage struct { + fn func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error) + bsdr BastionSessionDeleteResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionSessionDeleteResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionSessionDeleteResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsdr) + if err != nil { + return err + } + page.bsdr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionSessionDeleteResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionSessionDeleteResultPage) NotDone() bool { + return !page.bsdr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionSessionDeleteResultPage) Response() BastionSessionDeleteResult { + return page.bsdr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionSessionDeleteResultPage) Values() []BastionSessionState { + if page.bsdr.IsEmpty() { + return nil + } + return *page.bsdr.Value +} + +// Creates a new instance of the BastionSessionDeleteResultPage type. +func NewBastionSessionDeleteResultPage(cur BastionSessionDeleteResult, getNextPage func(context.Context, BastionSessionDeleteResult) (BastionSessionDeleteResult, error)) BastionSessionDeleteResultPage { + return BastionSessionDeleteResultPage{ + fn: getNextPage, + bsdr: cur, + } +} + +// BastionSessionState the session state detail for a target. +type BastionSessionState struct { + // SessionID - READ-ONLY; A unique id for the session. + SessionID *string `json:"sessionId,omitempty"` + // Message - READ-ONLY; Used for extra information. + Message *string `json:"message,omitempty"` + // State - READ-ONLY; The state of the session. Disconnected/Failed/NotFound. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionSessionState. +func (bss BastionSessionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BastionShareableLink bastion Shareable Link. +type BastionShareableLink struct { + // VM - Reference of the virtual machine resource. + VM *VM `json:"vm,omitempty"` + // Bsl - READ-ONLY; The unique Bastion Shareable Link to the virtual machine. + Bsl *string `json:"bsl,omitempty"` + // CreatedAt - READ-ONLY; The time when the link was created. + CreatedAt *string `json:"createdAt,omitempty"` + // Message - READ-ONLY; Optional field indicating the warning or error message related to the vm in case of partial failure. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for BastionShareableLink. +func (bsl BastionShareableLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsl.VM != nil { + objectMap["vm"] = bsl.VM + } + return json.Marshal(objectMap) +} + +// BastionShareableLinkListRequest post request for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListRequest struct { + // Vms - List of VM references. + Vms *[]BastionShareableLink `json:"vms,omitempty"` +} + +// BastionShareableLinkListResult response for all the Bastion Shareable Link endpoints. +type BastionShareableLinkListResult struct { + autorest.Response `json:"-"` + // Value - List of Bastion Shareable Links for the request. + Value *[]BastionShareableLink `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BastionShareableLinkListResultIterator provides access to a complete listing of BastionShareableLink +// values. +type BastionShareableLinkListResultIterator struct { + i int + page BastionShareableLinkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BastionShareableLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BastionShareableLinkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BastionShareableLinkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BastionShareableLinkListResultIterator) Response() BastionShareableLinkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BastionShareableLinkListResultIterator) Value() BastionShareableLink { + if !iter.page.NotDone() { + return BastionShareableLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BastionShareableLinkListResultIterator type. +func NewBastionShareableLinkListResultIterator(page BastionShareableLinkListResultPage) BastionShareableLinkListResultIterator { + return BastionShareableLinkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsllr BastionShareableLinkListResult) IsEmpty() bool { + return bsllr.Value == nil || len(*bsllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsllr BastionShareableLinkListResult) hasNextLink() bool { + return bsllr.NextLink != nil && len(*bsllr.NextLink) != 0 +} + +// bastionShareableLinkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsllr BastionShareableLinkListResult) bastionShareableLinkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsllr.NextLink))) +} + +// BastionShareableLinkListResultPage contains a page of BastionShareableLink values. +type BastionShareableLinkListResultPage struct { + fn func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error) + bsllr BastionShareableLinkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BastionShareableLinkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BastionShareableLinkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsllr) + if err != nil { + return err + } + page.bsllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BastionShareableLinkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BastionShareableLinkListResultPage) NotDone() bool { + return !page.bsllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BastionShareableLinkListResultPage) Response() BastionShareableLinkListResult { + return page.bsllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BastionShareableLinkListResultPage) Values() []BastionShareableLink { + if page.bsllr.IsEmpty() { + return nil + } + return *page.bsllr.Value +} + +// Creates a new instance of the BastionShareableLinkListResultPage type. +func NewBastionShareableLinkListResultPage(cur BastionShareableLinkListResult, getNextPage func(context.Context, BastionShareableLinkListResult) (BastionShareableLinkListResult, error)) BastionShareableLinkListResultPage { + return BastionShareableLinkListResultPage{ + fn: getNextPage, + bsllr: cur, + } +} + +// BGPCommunity contains bgp community information offered in Service Community resources. +type BGPCommunity struct { + // ServiceSupportedRegion - The region which the service support. e.g. For O365, region is Global. + ServiceSupportedRegion *string `json:"serviceSupportedRegion,omitempty"` + // CommunityName - The name of the bgp community. e.g. Skype. + CommunityName *string `json:"communityName,omitempty"` + // CommunityValue - The value of the bgp community. For more information: https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + CommunityValue *string `json:"communityValue,omitempty"` + // CommunityPrefixes - The prefixes that the bgp community contains. + CommunityPrefixes *[]string `json:"communityPrefixes,omitempty"` + // IsAuthorizedToUse - Customer is authorized to use bgp community or not. + IsAuthorizedToUse *bool `json:"isAuthorizedToUse,omitempty"` + // ServiceGroup - The service group of the bgp community contains. + ServiceGroup *string `json:"serviceGroup,omitempty"` +} + +// BgpConnection virtual Appliance Site resource. +type BgpConnection struct { + autorest.Response `json:"-"` + // BgpConnectionProperties - The properties of the Bgp connections. + *BgpConnectionProperties `json:"properties,omitempty"` + // Name - Name of the connection. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Connection type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpConnection. +func (bc BgpConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bc.BgpConnectionProperties != nil { + objectMap["properties"] = bc.BgpConnectionProperties + } + if bc.Name != nil { + objectMap["name"] = bc.Name + } + if bc.ID != nil { + objectMap["id"] = bc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BgpConnection struct. +func (bc *BgpConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bgpConnectionProperties BgpConnectionProperties + err = json.Unmarshal(*v, &bgpConnectionProperties) + if err != nil { + return err + } + bc.BgpConnectionProperties = &bgpConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + bc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bc.ID = &ID + } + } + } + + return nil +} + +// BgpConnectionProperties properties of the bgp connection. +type BgpConnectionProperties struct { + // PeerAsn - Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + // PeerIP - Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + // HubVirtualNetworkConnection - The reference to the HubVirtualNetworkConnection resource. + HubVirtualNetworkConnection *SubResource `json:"hubVirtualNetworkConnection,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ConnectionState - READ-ONLY; The current state of the VirtualHub to Peer. Possible values include: 'HubBgpConnectionStatusUnknown', 'HubBgpConnectionStatusConnecting', 'HubBgpConnectionStatusConnected', 'HubBgpConnectionStatusNotConnected' + ConnectionState HubBgpConnectionStatus `json:"connectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpConnectionProperties. +func (bcp BgpConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bcp.PeerAsn != nil { + objectMap["peerAsn"] = bcp.PeerAsn + } + if bcp.PeerIP != nil { + objectMap["peerIp"] = bcp.PeerIP + } + if bcp.HubVirtualNetworkConnection != nil { + objectMap["hubVirtualNetworkConnection"] = bcp.HubVirtualNetworkConnection + } + return json.Marshal(objectMap) +} + +// BgpPeerStatus BGP peer status details. +type BgpPeerStatus struct { + // LocalAddress - READ-ONLY; The virtual network gateway's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // Neighbor - READ-ONLY; The remote BGP peer. + Neighbor *string `json:"neighbor,omitempty"` + // Asn - READ-ONLY; The autonomous system number of the remote BGP peer. + Asn *int64 `json:"asn,omitempty"` + // State - READ-ONLY; The BGP peer state. Possible values include: 'BgpPeerStateUnknown', 'BgpPeerStateStopped', 'BgpPeerStateIdle', 'BgpPeerStateConnecting', 'BgpPeerStateConnected' + State BgpPeerState `json:"state,omitempty"` + // ConnectedDuration - READ-ONLY; For how long the peering has been up. + ConnectedDuration *string `json:"connectedDuration,omitempty"` + // RoutesReceived - READ-ONLY; The number of routes learned from this peer. + RoutesReceived *int64 `json:"routesReceived,omitempty"` + // MessagesSent - READ-ONLY; The number of BGP messages sent. + MessagesSent *int64 `json:"messagesSent,omitempty"` + // MessagesReceived - READ-ONLY; The number of BGP messages received. + MessagesReceived *int64 `json:"messagesReceived,omitempty"` +} + +// MarshalJSON is the custom marshaler for BgpPeerStatus. +func (bps BgpPeerStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BgpPeerStatusListResult response for list BGP peer status API service call. +type BgpPeerStatusListResult struct { + autorest.Response `json:"-"` + // Value - List of BGP peers. + Value *[]BgpPeerStatus `json:"value,omitempty"` +} + +// BgpServiceCommunity service Community Properties. +type BgpServiceCommunity struct { + // BgpServiceCommunityPropertiesFormat - Properties of the BGP service community. + *BgpServiceCommunityPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for BgpServiceCommunity. +func (bsc BgpServiceCommunity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bsc.BgpServiceCommunityPropertiesFormat != nil { + objectMap["properties"] = bsc.BgpServiceCommunityPropertiesFormat + } + if bsc.ID != nil { + objectMap["id"] = bsc.ID + } + if bsc.Location != nil { + objectMap["location"] = bsc.Location + } + if bsc.Tags != nil { + objectMap["tags"] = bsc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BgpServiceCommunity struct. +func (bsc *BgpServiceCommunity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var bgpServiceCommunityPropertiesFormat BgpServiceCommunityPropertiesFormat + err = json.Unmarshal(*v, &bgpServiceCommunityPropertiesFormat) + if err != nil { + return err + } + bsc.BgpServiceCommunityPropertiesFormat = &bgpServiceCommunityPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bsc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bsc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + bsc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + bsc.Tags = tags + } + } + } + + return nil +} + +// BgpServiceCommunityListResult response for the ListServiceCommunity API service call. +type BgpServiceCommunityListResult struct { + autorest.Response `json:"-"` + // Value - A list of service community resources. + Value *[]BgpServiceCommunity `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BgpServiceCommunityListResultIterator provides access to a complete listing of BgpServiceCommunity +// values. +type BgpServiceCommunityListResultIterator struct { + i int + page BgpServiceCommunityListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BgpServiceCommunityListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BgpServiceCommunityListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BgpServiceCommunityListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BgpServiceCommunityListResultIterator) Response() BgpServiceCommunityListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BgpServiceCommunityListResultIterator) Value() BgpServiceCommunity { + if !iter.page.NotDone() { + return BgpServiceCommunity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BgpServiceCommunityListResultIterator type. +func NewBgpServiceCommunityListResultIterator(page BgpServiceCommunityListResultPage) BgpServiceCommunityListResultIterator { + return BgpServiceCommunityListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsclr BgpServiceCommunityListResult) IsEmpty() bool { + return bsclr.Value == nil || len(*bsclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsclr BgpServiceCommunityListResult) hasNextLink() bool { + return bsclr.NextLink != nil && len(*bsclr.NextLink) != 0 +} + +// bgpServiceCommunityListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsclr BgpServiceCommunityListResult) bgpServiceCommunityListResultPreparer(ctx context.Context) (*http.Request, error) { + if !bsclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsclr.NextLink))) +} + +// BgpServiceCommunityListResultPage contains a page of BgpServiceCommunity values. +type BgpServiceCommunityListResultPage struct { + fn func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error) + bsclr BgpServiceCommunityListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BgpServiceCommunityListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BgpServiceCommunityListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsclr) + if err != nil { + return err + } + page.bsclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BgpServiceCommunityListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BgpServiceCommunityListResultPage) NotDone() bool { + return !page.bsclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BgpServiceCommunityListResultPage) Response() BgpServiceCommunityListResult { + return page.bsclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BgpServiceCommunityListResultPage) Values() []BgpServiceCommunity { + if page.bsclr.IsEmpty() { + return nil + } + return *page.bsclr.Value +} + +// Creates a new instance of the BgpServiceCommunityListResultPage type. +func NewBgpServiceCommunityListResultPage(cur BgpServiceCommunityListResult, getNextPage func(context.Context, BgpServiceCommunityListResult) (BgpServiceCommunityListResult, error)) BgpServiceCommunityListResultPage { + return BgpServiceCommunityListResultPage{ + fn: getNextPage, + bsclr: cur, + } +} + +// BgpServiceCommunityPropertiesFormat properties of Service Community. +type BgpServiceCommunityPropertiesFormat struct { + // ServiceName - The name of the bgp community. e.g. Skype. + ServiceName *string `json:"serviceName,omitempty"` + // BgpCommunities - A list of bgp communities. + BgpCommunities *[]BGPCommunity `json:"bgpCommunities,omitempty"` +} + +// BgpSettings BGP settings details. +type BgpSettings struct { + // Asn - The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` + // PeerWeight - The weight added to routes learned from this BGP speaker. + PeerWeight *int32 `json:"peerWeight,omitempty"` + // BgpPeeringAddresses - BGP peering address with IP configuration ID for virtual network gateway. + BgpPeeringAddresses *[]IPConfigurationBgpPeeringAddress `json:"bgpPeeringAddresses,omitempty"` +} + +// BreakOutCategoryPolicies network Virtual Appliance Sku Properties. +type BreakOutCategoryPolicies struct { + // Allow - Flag to control breakout of o365 allow category. + Allow *bool `json:"allow,omitempty"` + // Optimize - Flag to control breakout of o365 optimize category. + Optimize *bool `json:"optimize,omitempty"` + // Default - Flag to control breakout of o365 default category. + Default *bool `json:"default,omitempty"` +} + +// CheckPrivateLinkServiceVisibilityRequest request body of the CheckPrivateLinkServiceVisibility API +// service call. +type CheckPrivateLinkServiceVisibilityRequest struct { + // PrivateLinkServiceAlias - The alias of the private link service. + PrivateLinkServiceAlias *string `json:"privateLinkServiceAlias,omitempty"` +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - Cloud error body. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,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"` + // VerbosityLevel - Verbosity level. Possible values include: 'VerbosityLevelNormal', 'VerbosityLevelMinimum', 'VerbosityLevelFull' + VerbosityLevel VerbosityLevel `json:"verbosityLevel,omitempty"` + // Profiles - List of network configuration diagnostic profiles. + Profiles *[]ConfigurationDiagnosticProfile `json:"profiles,omitempty"` +} + +// ConfigurationDiagnosticProfile parameters to compare with network configuration. +type ConfigurationDiagnosticProfile struct { + // Direction - The direction of the traffic. Possible values include: 'DirectionInbound', 'DirectionOutbound' + 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 - Traffic destination port. Accepted values are '*' and a single port in the range (0 - 65535). + DestinationPort *string `json:"destinationPort,omitempty"` +} + +// ConfigurationDiagnosticResponse results of network configuration diagnostic on the target resource. +type ConfigurationDiagnosticResponse struct { + autorest.Response `json:"-"` + // Results - READ-ONLY; List of network configuration diagnostic results. + Results *[]ConfigurationDiagnosticResult `json:"results,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConfigurationDiagnosticResponse. +func (cdr ConfigurationDiagnosticResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConfigurationDiagnosticResult network configuration diagnostic result corresponded to provided traffic +// query. +type ConfigurationDiagnosticResult struct { + // Profile - Network configuration diagnostic profile. + Profile *ConfigurationDiagnosticProfile `json:"profile,omitempty"` + // NetworkSecurityGroupResult - Network security group result. + NetworkSecurityGroupResult *SecurityGroupResult `json:"networkSecurityGroupResult,omitempty"` +} + +// ConfigurationPolicyGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ConfigurationPolicyGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationPolicyGroupsClient) (VpnServerConfigurationPolicyGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationPolicyGroupsCreateOrUpdateFuture.Result. +func (future *ConfigurationPolicyGroupsCreateOrUpdateFuture) result(client ConfigurationPolicyGroupsClient) (vscpg VpnServerConfigurationPolicyGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vscpg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vscpg.Response.Response, err = future.GetResult(sender); err == nil && vscpg.Response.Response.StatusCode != http.StatusNoContent { + vscpg, err = client.CreateOrUpdateResponder(vscpg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsCreateOrUpdateFuture", "Result", vscpg.Response.Response, "Failure responding to request") + } + } + return +} + +// ConfigurationPolicyGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConfigurationPolicyGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConfigurationPolicyGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConfigurationPolicyGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConfigurationPolicyGroupsDeleteFuture.Result. +func (future *ConfigurationPolicyGroupsDeleteFuture) result(client ConfigurationPolicyGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConfigurationPolicyGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConfigurationPolicyGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitor parameters that define the operation to create a connection monitor. +type ConnectionMonitor struct { + // Location - Connection monitor location. + Location *string `json:"location,omitempty"` + // Tags - Connection monitor tags. + Tags map[string]*string `json:"tags"` + // ConnectionMonitorParameters - Properties of the connection monitor. + *ConnectionMonitorParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitor. +func (cm ConnectionMonitor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cm.Location != nil { + objectMap["location"] = cm.Location + } + if cm.Tags != nil { + objectMap["tags"] = cm.Tags + } + if cm.ConnectionMonitorParameters != nil { + objectMap["properties"] = cm.ConnectionMonitorParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectionMonitor struct. +func (cm *ConnectionMonitor) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cm.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cm.Tags = tags + } + case "properties": + if v != nil { + var connectionMonitorParameters ConnectionMonitorParameters + err = json.Unmarshal(*v, &connectionMonitorParameters) + if err != nil { + return err + } + cm.ConnectionMonitorParameters = &connectionMonitorParameters + } + } + } + + return nil +} + +// ConnectionMonitorDestination describes the destination of connection monitor. +type ConnectionMonitorDestination struct { + // ResourceID - The ID of the resource used as the destination by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` + // Address - Address of the connection monitor destination (IP or domain name). + Address *string `json:"address,omitempty"` + // Port - The destination port used by connection monitor. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorEndpoint describes the connection monitor endpoint. +type ConnectionMonitorEndpoint struct { + // Name - The name of the connection monitor endpoint. + Name *string `json:"name,omitempty"` + // Type - The endpoint type. Possible values include: 'EndpointTypeAzureVM', 'EndpointTypeAzureVNet', 'EndpointTypeAzureSubnet', 'EndpointTypeExternalAddress', 'EndpointTypeMMAWorkspaceMachine', 'EndpointTypeMMAWorkspaceNetwork' + Type EndpointType `json:"type,omitempty"` + // ResourceID - Resource ID of the connection monitor endpoint. + ResourceID *string `json:"resourceId,omitempty"` + // Address - Address of the connection monitor endpoint (IP or domain name). + Address *string `json:"address,omitempty"` + // Filter - Filter for sub-items within the endpoint. + Filter *ConnectionMonitorEndpointFilter `json:"filter,omitempty"` + // Scope - Endpoint scope. + Scope *ConnectionMonitorEndpointScope `json:"scope,omitempty"` + // CoverageLevel - Test coverage for the endpoint. Possible values include: 'CoverageLevelDefault', 'CoverageLevelLow', 'CoverageLevelBelowAverage', 'CoverageLevelAverage', 'CoverageLevelAboveAverage', 'CoverageLevelFull' + CoverageLevel CoverageLevel `json:"coverageLevel,omitempty"` +} + +// ConnectionMonitorEndpointFilter describes the connection monitor endpoint filter. +type ConnectionMonitorEndpointFilter struct { + // Type - The behavior of the endpoint filter. Currently only 'Include' is supported. Possible values include: 'ConnectionMonitorEndpointFilterTypeInclude' + Type ConnectionMonitorEndpointFilterType `json:"type,omitempty"` + // Items - List of items in the filter. + Items *[]ConnectionMonitorEndpointFilterItem `json:"items,omitempty"` +} + +// ConnectionMonitorEndpointFilterItem describes the connection monitor endpoint filter item. +type ConnectionMonitorEndpointFilterItem struct { + // Type - The type of item included in the filter. Currently only 'AgentAddress' is supported. Possible values include: 'ConnectionMonitorEndpointFilterItemTypeAgentAddress' + Type ConnectionMonitorEndpointFilterItemType `json:"type,omitempty"` + // Address - The address of the filter item. + Address *string `json:"address,omitempty"` +} + +// ConnectionMonitorEndpointScope describes the connection monitor endpoint scope. +type ConnectionMonitorEndpointScope struct { + // Include - List of items which needs to be included to the endpoint scope. + Include *[]ConnectionMonitorEndpointScopeItem `json:"include,omitempty"` + // Exclude - List of items which needs to be excluded from the endpoint scope. + Exclude *[]ConnectionMonitorEndpointScopeItem `json:"exclude,omitempty"` +} + +// ConnectionMonitorEndpointScopeItem describes the connection monitor endpoint scope item. +type ConnectionMonitorEndpointScopeItem struct { + // Address - The address of the endpoint item. Supported types are IPv4/IPv6 subnet mask or IPv4/IPv6 IP address. + Address *string `json:"address,omitempty"` +} + +// ConnectionMonitorHTTPConfiguration describes the HTTP configuration. +type ConnectionMonitorHTTPConfiguration struct { + // Port - The port to connect to. + Port *int32 `json:"port,omitempty"` + // Method - The HTTP method to use. Possible values include: 'HTTPConfigurationMethodGet', 'HTTPConfigurationMethodPost' + Method HTTPConfigurationMethod `json:"method,omitempty"` + // Path - The path component of the URI. For instance, "/dir1/dir2". + Path *string `json:"path,omitempty"` + // RequestHeaders - The HTTP headers to transmit with the request. + RequestHeaders *[]HTTPHeader `json:"requestHeaders,omitempty"` + // ValidStatusCodeRanges - HTTP status codes to consider successful. For instance, "2xx,301-304,418". + ValidStatusCodeRanges *[]string `json:"validStatusCodeRanges,omitempty"` + // PreferHTTPS - Value indicating whether HTTPS is preferred over HTTP in cases where the choice is not explicit. + PreferHTTPS *bool `json:"preferHTTPS,omitempty"` +} + +// ConnectionMonitorIcmpConfiguration describes the ICMP configuration. +type ConnectionMonitorIcmpConfiguration struct { + // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` +} + +// ConnectionMonitorListResult list of connection monitors. +type ConnectionMonitorListResult struct { + autorest.Response `json:"-"` + // Value - Information about connection monitors. + Value *[]ConnectionMonitorResult `json:"value,omitempty"` +} + +// ConnectionMonitorOutput describes a connection monitor output destination. +type ConnectionMonitorOutput struct { + // Type - Connection monitor output destination type. Currently, only "Workspace" is supported. Possible values include: 'OutputTypeWorkspace' + Type OutputType `json:"type,omitempty"` + // WorkspaceSettings - Describes the settings for producing output into a log analytics workspace. + WorkspaceSettings *ConnectionMonitorWorkspaceSettings `json:"workspaceSettings,omitempty"` +} + +// ConnectionMonitorParameters parameters that define the operation to create a connection monitor. +type ConnectionMonitorParameters struct { + // Source - Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + // Destination - Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + // AutoStart - Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + // MonitoringIntervalInSeconds - Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + // Endpoints - List of connection monitor endpoints. + Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + // TestConfigurations - List of connection monitor test configurations. + TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + // TestGroups - List of connection monitor test groups. + TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` + // Outputs - List of connection monitor outputs. + Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` + // Notes - Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` +} + +// ConnectionMonitorQueryResult list of connection states snapshots. +type ConnectionMonitorQueryResult struct { + autorest.Response `json:"-"` + // SourceStatus - Status of connection monitor source. Possible values include: 'ConnectionMonitorSourceStatusUnknown', 'ConnectionMonitorSourceStatusActive', 'ConnectionMonitorSourceStatusInactive' + SourceStatus ConnectionMonitorSourceStatus `json:"sourceStatus,omitempty"` + // States - Information about connection states. + States *[]ConnectionStateSnapshot `json:"states,omitempty"` +} + +// ConnectionMonitorResult information about the connection monitor. +type ConnectionMonitorResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the connection monitor. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; ID of the connection monitor. + ID *string `json:"id,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Connection monitor type. + Type *string `json:"type,omitempty"` + // Location - Connection monitor location. + Location *string `json:"location,omitempty"` + // Tags - Connection monitor tags. + Tags map[string]*string `json:"tags"` + // ConnectionMonitorResultProperties - Properties of the connection monitor result. + *ConnectionMonitorResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitorResult. +func (cmr ConnectionMonitorResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmr.Location != nil { + objectMap["location"] = cmr.Location + } + if cmr.Tags != nil { + objectMap["tags"] = cmr.Tags + } + if cmr.ConnectionMonitorResultProperties != nil { + objectMap["properties"] = cmr.ConnectionMonitorResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ConnectionMonitorResult struct. +func (cmr *ConnectionMonitorResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cmr.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cmr.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cmr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cmr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cmr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cmr.Tags = tags + } + case "properties": + if v != nil { + var connectionMonitorResultProperties ConnectionMonitorResultProperties + err = json.Unmarshal(*v, &connectionMonitorResultProperties) + if err != nil { + return err + } + cmr.ConnectionMonitorResultProperties = &connectionMonitorResultProperties + } + } + } + + return nil +} + +// ConnectionMonitorResultProperties describes the properties of a connection monitor. +type ConnectionMonitorResultProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the connection monitor. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // StartTime - READ-ONLY; The date and time when the connection monitor was started. + StartTime *date.Time `json:"startTime,omitempty"` + // MonitoringStatus - READ-ONLY; The monitoring status of the connection monitor. + MonitoringStatus *string `json:"monitoringStatus,omitempty"` + // ConnectionMonitorType - READ-ONLY; Type of connection monitor. Possible values include: 'ConnectionMonitorTypeMultiEndpoint', 'ConnectionMonitorTypeSingleSourceDestination' + ConnectionMonitorType ConnectionMonitorType `json:"connectionMonitorType,omitempty"` + // Source - Describes the source of connection monitor. + Source *ConnectionMonitorSource `json:"source,omitempty"` + // Destination - Describes the destination of connection monitor. + Destination *ConnectionMonitorDestination `json:"destination,omitempty"` + // AutoStart - Determines if the connection monitor will start automatically once created. + AutoStart *bool `json:"autoStart,omitempty"` + // MonitoringIntervalInSeconds - Monitoring interval in seconds. + MonitoringIntervalInSeconds *int32 `json:"monitoringIntervalInSeconds,omitempty"` + // Endpoints - List of connection monitor endpoints. + Endpoints *[]ConnectionMonitorEndpoint `json:"endpoints,omitempty"` + // TestConfigurations - List of connection monitor test configurations. + TestConfigurations *[]ConnectionMonitorTestConfiguration `json:"testConfigurations,omitempty"` + // TestGroups - List of connection monitor test groups. + TestGroups *[]ConnectionMonitorTestGroup `json:"testGroups,omitempty"` + // Outputs - List of connection monitor outputs. + Outputs *[]ConnectionMonitorOutput `json:"outputs,omitempty"` + // Notes - Optional notes to be associated with the connection monitor. + Notes *string `json:"notes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionMonitorResultProperties. +func (cmrp ConnectionMonitorResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cmrp.Source != nil { + objectMap["source"] = cmrp.Source + } + if cmrp.Destination != nil { + objectMap["destination"] = cmrp.Destination + } + if cmrp.AutoStart != nil { + objectMap["autoStart"] = cmrp.AutoStart + } + if cmrp.MonitoringIntervalInSeconds != nil { + objectMap["monitoringIntervalInSeconds"] = cmrp.MonitoringIntervalInSeconds + } + if cmrp.Endpoints != nil { + objectMap["endpoints"] = cmrp.Endpoints + } + if cmrp.TestConfigurations != nil { + objectMap["testConfigurations"] = cmrp.TestConfigurations + } + if cmrp.TestGroups != nil { + objectMap["testGroups"] = cmrp.TestGroups + } + if cmrp.Outputs != nil { + objectMap["outputs"] = cmrp.Outputs + } + if cmrp.Notes != nil { + objectMap["notes"] = cmrp.Notes + } + return json.Marshal(objectMap) +} + +// ConnectionMonitorsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectionMonitorsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (ConnectionMonitorResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsCreateOrUpdateFuture.Result. +func (future *ConnectionMonitorsCreateOrUpdateFuture) result(client ConnectionMonitorsClient) (cmr ConnectionMonitorResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cmr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmr.Response.Response, err = future.GetResult(sender); err == nil && cmr.Response.Response.StatusCode != http.StatusNoContent { + cmr, err = client.CreateOrUpdateResponder(cmr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsCreateOrUpdateFuture", "Result", cmr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectionMonitorsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ConnectionMonitorsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsDeleteFuture.Result. +func (future *ConnectionMonitorsDeleteFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitorSource describes the source of connection monitor. +type ConnectionMonitorSource struct { + // ResourceID - The ID of the resource used as the source by connection monitor. + ResourceID *string `json:"resourceId,omitempty"` + // Port - The source port used by connection monitor. + Port *int32 `json:"port,omitempty"` +} + +// ConnectionMonitorsQueryFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsQueryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (ConnectionMonitorQueryResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsQueryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsQueryFuture.Result. +func (future *ConnectionMonitorsQueryFuture) result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cmqr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsQueryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cmqr.Response.Response, err = future.GetResult(sender); err == nil && cmqr.Response.Response.StatusCode != http.StatusNoContent { + cmqr, err = client.QueryResponder(cmqr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsQueryFuture", "Result", cmqr.Response.Response, "Failure responding to request") + } + } + return +} + +// ConnectionMonitorsStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsStartFuture.Result. +func (future *ConnectionMonitorsStartFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitorsStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ConnectionMonitorsStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ConnectionMonitorsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ConnectionMonitorsStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ConnectionMonitorsStopFuture.Result. +func (future *ConnectionMonitorsStopFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ConnectionMonitorsStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ConnectionMonitorsStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ConnectionMonitorSuccessThreshold describes the threshold for declaring a test successful. +type ConnectionMonitorSuccessThreshold struct { + // ChecksFailedPercent - The maximum percentage of failed checks permitted for a test to evaluate as successful. + ChecksFailedPercent *int32 `json:"checksFailedPercent,omitempty"` + // RoundTripTimeMs - The maximum round-trip time in milliseconds permitted for a test to evaluate as successful. + RoundTripTimeMs *float64 `json:"roundTripTimeMs,omitempty"` +} + +// ConnectionMonitorTCPConfiguration describes the TCP configuration. +type ConnectionMonitorTCPConfiguration struct { + // Port - The port to connect to. + Port *int32 `json:"port,omitempty"` + // DisableTraceRoute - Value indicating whether path evaluation with trace route should be disabled. + DisableTraceRoute *bool `json:"disableTraceRoute,omitempty"` + // DestinationPortBehavior - Destination port behavior. Possible values include: 'DestinationPortBehaviorNone', 'DestinationPortBehaviorListenIfAvailable' + DestinationPortBehavior DestinationPortBehavior `json:"destinationPortBehavior,omitempty"` +} + +// ConnectionMonitorTestConfiguration describes a connection monitor test configuration. +type ConnectionMonitorTestConfiguration struct { + // Name - The name of the connection monitor test configuration. + Name *string `json:"name,omitempty"` + // TestFrequencySec - The frequency of test evaluation, in seconds. + TestFrequencySec *int32 `json:"testFrequencySec,omitempty"` + // Protocol - The protocol to use in test evaluation. Possible values include: 'ConnectionMonitorTestConfigurationProtocolTCP', 'ConnectionMonitorTestConfigurationProtocolHTTP', 'ConnectionMonitorTestConfigurationProtocolIcmp' + Protocol ConnectionMonitorTestConfigurationProtocol `json:"protocol,omitempty"` + // PreferredIPVersion - The preferred IP version to use in test evaluation. The connection monitor may choose to use a different version depending on other parameters. Possible values include: 'PreferredIPVersionIPv4', 'PreferredIPVersionIPv6' + PreferredIPVersion PreferredIPVersion `json:"preferredIPVersion,omitempty"` + // HTTPConfiguration - The parameters used to perform test evaluation over HTTP. + HTTPConfiguration *ConnectionMonitorHTTPConfiguration `json:"httpConfiguration,omitempty"` + // TCPConfiguration - The parameters used to perform test evaluation over TCP. + TCPConfiguration *ConnectionMonitorTCPConfiguration `json:"tcpConfiguration,omitempty"` + // IcmpConfiguration - The parameters used to perform test evaluation over ICMP. + IcmpConfiguration *ConnectionMonitorIcmpConfiguration `json:"icmpConfiguration,omitempty"` + // SuccessThreshold - The threshold for declaring a test successful. + SuccessThreshold *ConnectionMonitorSuccessThreshold `json:"successThreshold,omitempty"` +} + +// ConnectionMonitorTestGroup describes the connection monitor test group. +type ConnectionMonitorTestGroup struct { + // Name - The name of the connection monitor test group. + Name *string `json:"name,omitempty"` + // Disable - Value indicating whether test group is disabled. + Disable *bool `json:"disable,omitempty"` + // TestConfigurations - List of test configuration names. + TestConfigurations *[]string `json:"testConfigurations,omitempty"` + // Sources - List of source endpoint names. + Sources *[]string `json:"sources,omitempty"` + // Destinations - List of destination endpoint names. + Destinations *[]string `json:"destinations,omitempty"` +} + +// ConnectionMonitorWorkspaceSettings describes the settings for producing output into a log analytics +// workspace. +type ConnectionMonitorWorkspaceSettings struct { + // WorkspaceResourceID - Log analytics workspace resource ID. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` +} + +// ConnectionResetSharedKey the virtual network connection reset shared key. +type ConnectionResetSharedKey struct { + autorest.Response `json:"-"` + // KeyLength - The virtual network connection reset shared key length, should between 1 and 128. + KeyLength *int32 `json:"keyLength,omitempty"` +} + +// ConnectionSharedKey response for GetConnectionSharedKey API service call. +type ConnectionSharedKey struct { + autorest.Response `json:"-"` + // Value - The virtual network connection shared key value. + Value *string `json:"value,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ConnectionStateSnapshot connection state snapshot. +type ConnectionStateSnapshot struct { + // ConnectionState - The connection state. Possible values include: 'ConnectionStateReachable', 'ConnectionStateUnreachable', 'ConnectionStateUnknown' + ConnectionState ConnectionState `json:"connectionState,omitempty"` + // StartTime - The start time of the connection snapshot. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time of the connection snapshot. + EndTime *date.Time `json:"endTime,omitempty"` + // EvaluationState - Connectivity analysis evaluation state. Possible values include: 'EvaluationStateNotStarted', 'EvaluationStateInProgress', 'EvaluationStateCompleted' + EvaluationState EvaluationState `json:"evaluationState,omitempty"` + // AvgLatencyInMs - Average latency in ms. + AvgLatencyInMs *int64 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - Minimum latency in ms. + MinLatencyInMs *int64 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - Maximum latency in ms. + MaxLatencyInMs *int64 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - The number of sent probes. + ProbesSent *int64 `json:"probesSent,omitempty"` + // ProbesFailed - The number of failed probes. + ProbesFailed *int64 `json:"probesFailed,omitempty"` + // Hops - READ-ONLY; List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionStateSnapshot. +func (CSS ConnectionStateSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ConnectionState != "" { + objectMap["connectionState"] = CSS.ConnectionState + } + if CSS.StartTime != nil { + objectMap["startTime"] = CSS.StartTime + } + if CSS.EndTime != nil { + objectMap["endTime"] = CSS.EndTime + } + if CSS.EvaluationState != "" { + objectMap["evaluationState"] = CSS.EvaluationState + } + if CSS.AvgLatencyInMs != nil { + objectMap["avgLatencyInMs"] = CSS.AvgLatencyInMs + } + if CSS.MinLatencyInMs != nil { + objectMap["minLatencyInMs"] = CSS.MinLatencyInMs + } + if CSS.MaxLatencyInMs != nil { + objectMap["maxLatencyInMs"] = CSS.MaxLatencyInMs + } + if CSS.ProbesSent != nil { + objectMap["probesSent"] = CSS.ProbesSent + } + if CSS.ProbesFailed != nil { + objectMap["probesFailed"] = CSS.ProbesFailed + } + return json.Marshal(objectMap) +} + +// ConnectivityDestination parameters that define destination of connection. +type ConnectivityDestination struct { + // ResourceID - The ID of the resource to which a connection attempt will be made. + ResourceID *string `json:"resourceId,omitempty"` + // Address - The IP address or URI the resource to which a connection attempt will be made. + Address *string `json:"address,omitempty"` + // Port - Port on which check connectivity will be performed. + Port *int32 `json:"port,omitempty"` +} + +// ConnectivityHop information about a hop between the source and the destination. +type ConnectivityHop struct { + // Type - READ-ONLY; The type of the hop. + Type *string `json:"type,omitempty"` + // ID - READ-ONLY; The ID of the hop. + ID *string `json:"id,omitempty"` + // Address - READ-ONLY; The IP address of the hop. + Address *string `json:"address,omitempty"` + // ResourceID - READ-ONLY; The ID of the resource corresponding to this hop. + ResourceID *string `json:"resourceId,omitempty"` + // NextHopIds - READ-ONLY; List of next hop identifiers. + NextHopIds *[]string `json:"nextHopIds,omitempty"` + // PreviousHopIds - READ-ONLY; List of previous hop identifiers. + PreviousHopIds *[]string `json:"previousHopIds,omitempty"` + // Links - READ-ONLY; List of hop links. + Links *[]HopLink `json:"links,omitempty"` + // PreviousLinks - READ-ONLY; List of previous hop links. + PreviousLinks *[]HopLink `json:"previousLinks,omitempty"` + // Issues - READ-ONLY; List of issues. + Issues *[]ConnectivityIssue `json:"issues,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityHop. +func (ch ConnectivityHop) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityInformation information on the connectivity status. +type ConnectivityInformation struct { + autorest.Response `json:"-"` + // Hops - READ-ONLY; List of hops between the source and the destination. + Hops *[]ConnectivityHop `json:"hops,omitempty"` + // ConnectionStatus - READ-ONLY; The connection status. Possible values include: 'ConnectionStatusUnknown', 'ConnectionStatusConnected', 'ConnectionStatusDisconnected', 'ConnectionStatusDegraded' + ConnectionStatus ConnectionStatus `json:"connectionStatus,omitempty"` + // AvgLatencyInMs - READ-ONLY; Average latency in milliseconds. + AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - READ-ONLY; Minimum latency in milliseconds. + MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - READ-ONLY; Maximum latency in milliseconds. + MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - READ-ONLY; Total number of probes sent. + ProbesSent *int32 `json:"probesSent,omitempty"` + // ProbesFailed - READ-ONLY; Number of failed probes. + ProbesFailed *int32 `json:"probesFailed,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityInformation. +func (ci ConnectivityInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityIssue information about an issue encountered in the process of checking for connectivity. +type ConnectivityIssue struct { + // Origin - READ-ONLY; The origin of the issue. Possible values include: 'OriginLocal', 'OriginInbound', 'OriginOutbound' + Origin Origin `json:"origin,omitempty"` + // Severity - READ-ONLY; The severity of the issue. Possible values include: 'SeverityError', 'SeverityWarning' + Severity Severity `json:"severity,omitempty"` + // Type - READ-ONLY; The type of issue. Possible values include: 'IssueTypeUnknown', 'IssueTypeAgentStopped', 'IssueTypeGuestFirewall', 'IssueTypeDNSResolution', 'IssueTypeSocketBind', 'IssueTypeNetworkSecurityRule', 'IssueTypeUserDefinedRoute', 'IssueTypePortThrottled', 'IssueTypePlatform' + Type IssueType `json:"type,omitempty"` + // Context - READ-ONLY; Provides additional context on the issue. + Context *[]map[string]*string `json:"context,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectivityIssue. +func (ci ConnectivityIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ConnectivityParameters parameters that determine how the connectivity check will be performed. +type ConnectivityParameters struct { + // Source - The source of the connection. + Source *ConnectivitySource `json:"source,omitempty"` + // Destination - The destination of connection. + Destination *ConnectivityDestination `json:"destination,omitempty"` + // Protocol - Network protocol. Possible values include: 'ProtocolTCP', 'ProtocolHTTP', 'ProtocolHTTPS', 'ProtocolIcmp' + Protocol Protocol `json:"protocol,omitempty"` + // ProtocolConfiguration - Configuration of the protocol. + ProtocolConfiguration *ProtocolConfiguration `json:"protocolConfiguration,omitempty"` + // PreferredIPVersion - Preferred IP version of the connection. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PreferredIPVersion IPVersion `json:"preferredIPVersion,omitempty"` +} + +// ConnectivitySource parameters that define the source of the connection. +type ConnectivitySource struct { + // ResourceID - The ID of the resource from which a connectivity check will be initiated. + ResourceID *string `json:"resourceId,omitempty"` + // Port - The source port from which a connectivity check will be performed. + Port *int32 `json:"port,omitempty"` +} + +// Container reference to container resource in remote resource provider. +type Container struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// ContainerNetworkInterface container network interface child resource. +type ContainerNetworkInterface struct { + // ContainerNetworkInterfacePropertiesFormat - Container network interface properties. + *ContainerNetworkInterfacePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterface. +func (cni ContainerNetworkInterface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cni.ContainerNetworkInterfacePropertiesFormat != nil { + objectMap["properties"] = cni.ContainerNetworkInterfacePropertiesFormat + } + if cni.Name != nil { + objectMap["name"] = cni.Name + } + if cni.ID != nil { + objectMap["id"] = cni.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterface struct. +func (cni *ContainerNetworkInterface) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfacePropertiesFormat ContainerNetworkInterfacePropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfacePropertiesFormat) + if err != nil { + return err + } + cni.ContainerNetworkInterfacePropertiesFormat = &containerNetworkInterfacePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cni.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cni.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cni.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cni.ID = &ID + } + } + } + + return nil +} + +// ContainerNetworkInterfaceConfiguration container network interface configuration child resource. +type ContainerNetworkInterfaceConfiguration struct { + // ContainerNetworkInterfaceConfigurationPropertiesFormat - Container network interface configuration properties. + *ContainerNetworkInterfaceConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfiguration. +func (cnic ContainerNetworkInterfaceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat != nil { + objectMap["properties"] = cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat + } + if cnic.Name != nil { + objectMap["name"] = cnic.Name + } + if cnic.ID != nil { + objectMap["id"] = cnic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceConfiguration struct. +func (cnic *ContainerNetworkInterfaceConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfaceConfigurationPropertiesFormat ContainerNetworkInterfaceConfigurationPropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfaceConfigurationPropertiesFormat) + if err != nil { + return err + } + cnic.ContainerNetworkInterfaceConfigurationPropertiesFormat = &containerNetworkInterfaceConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cnic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cnic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cnic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cnic.ID = &ID + } + } + } + + return nil +} + +// ContainerNetworkInterfaceConfigurationPropertiesFormat container network interface configuration +// properties. +type ContainerNetworkInterfaceConfigurationPropertiesFormat struct { + // IPConfigurations - A list of ip configurations of the container network interface configuration. + IPConfigurations *[]IPConfigurationProfile `json:"ipConfigurations,omitempty"` + // ContainerNetworkInterfaces - A list of container network interfaces created from this container network interface configuration. + ContainerNetworkInterfaces *[]SubResource `json:"containerNetworkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceConfigurationPropertiesFormat. +func (cnicpf ContainerNetworkInterfaceConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnicpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = cnicpf.IPConfigurations + } + if cnicpf.ContainerNetworkInterfaces != nil { + objectMap["containerNetworkInterfaces"] = cnicpf.ContainerNetworkInterfaces + } + return json.Marshal(objectMap) +} + +// ContainerNetworkInterfaceIPConfiguration the ip configuration for a container network interface. +type ContainerNetworkInterfaceIPConfiguration struct { + // ContainerNetworkInterfaceIPConfigurationPropertiesFormat - Properties of the container network interface IP configuration. + *ContainerNetworkInterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfiguration. +func (cniic ContainerNetworkInterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat + } + if cniic.Name != nil { + objectMap["name"] = cniic.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ContainerNetworkInterfaceIPConfiguration struct. +func (cniic *ContainerNetworkInterfaceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var containerNetworkInterfaceIPConfigurationPropertiesFormat ContainerNetworkInterfaceIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &containerNetworkInterfaceIPConfigurationPropertiesFormat) + if err != nil { + return err + } + cniic.ContainerNetworkInterfaceIPConfigurationPropertiesFormat = &containerNetworkInterfaceIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cniic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cniic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cniic.Etag = &etag + } + } + } + + return nil +} + +// ContainerNetworkInterfaceIPConfigurationPropertiesFormat properties of the container network interface +// IP configuration. +type ContainerNetworkInterfaceIPConfigurationPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfaceIPConfigurationPropertiesFormat. +func (cniicpf ContainerNetworkInterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ContainerNetworkInterfacePropertiesFormat properties of container network interface. +type ContainerNetworkInterfacePropertiesFormat struct { + // ContainerNetworkInterfaceConfiguration - READ-ONLY; Container network interface configuration from which this container network interface is created. + ContainerNetworkInterfaceConfiguration *ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfiguration,omitempty"` + // Container - Reference to the container to which this container network interface is attached. + Container *Container `json:"container,omitempty"` + // IPConfigurations - READ-ONLY; Reference to the ip configuration on this container nic. + IPConfigurations *[]ContainerNetworkInterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the container network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerNetworkInterfacePropertiesFormat. +func (cnipf ContainerNetworkInterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cnipf.Container != nil { + objectMap["container"] = cnipf.Container + } + return json.Marshal(objectMap) +} + +// CustomDNSConfigPropertiesFormat contains custom Dns resolution configuration from customer. +type CustomDNSConfigPropertiesFormat struct { + // Fqdn - Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + // IPAddresses - A list of private ip addresses of the private endpoint. + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// CustomIPPrefix custom IP prefix resource. +type CustomIPPrefix struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the custom IP prefix. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // CustomIPPrefixPropertiesFormat - Custom IP prefix properties. + *CustomIPPrefixPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for CustomIPPrefix. +func (cip CustomIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cip.ExtendedLocation != nil { + objectMap["extendedLocation"] = cip.ExtendedLocation + } + if cip.CustomIPPrefixPropertiesFormat != nil { + objectMap["properties"] = cip.CustomIPPrefixPropertiesFormat + } + if cip.Zones != nil { + objectMap["zones"] = cip.Zones + } + if cip.ID != nil { + objectMap["id"] = cip.ID + } + if cip.Location != nil { + objectMap["location"] = cip.Location + } + if cip.Tags != nil { + objectMap["tags"] = cip.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CustomIPPrefix struct. +func (cip *CustomIPPrefix) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + cip.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var customIPPrefixPropertiesFormat CustomIPPrefixPropertiesFormat + err = json.Unmarshal(*v, &customIPPrefixPropertiesFormat) + if err != nil { + return err + } + cip.CustomIPPrefixPropertiesFormat = &customIPPrefixPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + cip.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + cip.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cip.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + cip.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + cip.Tags = tags + } + } + } + + return nil +} + +// CustomIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type CustomIPPrefixesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomIPPrefixesClient) (CustomIPPrefix, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomIPPrefixesCreateOrUpdateFuture.Result. +func (future *CustomIPPrefixesCreateOrUpdateFuture) result(client CustomIPPrefixesClient) (cip CustomIPPrefix, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cip.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cip.Response.Response, err = future.GetResult(sender); err == nil && cip.Response.Response.StatusCode != http.StatusNoContent { + cip, err = client.CreateOrUpdateResponder(cip.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesCreateOrUpdateFuture", "Result", cip.Response.Response, "Failure responding to request") + } + } + return +} + +// CustomIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CustomIPPrefixesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CustomIPPrefixesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CustomIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CustomIPPrefixesDeleteFuture.Result. +func (future *CustomIPPrefixesDeleteFuture) result(client CustomIPPrefixesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.CustomIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.CustomIPPrefixesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// CustomIPPrefixListResult response for ListCustomIpPrefixes API service call. +type CustomIPPrefixListResult struct { + autorest.Response `json:"-"` + // Value - A list of Custom IP prefixes that exists in a resource group. + Value *[]CustomIPPrefix `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// CustomIPPrefixListResultIterator provides access to a complete listing of CustomIPPrefix values. +type CustomIPPrefixListResultIterator struct { + i int + page CustomIPPrefixListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *CustomIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *CustomIPPrefixListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter CustomIPPrefixListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter CustomIPPrefixListResultIterator) Response() CustomIPPrefixListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter CustomIPPrefixListResultIterator) Value() CustomIPPrefix { + if !iter.page.NotDone() { + return CustomIPPrefix{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the CustomIPPrefixListResultIterator type. +func NewCustomIPPrefixListResultIterator(page CustomIPPrefixListResultPage) CustomIPPrefixListResultIterator { + return CustomIPPrefixListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ciplr CustomIPPrefixListResult) IsEmpty() bool { + return ciplr.Value == nil || len(*ciplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ciplr CustomIPPrefixListResult) hasNextLink() bool { + return ciplr.NextLink != nil && len(*ciplr.NextLink) != 0 +} + +// customIPPrefixListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ciplr CustomIPPrefixListResult) customIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ciplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ciplr.NextLink))) +} + +// CustomIPPrefixListResultPage contains a page of CustomIPPrefix values. +type CustomIPPrefixListResultPage struct { + fn func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error) + ciplr CustomIPPrefixListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *CustomIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CustomIPPrefixListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ciplr) + if err != nil { + return err + } + page.ciplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *CustomIPPrefixListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page CustomIPPrefixListResultPage) NotDone() bool { + return !page.ciplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page CustomIPPrefixListResultPage) Response() CustomIPPrefixListResult { + return page.ciplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page CustomIPPrefixListResultPage) Values() []CustomIPPrefix { + if page.ciplr.IsEmpty() { + return nil + } + return *page.ciplr.Value +} + +// Creates a new instance of the CustomIPPrefixListResultPage type. +func NewCustomIPPrefixListResultPage(cur CustomIPPrefixListResult, getNextPage func(context.Context, CustomIPPrefixListResult) (CustomIPPrefixListResult, error)) CustomIPPrefixListResultPage { + return CustomIPPrefixListResultPage{ + fn: getNextPage, + ciplr: cur, + } +} + +// CustomIPPrefixPropertiesFormat custom IP prefix properties. +type CustomIPPrefixPropertiesFormat struct { + // Cidr - The prefix range in CIDR notation. Should include the start address and the prefix length. + Cidr *string `json:"cidr,omitempty"` + // SignedMessage - Signed message for WAN validation. + SignedMessage *string `json:"signedMessage,omitempty"` + // AuthorizationMessage - Authorization message for WAN validation. + AuthorizationMessage *string `json:"authorizationMessage,omitempty"` + // CustomIPPrefixParent - The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. + CustomIPPrefixParent *SubResource `json:"customIpPrefixParent,omitempty"` + // ChildCustomIPPrefixes - READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. + ChildCustomIPPrefixes *[]SubResource `json:"childCustomIpPrefixes,omitempty"` + // CommissionedState - The commissioned state of the Custom IP Prefix. Possible values include: 'CommissionedStateProvisioning', 'CommissionedStateProvisioned', 'CommissionedStateCommissioning', 'CommissionedStateCommissioned', 'CommissionedStateDecommissioning', 'CommissionedStateDeprovisioning' + CommissionedState CommissionedState `json:"commissionedState,omitempty"` + // PublicIPPrefixes - READ-ONLY; The list of all referenced PublicIpPrefixes. + PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the custom IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // FailedReason - READ-ONLY; The reason why resource is in failed state. + FailedReason *string `json:"failedReason,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the custom IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for CustomIPPrefixPropertiesFormat. +func (cippf CustomIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cippf.Cidr != nil { + objectMap["cidr"] = cippf.Cidr + } + if cippf.SignedMessage != nil { + objectMap["signedMessage"] = cippf.SignedMessage + } + if cippf.AuthorizationMessage != nil { + objectMap["authorizationMessage"] = cippf.AuthorizationMessage + } + if cippf.CustomIPPrefixParent != nil { + objectMap["customIpPrefixParent"] = cippf.CustomIPPrefixParent + } + if cippf.CommissionedState != "" { + objectMap["commissionedState"] = cippf.CommissionedState + } + return json.Marshal(objectMap) +} + +// DdosCustomPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosCustomPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosCustomPoliciesClient) (DdosCustomPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosCustomPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosCustomPoliciesCreateOrUpdateFuture.Result. +func (future *DdosCustomPoliciesCreateOrUpdateFuture) result(client DdosCustomPoliciesClient) (dcp DdosCustomPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dcp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dcp.Response.Response, err = future.GetResult(sender); err == nil && dcp.Response.Response.StatusCode != http.StatusNoContent { + dcp, err = client.CreateOrUpdateResponder(dcp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesCreateOrUpdateFuture", "Result", dcp.Response.Response, "Failure responding to request") + } + } + return +} + +// DdosCustomPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosCustomPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosCustomPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosCustomPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosCustomPoliciesDeleteFuture.Result. +func (future *DdosCustomPoliciesDeleteFuture) result(client DdosCustomPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosCustomPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosCustomPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DdosCustomPolicy a DDoS custom policy in a resource group. +type DdosCustomPolicy struct { + autorest.Response `json:"-"` + // DdosCustomPolicyPropertiesFormat - Properties of the DDoS custom policy. + *DdosCustomPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DdosCustomPolicy. +func (dcp DdosCustomPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcp.DdosCustomPolicyPropertiesFormat != nil { + objectMap["properties"] = dcp.DdosCustomPolicyPropertiesFormat + } + if dcp.ID != nil { + objectMap["id"] = dcp.ID + } + if dcp.Location != nil { + objectMap["location"] = dcp.Location + } + if dcp.Tags != nil { + objectMap["tags"] = dcp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DdosCustomPolicy struct. +func (dcp *DdosCustomPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var ddosCustomPolicyPropertiesFormat DdosCustomPolicyPropertiesFormat + err = json.Unmarshal(*v, &ddosCustomPolicyPropertiesFormat) + if err != nil { + return err + } + dcp.DdosCustomPolicyPropertiesFormat = &ddosCustomPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dcp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dcp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dcp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dcp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dcp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dcp.Tags = tags + } + } + } + + return nil +} + +// DdosCustomPolicyPropertiesFormat dDoS custom policy properties. +type DdosCustomPolicyPropertiesFormat struct { + // ResourceGUID - READ-ONLY; The resource GUID property of the DDoS custom policy resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DDoS custom policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PublicIPAddresses - READ-ONLY; The list of public IPs associated with the DDoS custom policy resource. This list is read-only. + PublicIPAddresses *[]SubResource `json:"publicIPAddresses,omitempty"` + // ProtocolCustomSettings - The protocol-specific DDoS policy customization parameters. + ProtocolCustomSettings *[]ProtocolCustomSettingsFormat `json:"protocolCustomSettings,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosCustomPolicyPropertiesFormat. +func (dcppf DdosCustomPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcppf.ProtocolCustomSettings != nil { + objectMap["protocolCustomSettings"] = dcppf.ProtocolCustomSettings + } + return json.Marshal(objectMap) +} + +// DdosProtectionPlan a DDoS protection plan in a resource group. +type DdosProtectionPlan struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // DdosProtectionPlanPropertiesFormat - Properties of the DDoS protection plan. + *DdosProtectionPlanPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlan. +func (dpp DdosProtectionPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpp.Location != nil { + objectMap["location"] = dpp.Location + } + if dpp.Tags != nil { + objectMap["tags"] = dpp.Tags + } + if dpp.DdosProtectionPlanPropertiesFormat != nil { + objectMap["properties"] = dpp.DdosProtectionPlanPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DdosProtectionPlan struct. +func (dpp *DdosProtectionPlan) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dpp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dpp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dpp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dpp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dpp.Tags = tags + } + case "properties": + if v != nil { + var ddosProtectionPlanPropertiesFormat DdosProtectionPlanPropertiesFormat + err = json.Unmarshal(*v, &ddosProtectionPlanPropertiesFormat) + if err != nil { + return err + } + dpp.DdosProtectionPlanPropertiesFormat = &ddosProtectionPlanPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dpp.Etag = &etag + } + } + } + + return nil +} + +// DdosProtectionPlanListResult a list of DDoS protection plans. +type DdosProtectionPlanListResult struct { + autorest.Response `json:"-"` + // Value - A list of DDoS protection plans. + Value *[]DdosProtectionPlan `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlanListResult. +func (dpplr DdosProtectionPlanListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dpplr.Value != nil { + objectMap["value"] = dpplr.Value + } + return json.Marshal(objectMap) +} + +// DdosProtectionPlanListResultIterator provides access to a complete listing of DdosProtectionPlan values. +type DdosProtectionPlanListResultIterator struct { + i int + page DdosProtectionPlanListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DdosProtectionPlanListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DdosProtectionPlanListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DdosProtectionPlanListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DdosProtectionPlanListResultIterator) Response() DdosProtectionPlanListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DdosProtectionPlanListResultIterator) Value() DdosProtectionPlan { + if !iter.page.NotDone() { + return DdosProtectionPlan{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DdosProtectionPlanListResultIterator type. +func NewDdosProtectionPlanListResultIterator(page DdosProtectionPlanListResultPage) DdosProtectionPlanListResultIterator { + return DdosProtectionPlanListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dpplr DdosProtectionPlanListResult) IsEmpty() bool { + return dpplr.Value == nil || len(*dpplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dpplr DdosProtectionPlanListResult) hasNextLink() bool { + return dpplr.NextLink != nil && len(*dpplr.NextLink) != 0 +} + +// ddosProtectionPlanListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dpplr DdosProtectionPlanListResult) ddosProtectionPlanListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dpplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dpplr.NextLink))) +} + +// DdosProtectionPlanListResultPage contains a page of DdosProtectionPlan values. +type DdosProtectionPlanListResultPage struct { + fn func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error) + dpplr DdosProtectionPlanListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DdosProtectionPlanListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DdosProtectionPlanListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dpplr) + if err != nil { + return err + } + page.dpplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DdosProtectionPlanListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DdosProtectionPlanListResultPage) NotDone() bool { + return !page.dpplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DdosProtectionPlanListResultPage) Response() DdosProtectionPlanListResult { + return page.dpplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DdosProtectionPlanListResultPage) Values() []DdosProtectionPlan { + if page.dpplr.IsEmpty() { + return nil + } + return *page.dpplr.Value +} + +// Creates a new instance of the DdosProtectionPlanListResultPage type. +func NewDdosProtectionPlanListResultPage(cur DdosProtectionPlanListResult, getNextPage func(context.Context, DdosProtectionPlanListResult) (DdosProtectionPlanListResult, error)) DdosProtectionPlanListResultPage { + return DdosProtectionPlanListResultPage{ + fn: getNextPage, + dpplr: cur, + } +} + +// DdosProtectionPlanPropertiesFormat dDoS protection plan properties. +type DdosProtectionPlanPropertiesFormat struct { + // ResourceGUID - READ-ONLY; The resource GUID property of the DDoS protection plan resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DDoS protection plan resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VirtualNetworks - READ-ONLY; The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. + VirtualNetworks *[]SubResource `json:"virtualNetworks,omitempty"` +} + +// MarshalJSON is the custom marshaler for DdosProtectionPlanPropertiesFormat. +func (dpppf DdosProtectionPlanPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DdosProtectionPlansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosProtectionPlansCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosProtectionPlansClient) (DdosProtectionPlan, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosProtectionPlansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosProtectionPlansCreateOrUpdateFuture.Result. +func (future *DdosProtectionPlansCreateOrUpdateFuture) result(client DdosProtectionPlansClient) (dpp DdosProtectionPlan, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dpp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dpp.Response.Response, err = future.GetResult(sender); err == nil && dpp.Response.Response.StatusCode != http.StatusNoContent { + dpp, err = client.CreateOrUpdateResponder(dpp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansCreateOrUpdateFuture", "Result", dpp.Response.Response, "Failure responding to request") + } + } + return +} + +// DdosProtectionPlansDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DdosProtectionPlansDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DdosProtectionPlansClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DdosProtectionPlansDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DdosProtectionPlansDeleteFuture.Result. +func (future *DdosProtectionPlansDeleteFuture) result(client DdosProtectionPlansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DdosProtectionPlansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DdosProtectionPlansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DdosSettings contains the DDoS protection settings of the public IP. +type DdosSettings struct { + // DdosCustomPolicy - The DDoS custom policy associated with the public IP. + DdosCustomPolicy *SubResource `json:"ddosCustomPolicy,omitempty"` + // ProtectionCoverage - The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized. Possible values include: 'DdosSettingsProtectionCoverageBasic', 'DdosSettingsProtectionCoverageStandard' + ProtectionCoverage DdosSettingsProtectionCoverage `json:"protectionCoverage,omitempty"` + // ProtectedIP - Enables DDoS protection on the public IP. + ProtectedIP *bool `json:"protectedIP,omitempty"` +} + +// Delegation details the service to which the subnet is delegated. +type Delegation struct { + // ServiceDelegationPropertiesFormat - Properties of the subnet. + *ServiceDelegationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a subnet. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Delegation. +func (d Delegation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.ServiceDelegationPropertiesFormat != nil { + objectMap["properties"] = d.ServiceDelegationPropertiesFormat + } + if d.Name != nil { + objectMap["name"] = d.Name + } + if d.Type != nil { + objectMap["type"] = d.Type + } + if d.ID != nil { + objectMap["id"] = d.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Delegation struct. +func (d *Delegation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceDelegationPropertiesFormat ServiceDelegationPropertiesFormat + err = json.Unmarshal(*v, &serviceDelegationPropertiesFormat) + if err != nil { + return err + } + d.ServiceDelegationPropertiesFormat = &serviceDelegationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + d.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + } + } + + return nil +} + +// DeleteBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DeleteBastionShareableLinkFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteBastionShareableLinkFuture.Result. +func (future *DeleteBastionShareableLinkFuture) result(client BaseClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DeleteBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DeleteBastionShareableLinkFuture") + return + } + ar.Response = future.Response() + return +} + +// DeviceProperties list of properties of the device. +type DeviceProperties struct { + // DeviceVendor - Name of the device Vendor. + DeviceVendor *string `json:"deviceVendor,omitempty"` + // DeviceModel - Model of the device. + DeviceModel *string `json:"deviceModel,omitempty"` + // LinkSpeedInMbps - Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// DhcpOptions dhcpOptions contains an array of DNS servers available to VMs deployed in the virtual +// network. Standard DHCP option for a subnet overrides VNET DHCP options. +type DhcpOptions struct { + // DNSServers - The list of DNS servers IP addresses. + DNSServers *[]string `json:"dnsServers,omitempty"` +} + +// Dimension dimension of the metric. +type Dimension struct { + // Name - The name of the dimension. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the dimension. + DisplayName *string `json:"displayName,omitempty"` + // InternalName - The internal name of the dimension. + InternalName *string `json:"internalName,omitempty"` +} + +// DNSNameAvailabilityResult response for the CheckDnsNameAvailability API service call. +type DNSNameAvailabilityResult struct { + autorest.Response `json:"-"` + // Available - Domain availability (True/False). + Available *bool `json:"available,omitempty"` +} + +// DNSSettings DNS Proxy Settings in Firewall Policy. +type DNSSettings struct { + // Servers - List of Custom DNS Servers. + Servers *[]string `json:"servers,omitempty"` + // EnableProxy - Enable DNS Proxy on Firewalls attached to the Firewall Policy. + EnableProxy *bool `json:"enableProxy,omitempty"` + // RequireProxyForNetworkRules - FQDNs in Network Rules are supported when set to true. + RequireProxyForNetworkRules *bool `json:"requireProxyForNetworkRules,omitempty"` +} + +// DscpConfiguration differentiated Services Code Point configuration for any given network interface +type DscpConfiguration struct { + autorest.Response `json:"-"` + // DscpConfigurationPropertiesFormat - Properties of the network interface. + *DscpConfigurationPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for DscpConfiguration. +func (dc DscpConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dc.DscpConfigurationPropertiesFormat != nil { + objectMap["properties"] = dc.DscpConfigurationPropertiesFormat + } + if dc.ID != nil { + objectMap["id"] = dc.ID + } + if dc.Location != nil { + objectMap["location"] = dc.Location + } + if dc.Tags != nil { + objectMap["tags"] = dc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DscpConfiguration struct. +func (dc *DscpConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var dscpConfigurationPropertiesFormat DscpConfigurationPropertiesFormat + err = json.Unmarshal(*v, &dscpConfigurationPropertiesFormat) + if err != nil { + return err + } + dc.DscpConfigurationPropertiesFormat = &dscpConfigurationPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + dc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dc.Tags = tags + } + } + } + + return nil +} + +// DscpConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DscpConfigurationCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DscpConfigurationClient) (DscpConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DscpConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DscpConfigurationCreateOrUpdateFuture.Result. +func (future *DscpConfigurationCreateOrUpdateFuture) result(client DscpConfigurationClient) (dc DscpConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dc.Response.Response, err = future.GetResult(sender); err == nil && dc.Response.Response.StatusCode != http.StatusNoContent { + dc, err = client.CreateOrUpdateResponder(dc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationCreateOrUpdateFuture", "Result", dc.Response.Response, "Failure responding to request") + } + } + return +} + +// DscpConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DscpConfigurationDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DscpConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DscpConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DscpConfigurationDeleteFuture.Result. +func (future *DscpConfigurationDeleteFuture) result(client DscpConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.DscpConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.DscpConfigurationDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DscpConfigurationListResult response for the DscpConfigurationList API service call. +type DscpConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of dscp configurations in a resource group. + Value *[]DscpConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DscpConfigurationListResult. +func (dclr DscpConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dclr.Value != nil { + objectMap["value"] = dclr.Value + } + return json.Marshal(objectMap) +} + +// DscpConfigurationListResultIterator provides access to a complete listing of DscpConfiguration values. +type DscpConfigurationListResultIterator struct { + i int + page DscpConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DscpConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DscpConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DscpConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DscpConfigurationListResultIterator) Response() DscpConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DscpConfigurationListResultIterator) Value() DscpConfiguration { + if !iter.page.NotDone() { + return DscpConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DscpConfigurationListResultIterator type. +func NewDscpConfigurationListResultIterator(page DscpConfigurationListResultPage) DscpConfigurationListResultIterator { + return DscpConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dclr DscpConfigurationListResult) IsEmpty() bool { + return dclr.Value == nil || len(*dclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dclr DscpConfigurationListResult) hasNextLink() bool { + return dclr.NextLink != nil && len(*dclr.NextLink) != 0 +} + +// dscpConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dclr DscpConfigurationListResult) dscpConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dclr.NextLink))) +} + +// DscpConfigurationListResultPage contains a page of DscpConfiguration values. +type DscpConfigurationListResultPage struct { + fn func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error) + dclr DscpConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DscpConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DscpConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dclr) + if err != nil { + return err + } + page.dclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DscpConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DscpConfigurationListResultPage) NotDone() bool { + return !page.dclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DscpConfigurationListResultPage) Response() DscpConfigurationListResult { + return page.dclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DscpConfigurationListResultPage) Values() []DscpConfiguration { + if page.dclr.IsEmpty() { + return nil + } + return *page.dclr.Value +} + +// Creates a new instance of the DscpConfigurationListResultPage type. +func NewDscpConfigurationListResultPage(cur DscpConfigurationListResult, getNextPage func(context.Context, DscpConfigurationListResult) (DscpConfigurationListResult, error)) DscpConfigurationListResultPage { + return DscpConfigurationListResultPage{ + fn: getNextPage, + dclr: cur, + } +} + +// DscpConfigurationPropertiesFormat differentiated Services Code Point configuration properties. +type DscpConfigurationPropertiesFormat struct { + // Markings - List of markings to be used in the configuration. + Markings *[]int32 `json:"markings,omitempty"` + // SourceIPRanges - Source IP ranges. + SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` + // DestinationIPRanges - Destination IP ranges. + DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` + // SourcePortRanges - Sources port ranges. + SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - Destination port ranges. + DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` + // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' + Protocol ProtocolType `json:"protocol,omitempty"` + // QosDefinitionCollection - QoS object definitions + QosDefinitionCollection *[]QosDefinition `json:"qosDefinitionCollection,omitempty"` + // QosCollectionID - READ-ONLY; Qos Collection ID generated by RNM. + QosCollectionID *string `json:"qosCollectionId,omitempty"` + // AssociatedNetworkInterfaces - READ-ONLY; Associated Network Interfaces to the DSCP Configuration. + AssociatedNetworkInterfaces *[]Interface `json:"associatedNetworkInterfaces,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the DSCP Configuration resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the DSCP Configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for DscpConfigurationPropertiesFormat. +func (dcpf DscpConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dcpf.Markings != nil { + objectMap["markings"] = dcpf.Markings + } + if dcpf.SourceIPRanges != nil { + objectMap["sourceIpRanges"] = dcpf.SourceIPRanges + } + if dcpf.DestinationIPRanges != nil { + objectMap["destinationIpRanges"] = dcpf.DestinationIPRanges + } + if dcpf.SourcePortRanges != nil { + objectMap["sourcePortRanges"] = dcpf.SourcePortRanges + } + if dcpf.DestinationPortRanges != nil { + objectMap["destinationPortRanges"] = dcpf.DestinationPortRanges + } + if dcpf.Protocol != "" { + objectMap["protocol"] = dcpf.Protocol + } + if dcpf.QosDefinitionCollection != nil { + objectMap["qosDefinitionCollection"] = dcpf.QosDefinitionCollection + } + return json.Marshal(objectMap) +} + +// EffectiveNetworkSecurityGroup effective network security group. +type EffectiveNetworkSecurityGroup struct { + // NetworkSecurityGroup - The ID of network security group that is applied. + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + // Association - Associated resources. + Association *EffectiveNetworkSecurityGroupAssociation `json:"association,omitempty"` + // EffectiveSecurityRules - A collection of effective security rules. + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` + // TagMap - Mapping of tags to list of IP Addresses included within the tag. + TagMap map[string][]string `json:"tagMap"` +} + +// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroup. +func (ensg EffectiveNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensg.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = ensg.NetworkSecurityGroup + } + if ensg.Association != nil { + objectMap["association"] = ensg.Association + } + if ensg.EffectiveSecurityRules != nil { + objectMap["effectiveSecurityRules"] = ensg.EffectiveSecurityRules + } + if ensg.TagMap != nil { + objectMap["tagMap"] = ensg.TagMap + } + return json.Marshal(objectMap) +} + +// EffectiveNetworkSecurityGroupAssociation the effective network security group association. +type EffectiveNetworkSecurityGroupAssociation struct { + // NetworkManager - The ID of the Azure network manager if assigned. + NetworkManager *SubResource `json:"networkManager,omitempty"` + // Subnet - The ID of the subnet if assigned. + Subnet *SubResource `json:"subnet,omitempty"` + // NetworkInterface - The ID of the network interface if assigned. + NetworkInterface *SubResource `json:"networkInterface,omitempty"` +} + +// EffectiveNetworkSecurityGroupListResult response for list effective network security groups API service +// call. +type EffectiveNetworkSecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of effective network security groups. + Value *[]EffectiveNetworkSecurityGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveNetworkSecurityGroupListResult. +func (ensglr EffectiveNetworkSecurityGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensglr.Value != nil { + objectMap["value"] = ensglr.Value + } + return json.Marshal(objectMap) +} + +// EffectiveNetworkSecurityRule effective network security rules. +type EffectiveNetworkSecurityRule struct { + // Name - The name of the security rule specified by the user (if created by the user). + Name *string `json:"name,omitempty"` + // Protocol - The network protocol this rule applies to. Possible values include: 'EffectiveSecurityRuleProtocolTCP', 'EffectiveSecurityRuleProtocolUDP', 'EffectiveSecurityRuleProtocolAll' + Protocol EffectiveSecurityRuleProtocol `json:"protocol,omitempty"` + // SourcePortRange - The source port or range. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + // DestinationPortRange - The destination port or range. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + // SourcePortRanges - The source port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - The destination port ranges. Expected values include a single integer between 0 and 65535, a range using '-' as separator (e.g. 100-400), or an asterisk (*). + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // SourceAddressPrefix - The source address prefix. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // DestinationAddressPrefix - The destination address prefix. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + // SourceAddressPrefixes - The source address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). + SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` + // DestinationAddressPrefixes - The destination address prefixes. Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, AzureLoadBalancer, Internet), System Tags, and the asterisk (*). + DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` + // ExpandedSourceAddressPrefix - The expanded source address prefix. + ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"` + // ExpandedDestinationAddressPrefix - Expanded destination address prefix. + ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"` + // Access - Whether network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + Access SecurityRuleAccess `json:"access,omitempty"` + // Priority - The priority of the rule. + Priority *int32 `json:"priority,omitempty"` + // Direction - The direction of the rule. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' + Direction SecurityRuleDirection `json:"direction,omitempty"` +} + +// EffectiveRoute effective Route. +type EffectiveRoute struct { + // Name - The name of the user defined route. This is optional. + Name *string `json:"name,omitempty"` + // DisableBgpRoutePropagation - If true, on-premises routes are not propagated to the network interfaces in the subnet. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + // Source - Who created the route. Possible values include: 'EffectiveRouteSourceUnknown', 'EffectiveRouteSourceUser', 'EffectiveRouteSourceVirtualNetworkGateway', 'EffectiveRouteSourceDefault' + Source EffectiveRouteSource `json:"source,omitempty"` + // State - The value of effective route. Possible values include: 'EffectiveRouteStateActive', 'EffectiveRouteStateInvalid' + State EffectiveRouteState `json:"state,omitempty"` + // AddressPrefix - The address prefixes of the effective routes in CIDR notation. + AddressPrefix *[]string `json:"addressPrefix,omitempty"` + // NextHopIPAddress - The IP address of the next hop of the effective route. + NextHopIPAddress *[]string `json:"nextHopIpAddress,omitempty"` + // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` +} + +// EffectiveRouteListResult response for list effective route API service call. +type EffectiveRouteListResult struct { + autorest.Response `json:"-"` + // Value - A list of effective routes. + Value *[]EffectiveRoute `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for EffectiveRouteListResult. +func (erlr EffectiveRouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erlr.Value != nil { + objectMap["value"] = erlr.Value + } + return json.Marshal(objectMap) +} + +// EffectiveRoutesParameters the parameters specifying the resource whose effective routes are being +// requested. +type EffectiveRoutesParameters struct { + // ResourceID - The resource whose effective routes are being requested. + ResourceID *string `json:"resourceId,omitempty"` + // VirtualWanResourceType - The type of the specified resource like RouteTable, ExpressRouteConnection, HubVirtualNetworkConnection, VpnConnection and P2SConnection. + VirtualWanResourceType *string `json:"virtualWanResourceType,omitempty"` +} + +// EndpointServiceResult endpoint service. +type EndpointServiceResult struct { + // Name - READ-ONLY; Name of the endpoint service. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the endpoint service. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointServiceResult. +func (esr EndpointServiceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if esr.ID != nil { + objectMap["id"] = esr.ID + } + return json.Marshal(objectMap) +} + +// EndpointServicesListResult response for the ListAvailableEndpointServices API service call. +type EndpointServicesListResult struct { + autorest.Response `json:"-"` + // Value - List of available endpoint services in a region. + Value *[]EndpointServiceResult `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// EndpointServicesListResultIterator provides access to a complete listing of EndpointServiceResult +// values. +type EndpointServicesListResultIterator struct { + i int + page EndpointServicesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointServicesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointServicesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointServicesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointServicesListResultIterator) Response() EndpointServicesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointServicesListResultIterator) Value() EndpointServiceResult { + if !iter.page.NotDone() { + return EndpointServiceResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointServicesListResultIterator type. +func NewEndpointServicesListResultIterator(page EndpointServicesListResultPage) EndpointServicesListResultIterator { + return EndpointServicesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (eslr EndpointServicesListResult) IsEmpty() bool { + return eslr.Value == nil || len(*eslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (eslr EndpointServicesListResult) hasNextLink() bool { + return eslr.NextLink != nil && len(*eslr.NextLink) != 0 +} + +// endpointServicesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (eslr EndpointServicesListResult) endpointServicesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !eslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(eslr.NextLink))) +} + +// EndpointServicesListResultPage contains a page of EndpointServiceResult values. +type EndpointServicesListResultPage struct { + fn func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error) + eslr EndpointServicesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointServicesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointServicesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.eslr) + if err != nil { + return err + } + page.eslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointServicesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointServicesListResultPage) NotDone() bool { + return !page.eslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointServicesListResultPage) Response() EndpointServicesListResult { + return page.eslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointServicesListResultPage) Values() []EndpointServiceResult { + if page.eslr.IsEmpty() { + return nil + } + return *page.eslr.Value +} + +// Creates a new instance of the EndpointServicesListResultPage type. +func NewEndpointServicesListResultPage(cur EndpointServicesListResult, getNextPage func(context.Context, EndpointServicesListResult) (EndpointServicesListResult, error)) EndpointServicesListResultPage { + return EndpointServicesListResultPage{ + fn: getNextPage, + eslr: cur, + } +} + +// Error common error representation. +type Error struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Details - Error details. + Details *[]ErrorDetails `json:"details,omitempty"` + // InnerError - Inner error message. + InnerError *string `json:"innerError,omitempty"` +} + +// ErrorDetails common error details representation. +type ErrorDetails struct { + // Code - Error code. + Code *string `json:"code,omitempty"` + // Target - Error target. + Target *string `json:"target,omitempty"` + // Message - Error message. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse the error object. +type ErrorResponse struct { + // Error - The error details object. + 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"` + // AppliedTo - Resource ID of nic or subnet to which network security group is applied. + AppliedTo *string `json:"appliedTo,omitempty"` + // MatchedRule - Matched network security rule. + MatchedRule *MatchedRule `json:"matchedRule,omitempty"` + // RulesEvaluationResult - READ-ONLY; List of network security rules evaluation results. + RulesEvaluationResult *[]SecurityRulesEvaluationResult `json:"rulesEvaluationResult,omitempty"` +} + +// MarshalJSON is the custom marshaler for EvaluatedNetworkSecurityGroup. +func (ensg EvaluatedNetworkSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ensg.NetworkSecurityGroupID != nil { + objectMap["networkSecurityGroupId"] = ensg.NetworkSecurityGroupID + } + if ensg.AppliedTo != nil { + objectMap["appliedTo"] = ensg.AppliedTo + } + if ensg.MatchedRule != nil { + objectMap["matchedRule"] = ensg.MatchedRule + } + return json.Marshal(objectMap) +} + +// ExclusionManagedRule defines a managed rule to use for exclusion. +type ExclusionManagedRule struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` +} + +// ExclusionManagedRuleGroup defines a managed rule group to use for exclusion. +type ExclusionManagedRuleGroup struct { + // RuleGroupName - The managed rule group for exclusion. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be excluded. If none specified, all rules in the group will be excluded. + Rules *[]ExclusionManagedRule `json:"rules,omitempty"` +} + +// ExclusionManagedRuleSet defines a managed rule set for Exclusions. +type ExclusionManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroups - Defines the rule groups to apply to the rule set. + RuleGroups *[]ExclusionManagedRuleGroup `json:"ruleGroups,omitempty"` +} + +// ExplicitProxySettings explicit Proxy Settings in Firewall Policy. +type ExplicitProxySettings struct { + // EnableExplicitProxy - When set to true, explicit proxy mode is enabled. + EnableExplicitProxy *bool `json:"enableExplicitProxy,omitempty"` + // HTTPPort - Port number for explicit proxy http protocol, cannot be greater than 64000. + HTTPPort *int32 `json:"httpPort,omitempty"` + // HTTPSPort - Port number for explicit proxy https protocol, cannot be greater than 64000. + HTTPSPort *int32 `json:"httpsPort,omitempty"` + // PacFilePort - Port number for firewall to serve PAC file. + PacFilePort *int32 `json:"pacFilePort,omitempty"` + // PacFile - SAS URL for PAC file. + PacFile *string `json:"pacFile,omitempty"` +} + +// ExpressRouteCircuit expressRouteCircuit resource. +type ExpressRouteCircuit struct { + autorest.Response `json:"-"` + // Sku - The SKU. + Sku *ExpressRouteCircuitSku `json:"sku,omitempty"` + // ExpressRouteCircuitPropertiesFormat - Properties of the express route circuit. + *ExpressRouteCircuitPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuit. +func (erc ExpressRouteCircuit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erc.Sku != nil { + objectMap["sku"] = erc.Sku + } + if erc.ExpressRouteCircuitPropertiesFormat != nil { + objectMap["properties"] = erc.ExpressRouteCircuitPropertiesFormat + } + if erc.ID != nil { + objectMap["id"] = erc.ID + } + if erc.Location != nil { + objectMap["location"] = erc.Location + } + if erc.Tags != nil { + objectMap["tags"] = erc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuit struct. +func (erc *ExpressRouteCircuit) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ExpressRouteCircuitSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + erc.Sku = &sku + } + case "properties": + if v != nil { + var expressRouteCircuitPropertiesFormat ExpressRouteCircuitPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitPropertiesFormat) + if err != nil { + return err + } + erc.ExpressRouteCircuitPropertiesFormat = &expressRouteCircuitPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erc.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteCircuitArpTable the ARP table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitArpTable struct { + // Age - Entry age in minutes. + Age *int32 `json:"age,omitempty"` + // Interface - Interface address. + Interface *string `json:"interface,omitempty"` + // IPAddress - The IP address. + IPAddress *string `json:"ipAddress,omitempty"` + // MacAddress - The MAC address. + MacAddress *string `json:"macAddress,omitempty"` +} + +// ExpressRouteCircuitAuthorization authorization in an ExpressRouteCircuit resource. +type ExpressRouteCircuitAuthorization struct { + autorest.Response `json:"-"` + // AuthorizationPropertiesFormat - Properties of the express route circuit authorization. + *AuthorizationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitAuthorization. +func (erca ExpressRouteCircuitAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erca.AuthorizationPropertiesFormat != nil { + objectMap["properties"] = erca.AuthorizationPropertiesFormat + } + if erca.Name != nil { + objectMap["name"] = erca.Name + } + if erca.ID != nil { + objectMap["id"] = erca.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitAuthorization struct. +func (erca *ExpressRouteCircuitAuthorization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var authorizationPropertiesFormat AuthorizationPropertiesFormat + err = json.Unmarshal(*v, &authorizationPropertiesFormat) + if err != nil { + return err + } + erca.AuthorizationPropertiesFormat = &authorizationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erca.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erca.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erca.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erca.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitAuthorizationsClient) (ExpressRouteCircuitAuthorization, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erca.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent { + erca, err = client.CreateOrUpdateResponder(erca.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture", "Result", erca.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCircuitAuthorizationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitAuthorizationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitAuthorizationsDeleteFuture.Result. +func (future *ExpressRouteCircuitAuthorizationsDeleteFuture) result(client ExpressRouteCircuitAuthorizationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitAuthorizationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitConnection express Route Circuit Connection in an ExpressRouteCircuitPeering +// resource. +type ExpressRouteCircuitConnection struct { + autorest.Response `json:"-"` + // ExpressRouteCircuitConnectionPropertiesFormat - Properties of the express route circuit connection. + *ExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnection. +func (ercc ExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercc.ExpressRouteCircuitConnectionPropertiesFormat != nil { + objectMap["properties"] = ercc.ExpressRouteCircuitConnectionPropertiesFormat + } + if ercc.Name != nil { + objectMap["name"] = ercc.Name + } + if ercc.ID != nil { + objectMap["id"] = ercc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitConnection struct. +func (ercc *ExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCircuitConnectionPropertiesFormat ExpressRouteCircuitConnectionPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitConnectionPropertiesFormat) + if err != nil { + return err + } + ercc.ExpressRouteCircuitConnectionPropertiesFormat = &expressRouteCircuitConnectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercc.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitConnectionListResult response for ListConnections API service call retrieves all +// global reach connections that belongs to a Private Peering for an ExpressRouteCircuit. +type ExpressRouteCircuitConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The global reach connection associated with Private Peering in an ExpressRoute Circuit. + Value *[]ExpressRouteCircuitConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of +// ExpressRouteCircuitConnection values. +type ExpressRouteCircuitConnectionListResultIterator struct { + i int + page ExpressRouteCircuitConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitConnectionListResultIterator) Response() ExpressRouteCircuitConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitConnectionListResultIterator) Value() ExpressRouteCircuitConnection { + if !iter.page.NotDone() { + return ExpressRouteCircuitConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitConnectionListResultIterator type. +func NewExpressRouteCircuitConnectionListResultIterator(page ExpressRouteCircuitConnectionListResultPage) ExpressRouteCircuitConnectionListResultIterator { + return ExpressRouteCircuitConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercclr ExpressRouteCircuitConnectionListResult) IsEmpty() bool { + return ercclr.Value == nil || len(*ercclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercclr ExpressRouteCircuitConnectionListResult) hasNextLink() bool { + return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 +} + +// expressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercclr ExpressRouteCircuitConnectionListResult) expressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercclr.NextLink))) +} + +// ExpressRouteCircuitConnectionListResultPage contains a page of ExpressRouteCircuitConnection values. +type ExpressRouteCircuitConnectionListResultPage struct { + fn func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error) + ercclr ExpressRouteCircuitConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercclr) + if err != nil { + return err + } + page.ercclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitConnectionListResultPage) NotDone() bool { + return !page.ercclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitConnectionListResultPage) Response() ExpressRouteCircuitConnectionListResult { + return page.ercclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitConnectionListResultPage) Values() []ExpressRouteCircuitConnection { + if page.ercclr.IsEmpty() { + return nil + } + return *page.ercclr.Value +} + +// Creates a new instance of the ExpressRouteCircuitConnectionListResultPage type. +func NewExpressRouteCircuitConnectionListResultPage(cur ExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, ExpressRouteCircuitConnectionListResult) (ExpressRouteCircuitConnectionListResult, error)) ExpressRouteCircuitConnectionListResultPage { + return ExpressRouteCircuitConnectionListResultPage{ + fn: getNextPage, + ercclr: cur, + } +} + +// ExpressRouteCircuitConnectionPropertiesFormat properties of the express route circuit connection. +type ExpressRouteCircuitConnectionPropertiesFormat struct { + // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // AuthorizationKey - The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // Ipv6CircuitConnectionConfig - IPv6 Address PrefixProperties of the express route circuit connection. + Ipv6CircuitConnectionConfig *Ipv6CircuitConnectionConfig `json:"ipv6CircuitConnectionConfig,omitempty"` + // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitConnectionPropertiesFormat. +func (erccpf ExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpf.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = erccpf.ExpressRouteCircuitPeering + } + if erccpf.PeerExpressRouteCircuitPeering != nil { + objectMap["peerExpressRouteCircuitPeering"] = erccpf.PeerExpressRouteCircuitPeering + } + if erccpf.AddressPrefix != nil { + objectMap["addressPrefix"] = erccpf.AddressPrefix + } + if erccpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = erccpf.AuthorizationKey + } + if erccpf.Ipv6CircuitConnectionConfig != nil { + objectMap["ipv6CircuitConnectionConfig"] = erccpf.Ipv6CircuitConnectionConfig + } + if erccpf.CircuitConnectionStatus != "" { + objectMap["circuitConnectionStatus"] = erccpf.CircuitConnectionStatus + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitConnectionsClient) (ExpressRouteCircuitConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) result(client ExpressRouteCircuitConnectionsClient) (ercc ExpressRouteCircuitConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { + ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitConnectionsDeleteFuture.Result. +func (future *ExpressRouteCircuitConnectionsDeleteFuture) result(client ExpressRouteCircuitConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitListResult response for ListExpressRouteCircuit API service call. +type ExpressRouteCircuitListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteCircuits in a resource group. + Value *[]ExpressRouteCircuit `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitListResultIterator provides access to a complete listing of ExpressRouteCircuit +// values. +type ExpressRouteCircuitListResultIterator struct { + i int + page ExpressRouteCircuitListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitListResultIterator) Response() ExpressRouteCircuitListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitListResultIterator) Value() ExpressRouteCircuit { + if !iter.page.NotDone() { + return ExpressRouteCircuit{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitListResultIterator type. +func NewExpressRouteCircuitListResultIterator(page ExpressRouteCircuitListResultPage) ExpressRouteCircuitListResultIterator { + return ExpressRouteCircuitListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erclr ExpressRouteCircuitListResult) IsEmpty() bool { + return erclr.Value == nil || len(*erclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erclr ExpressRouteCircuitListResult) hasNextLink() bool { + return erclr.NextLink != nil && len(*erclr.NextLink) != 0 +} + +// expressRouteCircuitListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erclr ExpressRouteCircuitListResult) expressRouteCircuitListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erclr.NextLink))) +} + +// ExpressRouteCircuitListResultPage contains a page of ExpressRouteCircuit values. +type ExpressRouteCircuitListResultPage struct { + fn func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error) + erclr ExpressRouteCircuitListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erclr) + if err != nil { + return err + } + page.erclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitListResultPage) NotDone() bool { + return !page.erclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitListResultPage) Response() ExpressRouteCircuitListResult { + return page.erclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitListResultPage) Values() []ExpressRouteCircuit { + if page.erclr.IsEmpty() { + return nil + } + return *page.erclr.Value +} + +// Creates a new instance of the ExpressRouteCircuitListResultPage type. +func NewExpressRouteCircuitListResultPage(cur ExpressRouteCircuitListResult, getNextPage func(context.Context, ExpressRouteCircuitListResult) (ExpressRouteCircuitListResult, error)) ExpressRouteCircuitListResultPage { + return ExpressRouteCircuitListResultPage{ + fn: getNextPage, + erclr: cur, + } +} + +// ExpressRouteCircuitPeering peering in an ExpressRouteCircuit resource. +type ExpressRouteCircuitPeering struct { + autorest.Response `json:"-"` + // ExpressRouteCircuitPeeringPropertiesFormat - Properties of the express route circuit peering. + *ExpressRouteCircuitPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeering. +func (ercp ExpressRouteCircuitPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercp.ExpressRouteCircuitPeeringPropertiesFormat != nil { + objectMap["properties"] = ercp.ExpressRouteCircuitPeeringPropertiesFormat + } + if ercp.Name != nil { + objectMap["name"] = ercp.Name + } + if ercp.ID != nil { + objectMap["id"] = ercp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCircuitPeering struct. +func (ercp *ExpressRouteCircuitPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCircuitPeeringPropertiesFormat ExpressRouteCircuitPeeringPropertiesFormat + err = json.Unmarshal(*v, &expressRouteCircuitPeeringPropertiesFormat) + if err != nil { + return err + } + ercp.ExpressRouteCircuitPeeringPropertiesFormat = &expressRouteCircuitPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercp.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCircuitPeeringConfig specifies the peering configuration. +type ExpressRouteCircuitPeeringConfig struct { + // AdvertisedPublicPrefixes - The reference to AdvertisedPublicPrefixes. + AdvertisedPublicPrefixes *[]string `json:"advertisedPublicPrefixes,omitempty"` + // AdvertisedCommunities - The communities of bgp peering. Specified for microsoft peering. + AdvertisedCommunities *[]string `json:"advertisedCommunities,omitempty"` + // AdvertisedPublicPrefixesState - READ-ONLY; The advertised public prefix state of the Peering resource. Possible values include: 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateNotConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfiguring', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateConfigured', 'ExpressRouteCircuitPeeringAdvertisedPublicPrefixStateValidationNeeded' + AdvertisedPublicPrefixesState ExpressRouteCircuitPeeringAdvertisedPublicPrefixState `json:"advertisedPublicPrefixesState,omitempty"` + // LegacyMode - The legacy mode of the peering. + LegacyMode *int32 `json:"legacyMode,omitempty"` + // CustomerASN - The CustomerASN of the peering. + CustomerASN *int32 `json:"customerASN,omitempty"` + // RoutingRegistryName - The RoutingRegistryName of the configuration. + RoutingRegistryName *string `json:"routingRegistryName,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringConfig. +func (ercpc ExpressRouteCircuitPeeringConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercpc.AdvertisedPublicPrefixes != nil { + objectMap["advertisedPublicPrefixes"] = ercpc.AdvertisedPublicPrefixes + } + if ercpc.AdvertisedCommunities != nil { + objectMap["advertisedCommunities"] = ercpc.AdvertisedCommunities + } + if ercpc.LegacyMode != nil { + objectMap["legacyMode"] = ercpc.LegacyMode + } + if ercpc.CustomerASN != nil { + objectMap["customerASN"] = ercpc.CustomerASN + } + if ercpc.RoutingRegistryName != nil { + objectMap["routingRegistryName"] = ercpc.RoutingRegistryName + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitPeeringID expressRoute circuit peering identifier. +type ExpressRouteCircuitPeeringID struct { + // ID - The ID of the ExpressRoute circuit peering. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitPeeringListResult response for ListPeering API service call retrieves all peerings +// that belong to an ExpressRouteCircuit. +type ExpressRouteCircuitPeeringListResult struct { + autorest.Response `json:"-"` + // Value - The peerings in an express route circuit. + Value *[]ExpressRouteCircuitPeering `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitPeeringListResultIterator provides access to a complete listing of +// ExpressRouteCircuitPeering values. +type ExpressRouteCircuitPeeringListResultIterator struct { + i int + page ExpressRouteCircuitPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCircuitPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCircuitPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCircuitPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCircuitPeeringListResultIterator) Response() ExpressRouteCircuitPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCircuitPeeringListResultIterator) Value() ExpressRouteCircuitPeering { + if !iter.page.NotDone() { + return ExpressRouteCircuitPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCircuitPeeringListResultIterator type. +func NewExpressRouteCircuitPeeringListResultIterator(page ExpressRouteCircuitPeeringListResultPage) ExpressRouteCircuitPeeringListResultIterator { + return ExpressRouteCircuitPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercplr ExpressRouteCircuitPeeringListResult) IsEmpty() bool { + return ercplr.Value == nil || len(*ercplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercplr ExpressRouteCircuitPeeringListResult) hasNextLink() bool { + return ercplr.NextLink != nil && len(*ercplr.NextLink) != 0 +} + +// expressRouteCircuitPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercplr ExpressRouteCircuitPeeringListResult) expressRouteCircuitPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercplr.NextLink))) +} + +// ExpressRouteCircuitPeeringListResultPage contains a page of ExpressRouteCircuitPeering values. +type ExpressRouteCircuitPeeringListResultPage struct { + fn func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error) + ercplr ExpressRouteCircuitPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCircuitPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCircuitPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercplr) + if err != nil { + return err + } + page.ercplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCircuitPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCircuitPeeringListResultPage) NotDone() bool { + return !page.ercplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCircuitPeeringListResultPage) Response() ExpressRouteCircuitPeeringListResult { + return page.ercplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCircuitPeeringListResultPage) Values() []ExpressRouteCircuitPeering { + if page.ercplr.IsEmpty() { + return nil + } + return *page.ercplr.Value +} + +// Creates a new instance of the ExpressRouteCircuitPeeringListResultPage type. +func NewExpressRouteCircuitPeeringListResultPage(cur ExpressRouteCircuitPeeringListResult, getNextPage func(context.Context, ExpressRouteCircuitPeeringListResult) (ExpressRouteCircuitPeeringListResult, error)) ExpressRouteCircuitPeeringListResultPage { + return ExpressRouteCircuitPeeringListResultPage{ + fn: getNextPage, + ercplr: cur, + } +} + +// ExpressRouteCircuitPeeringPropertiesFormat properties of the express route circuit peering. +type ExpressRouteCircuitPeeringPropertiesFormat struct { + // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' + PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` + // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' + State ExpressRoutePeeringState `json:"state,omitempty"` + // AzureASN - The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty"` + // PeerASN - The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // PrimaryAzurePort - The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // SharedKey - The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // VlanID - The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // Stats - The peering stats of express route circuit. + Stats *ExpressRouteCircuitStats `json:"stats,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // RouteFilter - The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + // Ipv6PeeringConfig - The IPv6 peering configuration. + Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` + // ExpressRouteConnection - The ExpressRoute connection. + ExpressRouteConnection *ExpressRouteConnectionID `json:"expressRouteConnection,omitempty"` + // Connections - The list of circuit connections associated with Azure Private Peering for this circuit. + Connections *[]ExpressRouteCircuitConnection `json:"connections,omitempty"` + // PeeredConnections - READ-ONLY; The list of peered circuit connections associated with Azure Private Peering for this circuit. + PeeredConnections *[]PeerExpressRouteCircuitConnection `json:"peeredConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPeeringPropertiesFormat. +func (ercppf ExpressRouteCircuitPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercppf.PeeringType != "" { + objectMap["peeringType"] = ercppf.PeeringType + } + if ercppf.State != "" { + objectMap["state"] = ercppf.State + } + if ercppf.AzureASN != nil { + objectMap["azureASN"] = ercppf.AzureASN + } + if ercppf.PeerASN != nil { + objectMap["peerASN"] = ercppf.PeerASN + } + if ercppf.PrimaryPeerAddressPrefix != nil { + objectMap["primaryPeerAddressPrefix"] = ercppf.PrimaryPeerAddressPrefix + } + if ercppf.SecondaryPeerAddressPrefix != nil { + objectMap["secondaryPeerAddressPrefix"] = ercppf.SecondaryPeerAddressPrefix + } + if ercppf.PrimaryAzurePort != nil { + objectMap["primaryAzurePort"] = ercppf.PrimaryAzurePort + } + if ercppf.SecondaryAzurePort != nil { + objectMap["secondaryAzurePort"] = ercppf.SecondaryAzurePort + } + if ercppf.SharedKey != nil { + objectMap["sharedKey"] = ercppf.SharedKey + } + if ercppf.VlanID != nil { + objectMap["vlanId"] = ercppf.VlanID + } + if ercppf.MicrosoftPeeringConfig != nil { + objectMap["microsoftPeeringConfig"] = ercppf.MicrosoftPeeringConfig + } + if ercppf.Stats != nil { + objectMap["stats"] = ercppf.Stats + } + if ercppf.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = ercppf.GatewayManagerEtag + } + if ercppf.RouteFilter != nil { + objectMap["routeFilter"] = ercppf.RouteFilter + } + if ercppf.Ipv6PeeringConfig != nil { + objectMap["ipv6PeeringConfig"] = ercppf.Ipv6PeeringConfig + } + if ercppf.ExpressRouteConnection != nil { + objectMap["expressRouteConnection"] = ercppf.ExpressRouteConnection + } + if ercppf.Connections != nil { + objectMap["connections"] = ercppf.Connections + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCircuitPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitPeeringsClient) (ExpressRouteCircuitPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitPeeringsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent { + ercp, err = client.CreateOrUpdateResponder(ercp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture", "Result", ercp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitPeeringsDeleteFuture.Result. +func (future *ExpressRouteCircuitPeeringsDeleteFuture) result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitPropertiesFormat properties of ExpressRouteCircuit. +type ExpressRouteCircuitPropertiesFormat struct { + // AllowClassicOperations - Allow classic operations. + AllowClassicOperations *bool `json:"allowClassicOperations,omitempty"` + // CircuitProvisioningState - The CircuitProvisioningState state of the resource. + CircuitProvisioningState *string `json:"circuitProvisioningState,omitempty"` + // ServiceProviderProvisioningState - The ServiceProviderProvisioningState state of the resource. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' + ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + // Authorizations - The list of authorizations. + Authorizations *[]ExpressRouteCircuitAuthorization `json:"authorizations,omitempty"` + // Peerings - The list of peerings. + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + // ServiceKey - The ServiceKey. + ServiceKey *string `json:"serviceKey,omitempty"` + // ServiceProviderNotes - The ServiceProviderNotes. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + // ServiceProviderProperties - The ServiceProviderProperties. + ServiceProviderProperties *ExpressRouteCircuitServiceProviderProperties `json:"serviceProviderProperties,omitempty"` + // ExpressRoutePort - The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. + ExpressRoutePort *SubResource `json:"expressRoutePort,omitempty"` + // BandwidthInGbps - The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. + BandwidthInGbps *float64 `json:"bandwidthInGbps,omitempty"` + // Stag - READ-ONLY; The identifier of the circuit traffic. Outer tag for QinQ encapsulation. + Stag *int32 `json:"stag,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route circuit resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // GlobalReachEnabled - Flag denoting global reach status. + GlobalReachEnabled *bool `json:"globalReachEnabled,omitempty"` + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCircuitPropertiesFormat. +func (ercpf ExpressRouteCircuitPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercpf.AllowClassicOperations != nil { + objectMap["allowClassicOperations"] = ercpf.AllowClassicOperations + } + if ercpf.CircuitProvisioningState != nil { + objectMap["circuitProvisioningState"] = ercpf.CircuitProvisioningState + } + if ercpf.ServiceProviderProvisioningState != "" { + objectMap["serviceProviderProvisioningState"] = ercpf.ServiceProviderProvisioningState + } + if ercpf.Authorizations != nil { + objectMap["authorizations"] = ercpf.Authorizations + } + if ercpf.Peerings != nil { + objectMap["peerings"] = ercpf.Peerings + } + if ercpf.ServiceKey != nil { + objectMap["serviceKey"] = ercpf.ServiceKey + } + if ercpf.ServiceProviderNotes != nil { + objectMap["serviceProviderNotes"] = ercpf.ServiceProviderNotes + } + if ercpf.ServiceProviderProperties != nil { + objectMap["serviceProviderProperties"] = ercpf.ServiceProviderProperties + } + if ercpf.ExpressRoutePort != nil { + objectMap["expressRoutePort"] = ercpf.ExpressRoutePort + } + if ercpf.BandwidthInGbps != nil { + objectMap["bandwidthInGbps"] = ercpf.BandwidthInGbps + } + if ercpf.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = ercpf.GatewayManagerEtag + } + if ercpf.GlobalReachEnabled != nil { + objectMap["globalReachEnabled"] = ercpf.GlobalReachEnabled + } + if ercpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = ercpf.AuthorizationKey + } + return json.Marshal(objectMap) +} + +// ExpressRouteCircuitReference reference to an express route circuit. +type ExpressRouteCircuitReference struct { + // ID - Corresponding Express Route Circuit Id. + ID *string `json:"id,omitempty"` +} + +// ExpressRouteCircuitRoutesTable the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTable struct { + // NetworkProperty - IP address of a network entity. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - NextHop address. + NextHop *string `json:"nextHop,omitempty"` + // LocPrf - Local preference value as set with the set local-preference route-map configuration command. + LocPrf *string `json:"locPrf,omitempty"` + // Weight - Route Weight. + Weight *int32 `json:"weight,omitempty"` + // Path - Autonomous system paths to the destination network. + Path *string `json:"path,omitempty"` +} + +// ExpressRouteCircuitRoutesTableSummary the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCircuitRoutesTableSummary struct { + // Neighbor - IP address of the neighbor. + Neighbor *string `json:"neighbor,omitempty"` + // V - BGP version number spoken to the neighbor. + V *int32 `json:"v,omitempty"` + // As - Autonomous system number. + As *int32 `json:"as,omitempty"` + // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. + UpDown *string `json:"upDown,omitempty"` + // StatePfxRcd - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StatePfxRcd *string `json:"statePfxRcd,omitempty"` +} + +// ExpressRouteCircuitsArpTableListResult response for ListArpTable associated with the Express Route +// Circuits API. +type ExpressRouteCircuitsArpTableListResult struct { + autorest.Response `json:"-"` + // Value - A list of the ARP tables. + Value *[]ExpressRouteCircuitArpTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuit, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCircuitsCreateOrUpdateFuture) result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.CreateOrUpdateResponder(erc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsDeleteFuture.Result. +func (future *ExpressRouteCircuitsDeleteFuture) result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCircuitServiceProviderProperties contains ServiceProviderProperties in an +// ExpressRouteCircuit. +type ExpressRouteCircuitServiceProviderProperties struct { + // ServiceProviderName - The serviceProviderName. + ServiceProviderName *string `json:"serviceProviderName,omitempty"` + // PeeringLocation - The peering location. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInMbps - The BandwidthInMbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` +} + +// ExpressRouteCircuitSku contains SKU in an ExpressRouteCircuit. +type ExpressRouteCircuitSku struct { + // Name - The name of the SKU. + Name *string `json:"name,omitempty"` + // Tier - The tier of the SKU. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium', 'ExpressRouteCircuitSkuTierBasic', 'ExpressRouteCircuitSkuTierLocal' + Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` + // Family - The family of the SKU. Possible values include: 'ExpressRouteCircuitSkuFamilyUnlimitedData', 'ExpressRouteCircuitSkuFamilyMeteredData' + Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` +} + +// ExpressRouteCircuitsListArpTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListArpTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsArpTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListArpTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListArpTableFuture.Result. +func (future *ExpressRouteCircuitsListArpTableFuture) result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercatlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListArpTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { + ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsListRoutesTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteCircuitsListRoutesTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListRoutesTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListRoutesTableFuture.Result. +func (future *ExpressRouteCircuitsListRoutesTableFuture) result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { + ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCircuitsListRoutesTableSummaryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCircuitsClient) (ExpressRouteCircuitsRoutesTableSummaryListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCircuitsListRoutesTableSummaryFuture.Result. +func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCircuitsListRoutesTableSummaryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtslr.Response.Response, err = future.GetResult(sender); err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent { + ercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsListRoutesTableSummaryFuture", "Result", ercrtslr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCircuitsRoutesTableListResult response for ListRoutesTable associated with the Express Route +// Circuits API. +type ExpressRouteCircuitsRoutesTableListResult struct { + autorest.Response `json:"-"` + // Value - The list of routes table. + Value *[]ExpressRouteCircuitRoutesTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitsRoutesTableSummaryListResult response for ListRoutesTable associated with the +// Express Route Circuits API. +type ExpressRouteCircuitsRoutesTableSummaryListResult struct { + autorest.Response `json:"-"` + // Value - A list of the routes table. + Value *[]ExpressRouteCircuitRoutesTableSummary `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteCircuitStats contains stats associated with the peering. +type ExpressRouteCircuitStats struct { + autorest.Response `json:"-"` + // PrimarybytesIn - The Primary BytesIn of the peering. + PrimarybytesIn *int64 `json:"primarybytesIn,omitempty"` + // PrimarybytesOut - The primary BytesOut of the peering. + PrimarybytesOut *int64 `json:"primarybytesOut,omitempty"` + // SecondarybytesIn - The secondary BytesIn of the peering. + SecondarybytesIn *int64 `json:"secondarybytesIn,omitempty"` + // SecondarybytesOut - The secondary BytesOut of the peering. + SecondarybytesOut *int64 `json:"secondarybytesOut,omitempty"` +} + +// ExpressRouteConnection expressRouteConnection resource. +type ExpressRouteConnection struct { + autorest.Response `json:"-"` + // ExpressRouteConnectionProperties - Properties of the express route connection. + *ExpressRouteConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource. + Name *string `json:"name,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnection. +func (erc ExpressRouteConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erc.ExpressRouteConnectionProperties != nil { + objectMap["properties"] = erc.ExpressRouteConnectionProperties + } + if erc.Name != nil { + objectMap["name"] = erc.Name + } + if erc.ID != nil { + objectMap["id"] = erc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteConnection struct. +func (erc *ExpressRouteConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteConnectionProperties ExpressRouteConnectionProperties + err = json.Unmarshal(*v, &expressRouteConnectionProperties) + if err != nil { + return err + } + erc.ExpressRouteConnectionProperties = &expressRouteConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erc.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erc.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteConnectionID the ID of the ExpressRouteConnection. +type ExpressRouteConnectionID struct { + // ID - READ-ONLY; The ID of the ExpressRouteConnection. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnectionID. +func (erci ExpressRouteConnectionID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRouteConnectionList expressRouteConnection list. +type ExpressRouteConnectionList struct { + autorest.Response `json:"-"` + // Value - The list of ExpressRoute connections. + Value *[]ExpressRouteConnection `json:"value,omitempty"` +} + +// ExpressRouteConnectionProperties properties of the ExpressRouteConnection subresource. +type ExpressRouteConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the express route connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteCircuitPeering - The ExpressRoute circuit peering. + ExpressRouteCircuitPeering *ExpressRouteCircuitPeeringID `json:"expressRouteCircuitPeering,omitempty"` + // AuthorizationKey - Authorization key to establish the connection. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // RoutingWeight - The routing weight associated to the connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // ExpressRouteGatewayBypass - Enable FastPath to vWan Firewall hub. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteConnectionProperties. +func (ercp ExpressRouteConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercp.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = ercp.ExpressRouteCircuitPeering + } + if ercp.AuthorizationKey != nil { + objectMap["authorizationKey"] = ercp.AuthorizationKey + } + if ercp.RoutingWeight != nil { + objectMap["routingWeight"] = ercp.RoutingWeight + } + if ercp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = ercp.EnableInternetSecurity + } + if ercp.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = ercp.ExpressRouteGatewayBypass + } + if ercp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = ercp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// ExpressRouteConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ExpressRouteConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteConnectionsClient) (ExpressRouteConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteConnectionsCreateOrUpdateFuture) result(client ExpressRouteConnectionsClient) (erc ExpressRouteConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent { + erc, err = client.CreateOrUpdateResponder(erc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsCreateOrUpdateFuture", "Result", erc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteConnectionsDeleteFuture.Result. +func (future *ExpressRouteConnectionsDeleteFuture) result(client ExpressRouteConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCrossConnection expressRouteCrossConnection resource. +type ExpressRouteCrossConnection struct { + autorest.Response `json:"-"` + // ExpressRouteCrossConnectionProperties - Properties of the express route cross connection. + *ExpressRouteCrossConnectionProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnection. +func (ercc ExpressRouteCrossConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercc.ExpressRouteCrossConnectionProperties != nil { + objectMap["properties"] = ercc.ExpressRouteCrossConnectionProperties + } + if ercc.ID != nil { + objectMap["id"] = ercc.ID + } + if ercc.Location != nil { + objectMap["location"] = ercc.Location + } + if ercc.Tags != nil { + objectMap["tags"] = ercc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnection struct. +func (ercc *ExpressRouteCrossConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCrossConnectionProperties ExpressRouteCrossConnectionProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionProperties) + if err != nil { + return err + } + ercc.ExpressRouteCrossConnectionProperties = &expressRouteCrossConnectionProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ercc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ercc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ercc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ercc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ercc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ercc.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteCrossConnectionListResult response for ListExpressRouteCrossConnection API service call. +type ExpressRouteCrossConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteCrossConnection resources. + Value *[]ExpressRouteCrossConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionListResult. +func (ercclr ExpressRouteCrossConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ercclr.Value != nil { + objectMap["value"] = ercclr.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionListResultIterator provides access to a complete listing of +// ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultIterator struct { + i int + page ExpressRouteCrossConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCrossConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCrossConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCrossConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCrossConnectionListResultIterator) Response() ExpressRouteCrossConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCrossConnectionListResultIterator) Value() ExpressRouteCrossConnection { + if !iter.page.NotDone() { + return ExpressRouteCrossConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCrossConnectionListResultIterator type. +func NewExpressRouteCrossConnectionListResultIterator(page ExpressRouteCrossConnectionListResultPage) ExpressRouteCrossConnectionListResultIterator { + return ExpressRouteCrossConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ercclr ExpressRouteCrossConnectionListResult) IsEmpty() bool { + return ercclr.Value == nil || len(*ercclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ercclr ExpressRouteCrossConnectionListResult) hasNextLink() bool { + return ercclr.NextLink != nil && len(*ercclr.NextLink) != 0 +} + +// expressRouteCrossConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ercclr ExpressRouteCrossConnectionListResult) expressRouteCrossConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ercclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ercclr.NextLink))) +} + +// ExpressRouteCrossConnectionListResultPage contains a page of ExpressRouteCrossConnection values. +type ExpressRouteCrossConnectionListResultPage struct { + fn func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error) + ercclr ExpressRouteCrossConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCrossConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ercclr) + if err != nil { + return err + } + page.ercclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCrossConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCrossConnectionListResultPage) NotDone() bool { + return !page.ercclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCrossConnectionListResultPage) Response() ExpressRouteCrossConnectionListResult { + return page.ercclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCrossConnectionListResultPage) Values() []ExpressRouteCrossConnection { + if page.ercclr.IsEmpty() { + return nil + } + return *page.ercclr.Value +} + +// Creates a new instance of the ExpressRouteCrossConnectionListResultPage type. +func NewExpressRouteCrossConnectionListResultPage(cur ExpressRouteCrossConnectionListResult, getNextPage func(context.Context, ExpressRouteCrossConnectionListResult) (ExpressRouteCrossConnectionListResult, error)) ExpressRouteCrossConnectionListResultPage { + return ExpressRouteCrossConnectionListResultPage{ + fn: getNextPage, + ercclr: cur, + } +} + +// ExpressRouteCrossConnectionPeering peering in an ExpressRoute Cross Connection resource. +type ExpressRouteCrossConnectionPeering struct { + autorest.Response `json:"-"` + // ExpressRouteCrossConnectionPeeringProperties - Properties of the express route cross connection peering. + *ExpressRouteCrossConnectionPeeringProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeering. +func (erccp ExpressRouteCrossConnectionPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccp.ExpressRouteCrossConnectionPeeringProperties != nil { + objectMap["properties"] = erccp.ExpressRouteCrossConnectionPeeringProperties + } + if erccp.Name != nil { + objectMap["name"] = erccp.Name + } + if erccp.ID != nil { + objectMap["id"] = erccp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteCrossConnectionPeering struct. +func (erccp *ExpressRouteCrossConnectionPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteCrossConnectionPeeringProperties ExpressRouteCrossConnectionPeeringProperties + err = json.Unmarshal(*v, &expressRouteCrossConnectionPeeringProperties) + if err != nil { + return err + } + erccp.ExpressRouteCrossConnectionPeeringProperties = &expressRouteCrossConnectionPeeringProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erccp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erccp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erccp.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteCrossConnectionPeeringList response for ListPeering API service call retrieves all peerings +// that belong to an ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionPeeringList struct { + autorest.Response `json:"-"` + // Value - The peerings in an express route cross connection. + Value *[]ExpressRouteCrossConnectionPeering `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringList. +func (erccpl ExpressRouteCrossConnectionPeeringList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpl.Value != nil { + objectMap["value"] = erccpl.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionPeeringListIterator provides access to a complete listing of +// ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListIterator struct { + i int + page ExpressRouteCrossConnectionPeeringListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteCrossConnectionPeeringListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteCrossConnectionPeeringListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteCrossConnectionPeeringListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteCrossConnectionPeeringListIterator) Response() ExpressRouteCrossConnectionPeeringList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteCrossConnectionPeeringListIterator) Value() ExpressRouteCrossConnectionPeering { + if !iter.page.NotDone() { + return ExpressRouteCrossConnectionPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteCrossConnectionPeeringListIterator type. +func NewExpressRouteCrossConnectionPeeringListIterator(page ExpressRouteCrossConnectionPeeringListPage) ExpressRouteCrossConnectionPeeringListIterator { + return ExpressRouteCrossConnectionPeeringListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erccpl ExpressRouteCrossConnectionPeeringList) IsEmpty() bool { + return erccpl.Value == nil || len(*erccpl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erccpl ExpressRouteCrossConnectionPeeringList) hasNextLink() bool { + return erccpl.NextLink != nil && len(*erccpl.NextLink) != 0 +} + +// expressRouteCrossConnectionPeeringListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erccpl ExpressRouteCrossConnectionPeeringList) expressRouteCrossConnectionPeeringListPreparer(ctx context.Context) (*http.Request, error) { + if !erccpl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erccpl.NextLink))) +} + +// ExpressRouteCrossConnectionPeeringListPage contains a page of ExpressRouteCrossConnectionPeering values. +type ExpressRouteCrossConnectionPeeringListPage struct { + fn func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error) + erccpl ExpressRouteCrossConnectionPeeringList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteCrossConnectionPeeringListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionPeeringListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erccpl) + if err != nil { + return err + } + page.erccpl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteCrossConnectionPeeringListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteCrossConnectionPeeringListPage) NotDone() bool { + return !page.erccpl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteCrossConnectionPeeringListPage) Response() ExpressRouteCrossConnectionPeeringList { + return page.erccpl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteCrossConnectionPeeringListPage) Values() []ExpressRouteCrossConnectionPeering { + if page.erccpl.IsEmpty() { + return nil + } + return *page.erccpl.Value +} + +// Creates a new instance of the ExpressRouteCrossConnectionPeeringListPage type. +func NewExpressRouteCrossConnectionPeeringListPage(cur ExpressRouteCrossConnectionPeeringList, getNextPage func(context.Context, ExpressRouteCrossConnectionPeeringList) (ExpressRouteCrossConnectionPeeringList, error)) ExpressRouteCrossConnectionPeeringListPage { + return ExpressRouteCrossConnectionPeeringListPage{ + fn: getNextPage, + erccpl: cur, + } +} + +// ExpressRouteCrossConnectionPeeringProperties properties of express route cross connection peering. +type ExpressRouteCrossConnectionPeeringProperties struct { + // PeeringType - The peering type. Possible values include: 'ExpressRoutePeeringTypeAzurePublicPeering', 'ExpressRoutePeeringTypeAzurePrivatePeering', 'ExpressRoutePeeringTypeMicrosoftPeering' + PeeringType ExpressRoutePeeringType `json:"peeringType,omitempty"` + // State - The peering state. Possible values include: 'ExpressRoutePeeringStateDisabled', 'ExpressRoutePeeringStateEnabled' + State ExpressRoutePeeringState `json:"state,omitempty"` + // AzureASN - READ-ONLY; The Azure ASN. + AzureASN *int32 `json:"azureASN,omitempty"` + // PeerASN - The peer ASN. + PeerASN *int64 `json:"peerASN,omitempty"` + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // PrimaryAzurePort - READ-ONLY; The primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - READ-ONLY; The secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // SharedKey - The shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // VlanID - The VLAN ID. + VlanID *int32 `json:"vlanId,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // GatewayManagerEtag - The GatewayManager Etag. + GatewayManagerEtag *string `json:"gatewayManagerEtag,omitempty"` + // LastModifiedBy - READ-ONLY; Who was the last to modify the peering. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Ipv6PeeringConfig - The IPv6 peering configuration. + Ipv6PeeringConfig *Ipv6ExpressRouteCircuitPeeringConfig `json:"ipv6PeeringConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionPeeringProperties. +func (erccpp ExpressRouteCrossConnectionPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccpp.PeeringType != "" { + objectMap["peeringType"] = erccpp.PeeringType + } + if erccpp.State != "" { + objectMap["state"] = erccpp.State + } + if erccpp.PeerASN != nil { + objectMap["peerASN"] = erccpp.PeerASN + } + if erccpp.PrimaryPeerAddressPrefix != nil { + objectMap["primaryPeerAddressPrefix"] = erccpp.PrimaryPeerAddressPrefix + } + if erccpp.SecondaryPeerAddressPrefix != nil { + objectMap["secondaryPeerAddressPrefix"] = erccpp.SecondaryPeerAddressPrefix + } + if erccpp.SharedKey != nil { + objectMap["sharedKey"] = erccpp.SharedKey + } + if erccpp.VlanID != nil { + objectMap["vlanId"] = erccpp.VlanID + } + if erccpp.MicrosoftPeeringConfig != nil { + objectMap["microsoftPeeringConfig"] = erccpp.MicrosoftPeeringConfig + } + if erccpp.GatewayManagerEtag != nil { + objectMap["gatewayManagerEtag"] = erccpp.GatewayManagerEtag + } + if erccpp.Ipv6PeeringConfig != nil { + objectMap["ipv6PeeringConfig"] = erccpp.Ipv6PeeringConfig + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionPeeringsClient) (ExpressRouteCrossConnectionPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (erccp ExpressRouteCrossConnectionPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erccp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erccp.Response.Response, err = future.GetResult(sender); err == nil && erccp.Response.Response.StatusCode != http.StatusNoContent { + erccp, err = client.CreateOrUpdateResponder(erccp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture", "Result", erccp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionPeeringsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCrossConnectionPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionPeeringsDeleteFuture.Result. +func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteCrossConnectionProperties properties of ExpressRouteCrossConnection. +type ExpressRouteCrossConnectionProperties struct { + // PrimaryAzurePort - READ-ONLY; The name of the primary port. + PrimaryAzurePort *string `json:"primaryAzurePort,omitempty"` + // SecondaryAzurePort - READ-ONLY; The name of the secondary port. + SecondaryAzurePort *string `json:"secondaryAzurePort,omitempty"` + // STag - READ-ONLY; The identifier of the circuit traffic. + STag *int32 `json:"sTag,omitempty"` + // PeeringLocation - READ-ONLY; The peering location of the ExpressRoute circuit. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInMbps - READ-ONLY; The circuit bandwidth In Mbps. + BandwidthInMbps *int32 `json:"bandwidthInMbps,omitempty"` + // ExpressRouteCircuit - The ExpressRouteCircuit. + ExpressRouteCircuit *ExpressRouteCircuitReference `json:"expressRouteCircuit,omitempty"` + // ServiceProviderProvisioningState - The provisioning state of the circuit in the connectivity provider system. Possible values include: 'ServiceProviderProvisioningStateNotProvisioned', 'ServiceProviderProvisioningStateProvisioning', 'ServiceProviderProvisioningStateProvisioned', 'ServiceProviderProvisioningStateDeprovisioning' + ServiceProviderProvisioningState ServiceProviderProvisioningState `json:"serviceProviderProvisioningState,omitempty"` + // ServiceProviderNotes - Additional read only notes set by the connectivity provider. + ServiceProviderNotes *string `json:"serviceProviderNotes,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route cross connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Peerings - The list of peerings. + Peerings *[]ExpressRouteCrossConnectionPeering `json:"peerings,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionProperties. +func (erccp ExpressRouteCrossConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccp.ExpressRouteCircuit != nil { + objectMap["expressRouteCircuit"] = erccp.ExpressRouteCircuit + } + if erccp.ServiceProviderProvisioningState != "" { + objectMap["serviceProviderProvisioningState"] = erccp.ServiceProviderProvisioningState + } + if erccp.ServiceProviderNotes != nil { + objectMap["serviceProviderNotes"] = erccp.ServiceProviderNotes + } + if erccp.Peerings != nil { + objectMap["peerings"] = erccp.Peerings + } + return json.Marshal(objectMap) +} + +// ExpressRouteCrossConnectionRoutesTableSummary the routes table associated with the ExpressRouteCircuit. +type ExpressRouteCrossConnectionRoutesTableSummary struct { + // Neighbor - IP address of Neighbor router. + Neighbor *string `json:"neighbor,omitempty"` + // Asn - Autonomous system number. + Asn *int32 `json:"asn,omitempty"` + // UpDown - The length of time that the BGP session has been in the Established state, or the current status if not in the Established state. + UpDown *string `json:"upDown,omitempty"` + // StateOrPrefixesReceived - Current state of the BGP session, and the number of prefixes that have been received from a neighbor or peer group. + StateOrPrefixesReceived *string `json:"stateOrPrefixesReceived,omitempty"` +} + +// ExpressRouteCrossConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsCreateOrUpdateFuture.Result. +func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent { + ercc, err = client.CreateOrUpdateResponder(ercc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsCreateOrUpdateFuture", "Result", ercc.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListArpTableFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ExpressRouteCrossConnectionsListArpTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsArpTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListArpTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListArpTableFuture.Result. +func (future *ExpressRouteCrossConnectionsListArpTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercatlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListArpTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent { + ercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListArpTableFuture", "Result", ercatlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListRoutesTableFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRouteCrossConnectionsListRoutesTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCircuitsRoutesTableListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableFuture.Result. +func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ercrtlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent { + ercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableFuture", "Result", ercrtlr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsListRoutesTableSummaryFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type ExpressRouteCrossConnectionsListRoutesTableSummaryFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteCrossConnectionsClient) (ExpressRouteCrossConnectionsRoutesTableSummaryListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteCrossConnectionsListRoutesTableSummaryFuture.Result. +func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) result(client ExpressRouteCrossConnectionsClient) (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erccrtslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erccrtslr.Response.Response, err = future.GetResult(sender); err == nil && erccrtslr.Response.Response.StatusCode != http.StatusNoContent { + erccrtslr, err = client.ListRoutesTableSummaryResponder(erccrtslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture", "Result", erccrtslr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteCrossConnectionsRoutesTableSummaryListResult response for ListRoutesTable associated with +// the Express Route Cross Connections. +type ExpressRouteCrossConnectionsRoutesTableSummaryListResult struct { + autorest.Response `json:"-"` + // Value - A list of the routes table. + Value *[]ExpressRouteCrossConnectionRoutesTableSummary `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteCrossConnectionsRoutesTableSummaryListResult. +func (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erccrtslr.Value != nil { + objectMap["value"] = erccrtslr.Value + } + return json.Marshal(objectMap) +} + +// ExpressRouteGateway expressRoute gateway resource. +type ExpressRouteGateway struct { + autorest.Response `json:"-"` + // ExpressRouteGatewayProperties - Properties of the express route gateway. + *ExpressRouteGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteGateway. +func (erg ExpressRouteGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erg.ExpressRouteGatewayProperties != nil { + objectMap["properties"] = erg.ExpressRouteGatewayProperties + } + if erg.ID != nil { + objectMap["id"] = erg.ID + } + if erg.Location != nil { + objectMap["location"] = erg.Location + } + if erg.Tags != nil { + objectMap["tags"] = erg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteGateway struct. +func (erg *ExpressRouteGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteGatewayProperties ExpressRouteGatewayProperties + err = json.Unmarshal(*v, &expressRouteGatewayProperties) + if err != nil { + return err + } + erg.ExpressRouteGatewayProperties = &expressRouteGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erg.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteGatewayList list of ExpressRoute gateways. +type ExpressRouteGatewayList struct { + autorest.Response `json:"-"` + // Value - List of ExpressRoute gateways. + Value *[]ExpressRouteGateway `json:"value,omitempty"` +} + +// ExpressRouteGatewayProperties expressRoute gateway resource properties. +type ExpressRouteGatewayProperties struct { + // AutoScaleConfiguration - Configuration for auto scaling. + AutoScaleConfiguration *ExpressRouteGatewayPropertiesAutoScaleConfiguration `json:"autoScaleConfiguration,omitempty"` + // ExpressRouteConnections - List of ExpressRoute connections to the ExpressRoute gateway. + ExpressRouteConnections *[]ExpressRouteConnection `json:"expressRouteConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VirtualHub - The Virtual Hub where the ExpressRoute gateway is or will be deployed. + VirtualHub *VirtualHubID `json:"virtualHub,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteGatewayProperties. +func (ergp ExpressRouteGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ergp.AutoScaleConfiguration != nil { + objectMap["autoScaleConfiguration"] = ergp.AutoScaleConfiguration + } + if ergp.ExpressRouteConnections != nil { + objectMap["expressRouteConnections"] = ergp.ExpressRouteConnections + } + if ergp.VirtualHub != nil { + objectMap["virtualHub"] = ergp.VirtualHub + } + return json.Marshal(objectMap) +} + +// ExpressRouteGatewayPropertiesAutoScaleConfiguration configuration for auto scaling. +type ExpressRouteGatewayPropertiesAutoScaleConfiguration struct { + // Bounds - Minimum and maximum number of scale units to deploy. + Bounds *ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds `json:"bounds,omitempty"` +} + +// ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds minimum and maximum number of scale units to +// deploy. +type ExpressRouteGatewayPropertiesAutoScaleConfigurationBounds struct { + // Min - Minimum number of scale units deployed for ExpressRoute gateway. + Min *int32 `json:"min,omitempty"` + // Max - Maximum number of scale units deployed for ExpressRoute gateway. + Max *int32 `json:"max,omitempty"` +} + +// ExpressRouteGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysCreateOrUpdateFuture.Result. +func (future *ExpressRouteGatewaysCreateOrUpdateFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { + erg, err = client.CreateOrUpdateResponder(erg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysCreateOrUpdateFuture", "Result", erg.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysDeleteFuture.Result. +func (future *ExpressRouteGatewaysDeleteFuture) result(client ExpressRouteGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRouteGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRouteGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRouteGatewaysClient) (ExpressRouteGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRouteGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRouteGatewaysUpdateTagsFuture.Result. +func (future *ExpressRouteGatewaysUpdateTagsFuture) result(client ExpressRouteGatewaysClient) (erg ExpressRouteGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRouteGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erg.Response.Response, err = future.GetResult(sender); err == nil && erg.Response.Response.StatusCode != http.StatusNoContent { + erg, err = client.UpdateTagsResponder(erg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRouteGatewaysUpdateTagsFuture", "Result", erg.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRouteLink expressRouteLink child resource definition. +type ExpressRouteLink struct { + autorest.Response `json:"-"` + // ExpressRouteLinkPropertiesFormat - ExpressRouteLink properties. + *ExpressRouteLinkPropertiesFormat `json:"properties,omitempty"` + // Name - Name of child port resource that is unique among child port resources of the parent. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteLink. +func (erl ExpressRouteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erl.ExpressRouteLinkPropertiesFormat != nil { + objectMap["properties"] = erl.ExpressRouteLinkPropertiesFormat + } + if erl.Name != nil { + objectMap["name"] = erl.Name + } + if erl.ID != nil { + objectMap["id"] = erl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteLink struct. +func (erl *ExpressRouteLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteLinkPropertiesFormat ExpressRouteLinkPropertiesFormat + err = json.Unmarshal(*v, &expressRouteLinkPropertiesFormat) + if err != nil { + return err + } + erl.ExpressRouteLinkPropertiesFormat = &expressRouteLinkPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erl.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erl.ID = &ID + } + } + } + + return nil +} + +// ExpressRouteLinkListResult response for ListExpressRouteLinks API service call. +type ExpressRouteLinkListResult struct { + autorest.Response `json:"-"` + // Value - The list of ExpressRouteLink sub-resources. + Value *[]ExpressRouteLink `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteLinkListResultIterator provides access to a complete listing of ExpressRouteLink values. +type ExpressRouteLinkListResultIterator struct { + i int + page ExpressRouteLinkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteLinkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteLinkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteLinkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteLinkListResultIterator) Response() ExpressRouteLinkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteLinkListResultIterator) Value() ExpressRouteLink { + if !iter.page.NotDone() { + return ExpressRouteLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteLinkListResultIterator type. +func NewExpressRouteLinkListResultIterator(page ExpressRouteLinkListResultPage) ExpressRouteLinkListResultIterator { + return ExpressRouteLinkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erllr ExpressRouteLinkListResult) IsEmpty() bool { + return erllr.Value == nil || len(*erllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erllr ExpressRouteLinkListResult) hasNextLink() bool { + return erllr.NextLink != nil && len(*erllr.NextLink) != 0 +} + +// expressRouteLinkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erllr ExpressRouteLinkListResult) expressRouteLinkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erllr.NextLink))) +} + +// ExpressRouteLinkListResultPage contains a page of ExpressRouteLink values. +type ExpressRouteLinkListResultPage struct { + fn func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error) + erllr ExpressRouteLinkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteLinkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteLinkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erllr) + if err != nil { + return err + } + page.erllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteLinkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteLinkListResultPage) NotDone() bool { + return !page.erllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteLinkListResultPage) Response() ExpressRouteLinkListResult { + return page.erllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteLinkListResultPage) Values() []ExpressRouteLink { + if page.erllr.IsEmpty() { + return nil + } + return *page.erllr.Value +} + +// Creates a new instance of the ExpressRouteLinkListResultPage type. +func NewExpressRouteLinkListResultPage(cur ExpressRouteLinkListResult, getNextPage func(context.Context, ExpressRouteLinkListResult) (ExpressRouteLinkListResult, error)) ExpressRouteLinkListResultPage { + return ExpressRouteLinkListResultPage{ + fn: getNextPage, + erllr: cur, + } +} + +// ExpressRouteLinkMacSecConfig expressRouteLink Mac Security Configuration. +type ExpressRouteLinkMacSecConfig struct { + // CknSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CKN key. + CknSecretIdentifier *string `json:"cknSecretIdentifier,omitempty"` + // CakSecretIdentifier - Keyvault Secret Identifier URL containing Mac security CAK key. + CakSecretIdentifier *string `json:"cakSecretIdentifier,omitempty"` + // Cipher - Mac security cipher. Possible values include: 'ExpressRouteLinkMacSecCipherGcmAes256', 'ExpressRouteLinkMacSecCipherGcmAes128', 'ExpressRouteLinkMacSecCipherGcmAesXpn128', 'ExpressRouteLinkMacSecCipherGcmAesXpn256' + Cipher ExpressRouteLinkMacSecCipher `json:"cipher,omitempty"` + // SciState - Sci mode enabled/disabled. Possible values include: 'ExpressRouteLinkMacSecSciStateDisabled', 'ExpressRouteLinkMacSecSciStateEnabled' + SciState ExpressRouteLinkMacSecSciState `json:"sciState,omitempty"` +} + +// ExpressRouteLinkPropertiesFormat properties specific to ExpressRouteLink resources. +type ExpressRouteLinkPropertiesFormat struct { + // RouterName - READ-ONLY; Name of Azure router associated with physical port. + RouterName *string `json:"routerName,omitempty"` + // InterfaceName - READ-ONLY; Name of Azure router interface. + InterfaceName *string `json:"interfaceName,omitempty"` + // PatchPanelID - READ-ONLY; Mapping between physical port to patch panel port. + PatchPanelID *string `json:"patchPanelId,omitempty"` + // RackID - READ-ONLY; Mapping of physical patch panel to rack. + RackID *string `json:"rackId,omitempty"` + // ConnectorType - READ-ONLY; Physical fiber port type. Possible values include: 'ExpressRouteLinkConnectorTypeLC', 'ExpressRouteLinkConnectorTypeSC' + ConnectorType ExpressRouteLinkConnectorType `json:"connectorType,omitempty"` + // AdminState - Administrative state of the physical port. Possible values include: 'ExpressRouteLinkAdminStateEnabled', 'ExpressRouteLinkAdminStateDisabled' + AdminState ExpressRouteLinkAdminState `json:"adminState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // MacSecConfig - MacSec configuration. + MacSecConfig *ExpressRouteLinkMacSecConfig `json:"macSecConfig,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteLinkPropertiesFormat. +func (erlpf ExpressRouteLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erlpf.AdminState != "" { + objectMap["adminState"] = erlpf.AdminState + } + if erlpf.MacSecConfig != nil { + objectMap["macSecConfig"] = erlpf.MacSecConfig + } + return json.Marshal(objectMap) +} + +// ExpressRoutePort expressRoutePort resource definition. +type ExpressRoutePort struct { + autorest.Response `json:"-"` + // ExpressRoutePortPropertiesFormat - ExpressRoutePort properties. + *ExpressRoutePortPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Identity - The identity of ExpressRoutePort, if configured. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePort. +func (erp ExpressRoutePort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erp.ExpressRoutePortPropertiesFormat != nil { + objectMap["properties"] = erp.ExpressRoutePortPropertiesFormat + } + if erp.Identity != nil { + objectMap["identity"] = erp.Identity + } + if erp.ID != nil { + objectMap["id"] = erp.ID + } + if erp.Location != nil { + objectMap["location"] = erp.Location + } + if erp.Tags != nil { + objectMap["tags"] = erp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePort struct. +func (erp *ExpressRoutePort) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortPropertiesFormat ExpressRoutePortPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortPropertiesFormat) + if err != nil { + return err + } + erp.ExpressRoutePortPropertiesFormat = &expressRoutePortPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erp.Etag = &etag + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + erp.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erp.Tags = tags + } + } + } + + return nil +} + +// ExpressRoutePortAuthorization expressRoutePort Authorization resource definition. +type ExpressRoutePortAuthorization struct { + autorest.Response `json:"-"` + // ExpressRoutePortAuthorizationPropertiesFormat - ExpressRoutePort properties. + *ExpressRoutePortAuthorizationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorization. +func (erpa ExpressRoutePortAuthorization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpa.ExpressRoutePortAuthorizationPropertiesFormat != nil { + objectMap["properties"] = erpa.ExpressRoutePortAuthorizationPropertiesFormat + } + if erpa.Name != nil { + objectMap["name"] = erpa.Name + } + if erpa.ID != nil { + objectMap["id"] = erpa.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortAuthorization struct. +func (erpa *ExpressRoutePortAuthorization) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortAuthorizationPropertiesFormat ExpressRoutePortAuthorizationPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortAuthorizationPropertiesFormat) + if err != nil { + return err + } + erpa.ExpressRoutePortAuthorizationPropertiesFormat = &expressRoutePortAuthorizationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erpa.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + erpa.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erpa.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erpa.ID = &ID + } + } + } + + return nil +} + +// ExpressRoutePortAuthorizationListResult response for ListExpressRoutePortAuthorizations API service +// call. +type ExpressRoutePortAuthorizationListResult struct { + autorest.Response `json:"-"` + // Value - The authorizations in an ExpressRoute Port. + Value *[]ExpressRoutePortAuthorization `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortAuthorizationListResultIterator provides access to a complete listing of +// ExpressRoutePortAuthorization values. +type ExpressRoutePortAuthorizationListResultIterator struct { + i int + page ExpressRoutePortAuthorizationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortAuthorizationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortAuthorizationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortAuthorizationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortAuthorizationListResultIterator) Response() ExpressRoutePortAuthorizationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortAuthorizationListResultIterator) Value() ExpressRoutePortAuthorization { + if !iter.page.NotDone() { + return ExpressRoutePortAuthorization{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortAuthorizationListResultIterator type. +func NewExpressRoutePortAuthorizationListResultIterator(page ExpressRoutePortAuthorizationListResultPage) ExpressRoutePortAuthorizationListResultIterator { + return ExpressRoutePortAuthorizationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erpalr ExpressRoutePortAuthorizationListResult) IsEmpty() bool { + return erpalr.Value == nil || len(*erpalr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erpalr ExpressRoutePortAuthorizationListResult) hasNextLink() bool { + return erpalr.NextLink != nil && len(*erpalr.NextLink) != 0 +} + +// expressRoutePortAuthorizationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erpalr ExpressRoutePortAuthorizationListResult) expressRoutePortAuthorizationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erpalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erpalr.NextLink))) +} + +// ExpressRoutePortAuthorizationListResultPage contains a page of ExpressRoutePortAuthorization values. +type ExpressRoutePortAuthorizationListResultPage struct { + fn func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error) + erpalr ExpressRoutePortAuthorizationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortAuthorizationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortAuthorizationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erpalr) + if err != nil { + return err + } + page.erpalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortAuthorizationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortAuthorizationListResultPage) NotDone() bool { + return !page.erpalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortAuthorizationListResultPage) Response() ExpressRoutePortAuthorizationListResult { + return page.erpalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortAuthorizationListResultPage) Values() []ExpressRoutePortAuthorization { + if page.erpalr.IsEmpty() { + return nil + } + return *page.erpalr.Value +} + +// Creates a new instance of the ExpressRoutePortAuthorizationListResultPage type. +func NewExpressRoutePortAuthorizationListResultPage(cur ExpressRoutePortAuthorizationListResult, getNextPage func(context.Context, ExpressRoutePortAuthorizationListResult) (ExpressRoutePortAuthorizationListResult, error)) ExpressRoutePortAuthorizationListResultPage { + return ExpressRoutePortAuthorizationListResultPage{ + fn: getNextPage, + erpalr: cur, + } +} + +// ExpressRoutePortAuthorizationPropertiesFormat properties of ExpressRoutePort Authorization. +type ExpressRoutePortAuthorizationPropertiesFormat struct { + // AuthorizationKey - READ-ONLY; The authorization key. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // AuthorizationUseStatus - READ-ONLY; The authorization use status. Possible values include: 'ExpressRoutePortAuthorizationUseStatusAvailable', 'ExpressRoutePortAuthorizationUseStatusInUse' + AuthorizationUseStatus ExpressRoutePortAuthorizationUseStatus `json:"authorizationUseStatus,omitempty"` + // CircuitResourceURI - READ-ONLY; The reference to the ExpressRoute circuit resource using the authorization. + CircuitResourceURI *string `json:"circuitResourceUri,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the authorization resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortAuthorizationPropertiesFormat. +func (erpapf ExpressRoutePortAuthorizationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRoutePortAuthorizationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ExpressRoutePortAuthorizationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortAuthorizationsClient) (ExpressRoutePortAuthorization, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortAuthorizationsCreateOrUpdateFuture.Result. +func (future *ExpressRoutePortAuthorizationsCreateOrUpdateFuture) result(client ExpressRoutePortAuthorizationsClient) (erpa ExpressRoutePortAuthorization, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erpa.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erpa.Response.Response, err = future.GetResult(sender); err == nil && erpa.Response.Response.StatusCode != http.StatusNoContent { + erpa, err = client.CreateOrUpdateResponder(erpa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture", "Result", erpa.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRoutePortAuthorizationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRoutePortAuthorizationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortAuthorizationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortAuthorizationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortAuthorizationsDeleteFuture.Result. +func (future *ExpressRoutePortAuthorizationsDeleteFuture) result(client ExpressRoutePortAuthorizationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortAuthorizationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortAuthorizationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRoutePortListResult response for ListExpressRoutePorts API service call. +type ExpressRoutePortListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRoutePort resources. + Value *[]ExpressRoutePort `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortListResultIterator provides access to a complete listing of ExpressRoutePort values. +type ExpressRoutePortListResultIterator struct { + i int + page ExpressRoutePortListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortListResultIterator) Response() ExpressRoutePortListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortListResultIterator) Value() ExpressRoutePort { + if !iter.page.NotDone() { + return ExpressRoutePort{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortListResultIterator type. +func NewExpressRoutePortListResultIterator(page ExpressRoutePortListResultPage) ExpressRoutePortListResultIterator { + return ExpressRoutePortListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erplr ExpressRoutePortListResult) IsEmpty() bool { + return erplr.Value == nil || len(*erplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erplr ExpressRoutePortListResult) hasNextLink() bool { + return erplr.NextLink != nil && len(*erplr.NextLink) != 0 +} + +// expressRoutePortListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erplr ExpressRoutePortListResult) expressRoutePortListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erplr.NextLink))) +} + +// ExpressRoutePortListResultPage contains a page of ExpressRoutePort values. +type ExpressRoutePortListResultPage struct { + fn func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error) + erplr ExpressRoutePortListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erplr) + if err != nil { + return err + } + page.erplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortListResultPage) NotDone() bool { + return !page.erplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortListResultPage) Response() ExpressRoutePortListResult { + return page.erplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortListResultPage) Values() []ExpressRoutePort { + if page.erplr.IsEmpty() { + return nil + } + return *page.erplr.Value +} + +// Creates a new instance of the ExpressRoutePortListResultPage type. +func NewExpressRoutePortListResultPage(cur ExpressRoutePortListResult, getNextPage func(context.Context, ExpressRoutePortListResult) (ExpressRoutePortListResult, error)) ExpressRoutePortListResultPage { + return ExpressRoutePortListResultPage{ + fn: getNextPage, + erplr: cur, + } +} + +// ExpressRoutePortPropertiesFormat properties specific to ExpressRoutePort resources. +type ExpressRoutePortPropertiesFormat struct { + // PeeringLocation - The name of the peering location that the ExpressRoutePort is mapped to physically. + PeeringLocation *string `json:"peeringLocation,omitempty"` + // BandwidthInGbps - Bandwidth of procured ports in Gbps. + BandwidthInGbps *int32 `json:"bandwidthInGbps,omitempty"` + // ProvisionedBandwidthInGbps - READ-ONLY; Aggregate Gbps of associated circuit bandwidths. + ProvisionedBandwidthInGbps *float64 `json:"provisionedBandwidthInGbps,omitempty"` + // Mtu - READ-ONLY; Maximum transmission unit of the physical port pair(s). + Mtu *string `json:"mtu,omitempty"` + // Encapsulation - Encapsulation method on physical ports. Possible values include: 'ExpressRoutePortsEncapsulationDot1Q', 'ExpressRoutePortsEncapsulationQinQ' + Encapsulation ExpressRoutePortsEncapsulation `json:"encapsulation,omitempty"` + // EtherType - READ-ONLY; Ether type of the physical port. + EtherType *string `json:"etherType,omitempty"` + // AllocationDate - READ-ONLY; Date of the physical port allocation to be used in Letter of Authorization. + AllocationDate *string `json:"allocationDate,omitempty"` + // Links - The set of physical links of the ExpressRoutePort resource. + Links *[]ExpressRouteLink `json:"links,omitempty"` + // Circuits - READ-ONLY; Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. + Circuits *[]SubResource `json:"circuits,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route port resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the express route port resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortPropertiesFormat. +func (erppf ExpressRoutePortPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erppf.PeeringLocation != nil { + objectMap["peeringLocation"] = erppf.PeeringLocation + } + if erppf.BandwidthInGbps != nil { + objectMap["bandwidthInGbps"] = erppf.BandwidthInGbps + } + if erppf.Encapsulation != "" { + objectMap["encapsulation"] = erppf.Encapsulation + } + if erppf.Links != nil { + objectMap["links"] = erppf.Links + } + return json.Marshal(objectMap) +} + +// ExpressRoutePortsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ExpressRoutePortsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortsClient) (ExpressRoutePort, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortsCreateOrUpdateFuture.Result. +func (future *ExpressRoutePortsCreateOrUpdateFuture) result(client ExpressRoutePortsClient) (erp ExpressRoutePort, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erp.Response.Response, err = future.GetResult(sender); err == nil && erp.Response.Response.StatusCode != http.StatusNoContent { + erp, err = client.CreateOrUpdateResponder(erp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsCreateOrUpdateFuture", "Result", erp.Response.Response, "Failure responding to request") + } + } + return +} + +// ExpressRoutePortsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExpressRoutePortsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExpressRoutePortsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExpressRoutePortsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExpressRoutePortsDeleteFuture.Result. +func (future *ExpressRoutePortsDeleteFuture) result(client ExpressRoutePortsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ExpressRoutePortsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ExpressRoutePortsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExpressRoutePortsLocation definition of the ExpressRoutePorts peering location resource. +type ExpressRoutePortsLocation struct { + autorest.Response `json:"-"` + // ExpressRoutePortsLocationPropertiesFormat - ExpressRoutePort peering location properties. + *ExpressRoutePortsLocationPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocation. +func (erpl ExpressRoutePortsLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erpl.ExpressRoutePortsLocationPropertiesFormat != nil { + objectMap["properties"] = erpl.ExpressRoutePortsLocationPropertiesFormat + } + if erpl.ID != nil { + objectMap["id"] = erpl.ID + } + if erpl.Location != nil { + objectMap["location"] = erpl.Location + } + if erpl.Tags != nil { + objectMap["tags"] = erpl.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRoutePortsLocation struct. +func (erpl *ExpressRoutePortsLocation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRoutePortsLocationPropertiesFormat ExpressRoutePortsLocationPropertiesFormat + err = json.Unmarshal(*v, &expressRoutePortsLocationPropertiesFormat) + if err != nil { + return err + } + erpl.ExpressRoutePortsLocationPropertiesFormat = &expressRoutePortsLocationPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + erpl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + erpl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + erpl.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + erpl.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + erpl.Tags = tags + } + } + } + + return nil +} + +// ExpressRoutePortsLocationBandwidths real-time inventory of available ExpressRoute port bandwidths. +type ExpressRoutePortsLocationBandwidths struct { + // OfferName - READ-ONLY; Bandwidth descriptive name. + OfferName *string `json:"offerName,omitempty"` + // ValueInGbps - READ-ONLY; Bandwidth value in Gbps. + ValueInGbps *int32 `json:"valueInGbps,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationBandwidths. +func (erplb ExpressRoutePortsLocationBandwidths) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExpressRoutePortsLocationListResult response for ListExpressRoutePortsLocations API service call. +type ExpressRoutePortsLocationListResult struct { + autorest.Response `json:"-"` + // Value - The list of all ExpressRoutePort peering locations. + Value *[]ExpressRoutePortsLocation `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRoutePortsLocationListResultIterator provides access to a complete listing of +// ExpressRoutePortsLocation values. +type ExpressRoutePortsLocationListResultIterator struct { + i int + page ExpressRoutePortsLocationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRoutePortsLocationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRoutePortsLocationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRoutePortsLocationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRoutePortsLocationListResultIterator) Response() ExpressRoutePortsLocationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRoutePortsLocationListResultIterator) Value() ExpressRoutePortsLocation { + if !iter.page.NotDone() { + return ExpressRoutePortsLocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRoutePortsLocationListResultIterator type. +func NewExpressRoutePortsLocationListResultIterator(page ExpressRoutePortsLocationListResultPage) ExpressRoutePortsLocationListResultIterator { + return ExpressRoutePortsLocationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erpllr ExpressRoutePortsLocationListResult) IsEmpty() bool { + return erpllr.Value == nil || len(*erpllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erpllr ExpressRoutePortsLocationListResult) hasNextLink() bool { + return erpllr.NextLink != nil && len(*erpllr.NextLink) != 0 +} + +// expressRoutePortsLocationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erpllr ExpressRoutePortsLocationListResult) expressRoutePortsLocationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erpllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erpllr.NextLink))) +} + +// ExpressRoutePortsLocationListResultPage contains a page of ExpressRoutePortsLocation values. +type ExpressRoutePortsLocationListResultPage struct { + fn func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error) + erpllr ExpressRoutePortsLocationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRoutePortsLocationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRoutePortsLocationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erpllr) + if err != nil { + return err + } + page.erpllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRoutePortsLocationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRoutePortsLocationListResultPage) NotDone() bool { + return !page.erpllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRoutePortsLocationListResultPage) Response() ExpressRoutePortsLocationListResult { + return page.erpllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRoutePortsLocationListResultPage) Values() []ExpressRoutePortsLocation { + if page.erpllr.IsEmpty() { + return nil + } + return *page.erpllr.Value +} + +// Creates a new instance of the ExpressRoutePortsLocationListResultPage type. +func NewExpressRoutePortsLocationListResultPage(cur ExpressRoutePortsLocationListResult, getNextPage func(context.Context, ExpressRoutePortsLocationListResult) (ExpressRoutePortsLocationListResult, error)) ExpressRoutePortsLocationListResultPage { + return ExpressRoutePortsLocationListResultPage{ + fn: getNextPage, + erpllr: cur, + } +} + +// ExpressRoutePortsLocationPropertiesFormat properties specific to ExpressRoutePorts peering location +// resources. +type ExpressRoutePortsLocationPropertiesFormat struct { + // Address - READ-ONLY; Address of peering location. + Address *string `json:"address,omitempty"` + // Contact - READ-ONLY; Contact details of peering locations. + Contact *string `json:"contact,omitempty"` + // AvailableBandwidths - The inventory of available ExpressRoutePort bandwidths. + AvailableBandwidths *[]ExpressRoutePortsLocationBandwidths `json:"availableBandwidths,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route port location resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRoutePortsLocationPropertiesFormat. +func (erplpf ExpressRoutePortsLocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if erplpf.AvailableBandwidths != nil { + objectMap["availableBandwidths"] = erplpf.AvailableBandwidths + } + return json.Marshal(objectMap) +} + +// ExpressRouteServiceProvider a ExpressRouteResourceProvider object. +type ExpressRouteServiceProvider struct { + // ExpressRouteServiceProviderPropertiesFormat - Properties of the express route service provider. + *ExpressRouteServiceProviderPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteServiceProvider. +func (ersp ExpressRouteServiceProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ersp.ExpressRouteServiceProviderPropertiesFormat != nil { + objectMap["properties"] = ersp.ExpressRouteServiceProviderPropertiesFormat + } + if ersp.ID != nil { + objectMap["id"] = ersp.ID + } + if ersp.Location != nil { + objectMap["location"] = ersp.Location + } + if ersp.Tags != nil { + objectMap["tags"] = ersp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExpressRouteServiceProvider struct. +func (ersp *ExpressRouteServiceProvider) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var expressRouteServiceProviderPropertiesFormat ExpressRouteServiceProviderPropertiesFormat + err = json.Unmarshal(*v, &expressRouteServiceProviderPropertiesFormat) + if err != nil { + return err + } + ersp.ExpressRouteServiceProviderPropertiesFormat = &expressRouteServiceProviderPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ersp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ersp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ersp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ersp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ersp.Tags = tags + } + } + } + + return nil +} + +// ExpressRouteServiceProviderBandwidthsOffered contains bandwidths offered in ExpressRouteServiceProvider +// resources. +type ExpressRouteServiceProviderBandwidthsOffered struct { + // OfferName - The OfferName. + OfferName *string `json:"offerName,omitempty"` + // ValueInMbps - The ValueInMbps. + ValueInMbps *int32 `json:"valueInMbps,omitempty"` +} + +// ExpressRouteServiceProviderListResult response for the ListExpressRouteServiceProvider API service call. +type ExpressRouteServiceProviderListResult struct { + autorest.Response `json:"-"` + // Value - A list of ExpressRouteResourceProvider resources. + Value *[]ExpressRouteServiceProvider `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ExpressRouteServiceProviderListResultIterator provides access to a complete listing of +// ExpressRouteServiceProvider values. +type ExpressRouteServiceProviderListResultIterator struct { + i int + page ExpressRouteServiceProviderListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExpressRouteServiceProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExpressRouteServiceProviderListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExpressRouteServiceProviderListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExpressRouteServiceProviderListResultIterator) Response() ExpressRouteServiceProviderListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExpressRouteServiceProviderListResultIterator) Value() ExpressRouteServiceProvider { + if !iter.page.NotDone() { + return ExpressRouteServiceProvider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExpressRouteServiceProviderListResultIterator type. +func NewExpressRouteServiceProviderListResultIterator(page ExpressRouteServiceProviderListResultPage) ExpressRouteServiceProviderListResultIterator { + return ExpressRouteServiceProviderListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ersplr ExpressRouteServiceProviderListResult) IsEmpty() bool { + return ersplr.Value == nil || len(*ersplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ersplr ExpressRouteServiceProviderListResult) hasNextLink() bool { + return ersplr.NextLink != nil && len(*ersplr.NextLink) != 0 +} + +// expressRouteServiceProviderListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ersplr ExpressRouteServiceProviderListResult) expressRouteServiceProviderListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ersplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ersplr.NextLink))) +} + +// ExpressRouteServiceProviderListResultPage contains a page of ExpressRouteServiceProvider values. +type ExpressRouteServiceProviderListResultPage struct { + fn func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error) + ersplr ExpressRouteServiceProviderListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExpressRouteServiceProviderListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteServiceProviderListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ersplr) + if err != nil { + return err + } + page.ersplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExpressRouteServiceProviderListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExpressRouteServiceProviderListResultPage) NotDone() bool { + return !page.ersplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExpressRouteServiceProviderListResultPage) Response() ExpressRouteServiceProviderListResult { + return page.ersplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExpressRouteServiceProviderListResultPage) Values() []ExpressRouteServiceProvider { + if page.ersplr.IsEmpty() { + return nil + } + return *page.ersplr.Value +} + +// Creates a new instance of the ExpressRouteServiceProviderListResultPage type. +func NewExpressRouteServiceProviderListResultPage(cur ExpressRouteServiceProviderListResult, getNextPage func(context.Context, ExpressRouteServiceProviderListResult) (ExpressRouteServiceProviderListResult, error)) ExpressRouteServiceProviderListResultPage { + return ExpressRouteServiceProviderListResultPage{ + fn: getNextPage, + ersplr: cur, + } +} + +// ExpressRouteServiceProviderPropertiesFormat properties of ExpressRouteServiceProvider. +type ExpressRouteServiceProviderPropertiesFormat struct { + // PeeringLocations - A list of peering locations. + PeeringLocations *[]string `json:"peeringLocations,omitempty"` + // BandwidthsOffered - A list of bandwidths offered. + BandwidthsOffered *[]ExpressRouteServiceProviderBandwidthsOffered `json:"bandwidthsOffered,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the express route service provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExpressRouteServiceProviderPropertiesFormat. +func (ersppf ExpressRouteServiceProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ersppf.PeeringLocations != nil { + objectMap["peeringLocations"] = ersppf.PeeringLocations + } + if ersppf.BandwidthsOffered != nil { + objectMap["bandwidthsOffered"] = ersppf.BandwidthsOffered + } + return json.Marshal(objectMap) +} + +// ExtendedLocation extendedLocation complex type. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// FilterItems will contain the filter name and values to operate on +type FilterItems struct { + // Field - The name of the field we would like to filter + Field *string `json:"field,omitempty"` + // Values - List of values to filter the current field by + Values *[]string `json:"values,omitempty"` +} + +// FirewallPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FirewallPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPoliciesClient) (FirewallPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPoliciesCreateOrUpdateFuture.Result. +func (future *FirewallPoliciesCreateOrUpdateFuture) result(client FirewallPoliciesClient) (fp FirewallPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fp.Response.Response, err = future.GetResult(sender); err == nil && fp.Response.Response.StatusCode != http.StatusNoContent { + fp, err = client.CreateOrUpdateResponder(fp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesCreateOrUpdateFuture", "Result", fp.Response.Response, "Failure responding to request") + } + } + return +} + +// FirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FirewallPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPoliciesDeleteFuture.Result. +func (future *FirewallPoliciesDeleteFuture) result(client FirewallPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FirewallPolicy firewallPolicy Resource. +type FirewallPolicy struct { + autorest.Response `json:"-"` + // FirewallPolicyPropertiesFormat - Properties of the firewall policy. + *FirewallPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Identity - The identity of the firewall policy. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicy. +func (fp FirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fp.FirewallPolicyPropertiesFormat != nil { + objectMap["properties"] = fp.FirewallPolicyPropertiesFormat + } + if fp.Identity != nil { + objectMap["identity"] = fp.Identity + } + if fp.ID != nil { + objectMap["id"] = fp.ID + } + if fp.Location != nil { + objectMap["location"] = fp.Location + } + if fp.Tags != nil { + objectMap["tags"] = fp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicy struct. +func (fp *FirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var firewallPolicyPropertiesFormat FirewallPolicyPropertiesFormat + err = json.Unmarshal(*v, &firewallPolicyPropertiesFormat) + if err != nil { + return err + } + fp.FirewallPolicyPropertiesFormat = &firewallPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fp.Etag = &etag + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + fp.Identity = &identity + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fp.Tags = tags + } + } + } + + return nil +} + +// FirewallPolicyCertificateAuthority trusted Root certificates properties for tls. +type FirewallPolicyCertificateAuthority struct { + // KeyVaultSecretID - Secret Id of (base-64 encoded unencrypted pfx) 'Secret' or 'Certificate' object stored in KeyVault. + KeyVaultSecretID *string `json:"keyVaultSecretId,omitempty"` + // Name - Name of the CA certificate. + Name *string `json:"name,omitempty"` +} + +// FirewallPolicyFilterRuleCollection firewall Policy Filter Rule Collection. +type FirewallPolicyFilterRuleCollection struct { + // Action - The action type of a Filter rule collection. + Action *FirewallPolicyFilterRuleCollectionAction `json:"action,omitempty"` + // Rules - List of rules included in a rule collection. + Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) MarshalJSON() ([]byte, error) { + fpfrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyFilterRuleCollection + objectMap := make(map[string]interface{}) + if fpfrc.Action != nil { + objectMap["action"] = fpfrc.Action + } + if fpfrc.Rules != nil { + objectMap["rules"] = fpfrc.Rules + } + if fpfrc.Name != nil { + objectMap["name"] = fpfrc.Name + } + if fpfrc.Priority != nil { + objectMap["priority"] = fpfrc.Priority + } + if fpfrc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fpfrc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return &fpfrc, true +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyFilterRuleCollection. +func (fpfrc FirewallPolicyFilterRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fpfrc, true +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyFilterRuleCollection struct. +func (fpfrc *FirewallPolicyFilterRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "action": + if v != nil { + var action FirewallPolicyFilterRuleCollectionAction + err = json.Unmarshal(*v, &action) + if err != nil { + return err + } + fpfrc.Action = &action + } + case "rules": + if v != nil { + rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) + if err != nil { + return err + } + fpfrc.Rules = &rules + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fpfrc.Name = &name + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fpfrc.Priority = &priority + } + case "ruleCollectionType": + if v != nil { + var ruleCollectionType RuleCollectionType + err = json.Unmarshal(*v, &ruleCollectionType) + if err != nil { + return err + } + fpfrc.RuleCollectionType = ruleCollectionType + } + } + } + + return nil +} + +// FirewallPolicyFilterRuleCollectionAction properties of the FirewallPolicyFilterRuleCollectionAction. +type FirewallPolicyFilterRuleCollectionAction struct { + // Type - The type of action. Possible values include: 'FirewallPolicyFilterRuleCollectionActionTypeAllow', 'FirewallPolicyFilterRuleCollectionActionTypeDeny' + Type FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyInsights firewall Policy Insights. +type FirewallPolicyInsights struct { + // IsEnabled - A flag to indicate if the insights are enabled on the policy. + IsEnabled *bool `json:"isEnabled,omitempty"` + // RetentionDays - Number of days the insights should be enabled on the policy. + RetentionDays *int32 `json:"retentionDays,omitempty"` + // LogAnalyticsResources - Workspaces needed to configure the Firewall Policy Insights. + LogAnalyticsResources *FirewallPolicyLogAnalyticsResources `json:"logAnalyticsResources,omitempty"` +} + +// FirewallPolicyIntrusionDetection configuration for intrusion detection mode and rules. +type FirewallPolicyIntrusionDetection struct { + // Mode - Intrusion detection general state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' + Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` + // Configuration - Intrusion detection configuration properties. + Configuration *FirewallPolicyIntrusionDetectionConfiguration `json:"configuration,omitempty"` +} + +// FirewallPolicyIntrusionDetectionBypassTrafficSpecifications intrusion detection bypass traffic +// specification. +type FirewallPolicyIntrusionDetectionBypassTrafficSpecifications struct { + // Name - Name of the bypass traffic rule. + Name *string `json:"name,omitempty"` + // Description - Description of the bypass traffic rule. + Description *string `json:"description,omitempty"` + // Protocol - The rule bypass protocol. Possible values include: 'FirewallPolicyIntrusionDetectionProtocolTCP', 'FirewallPolicyIntrusionDetectionProtocolUDP', 'FirewallPolicyIntrusionDetectionProtocolICMP', 'FirewallPolicyIntrusionDetectionProtocolANY' + Protocol FirewallPolicyIntrusionDetectionProtocol `json:"protocol,omitempty"` + // SourceAddresses - List of source IP addresses or ranges for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or ranges for this rule. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports or ranges. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` +} + +// FirewallPolicyIntrusionDetectionConfiguration the operation for configuring intrusion detection. +type FirewallPolicyIntrusionDetectionConfiguration struct { + // SignatureOverrides - List of specific signatures states. + SignatureOverrides *[]FirewallPolicyIntrusionDetectionSignatureSpecification `json:"signatureOverrides,omitempty"` + // BypassTrafficSettings - List of rules for traffic to bypass. + BypassTrafficSettings *[]FirewallPolicyIntrusionDetectionBypassTrafficSpecifications `json:"bypassTrafficSettings,omitempty"` + // PrivateRanges - IDPS Private IP address ranges are used to identify traffic direction (i.e. inbound, outbound, etc.). By default, only ranges defined by IANA RFC 1918 are considered private IP addresses. To modify default ranges, specify your Private IP address ranges with this property + PrivateRanges *[]string `json:"privateRanges,omitempty"` +} + +// FirewallPolicyIntrusionDetectionSignatureSpecification intrusion detection signatures specification +// states. +type FirewallPolicyIntrusionDetectionSignatureSpecification struct { + // ID - Signature id. + ID *string `json:"id,omitempty"` + // Mode - The signature state. Possible values include: 'FirewallPolicyIntrusionDetectionStateTypeOff', 'FirewallPolicyIntrusionDetectionStateTypeAlert', 'FirewallPolicyIntrusionDetectionStateTypeDeny' + Mode FirewallPolicyIntrusionDetectionStateType `json:"mode,omitempty"` +} + +// FirewallPolicyListResult response for ListFirewallPolicies API service call. +type FirewallPolicyListResult struct { + autorest.Response `json:"-"` + // Value - List of Firewall Policies in a resource group. + Value *[]FirewallPolicy `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallPolicyListResultIterator provides access to a complete listing of FirewallPolicy values. +type FirewallPolicyListResultIterator struct { + i int + page FirewallPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FirewallPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FirewallPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FirewallPolicyListResultIterator) Response() FirewallPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FirewallPolicyListResultIterator) Value() FirewallPolicy { + if !iter.page.NotDone() { + return FirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FirewallPolicyListResultIterator type. +func NewFirewallPolicyListResultIterator(page FirewallPolicyListResultPage) FirewallPolicyListResultIterator { + return FirewallPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fplr FirewallPolicyListResult) IsEmpty() bool { + return fplr.Value == nil || len(*fplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fplr FirewallPolicyListResult) hasNextLink() bool { + return fplr.NextLink != nil && len(*fplr.NextLink) != 0 +} + +// firewallPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fplr FirewallPolicyListResult) firewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fplr.NextLink))) +} + +// FirewallPolicyListResultPage contains a page of FirewallPolicy values. +type FirewallPolicyListResultPage struct { + fn func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error) + fplr FirewallPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fplr) + if err != nil { + return err + } + page.fplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FirewallPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FirewallPolicyListResultPage) NotDone() bool { + return !page.fplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FirewallPolicyListResultPage) Response() FirewallPolicyListResult { + return page.fplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FirewallPolicyListResultPage) Values() []FirewallPolicy { + if page.fplr.IsEmpty() { + return nil + } + return *page.fplr.Value +} + +// Creates a new instance of the FirewallPolicyListResultPage type. +func NewFirewallPolicyListResultPage(cur FirewallPolicyListResult, getNextPage func(context.Context, FirewallPolicyListResult) (FirewallPolicyListResult, error)) FirewallPolicyListResultPage { + return FirewallPolicyListResultPage{ + fn: getNextPage, + fplr: cur, + } +} + +// FirewallPolicyLogAnalyticsResources log Analytics Resources for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsResources struct { + // Workspaces - List of workspaces for Firewall Policy Insights. + Workspaces *[]FirewallPolicyLogAnalyticsWorkspace `json:"workspaces,omitempty"` + // DefaultWorkspaceID - The default workspace Id for Firewall Policy Insights. + DefaultWorkspaceID *SubResource `json:"defaultWorkspaceId,omitempty"` +} + +// FirewallPolicyLogAnalyticsWorkspace log Analytics Workspace for Firewall Policy Insights. +type FirewallPolicyLogAnalyticsWorkspace struct { + // Region - Region to configure the Workspace. + Region *string `json:"region,omitempty"` + // WorkspaceID - The workspace Id for Firewall Policy Insights. + WorkspaceID *SubResource `json:"workspaceId,omitempty"` +} + +// FirewallPolicyNatRuleCollection firewall Policy NAT Rule Collection. +type FirewallPolicyNatRuleCollection struct { + // Action - The action type of a Nat rule collection. + Action *FirewallPolicyNatRuleCollectionAction `json:"action,omitempty"` + // Rules - List of rules included in a rule collection. + Rules *[]BasicFirewallPolicyRule `json:"rules,omitempty"` + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) MarshalJSON() ([]byte, error) { + fpnrc.RuleCollectionType = RuleCollectionTypeFirewallPolicyNatRuleCollection + objectMap := make(map[string]interface{}) + if fpnrc.Action != nil { + objectMap["action"] = fpnrc.Action + } + if fpnrc.Rules != nil { + objectMap["rules"] = fpnrc.Rules + } + if fpnrc.Name != nil { + objectMap["name"] = fpnrc.Name + } + if fpnrc.Priority != nil { + objectMap["priority"] = fpnrc.Priority + } + if fpnrc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fpnrc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return &fpnrc, true +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyNatRuleCollection. +func (fpnrc FirewallPolicyNatRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fpnrc, true +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyNatRuleCollection struct. +func (fpnrc *FirewallPolicyNatRuleCollection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "action": + if v != nil { + var action FirewallPolicyNatRuleCollectionAction + err = json.Unmarshal(*v, &action) + if err != nil { + return err + } + fpnrc.Action = &action + } + case "rules": + if v != nil { + rules, err := unmarshalBasicFirewallPolicyRuleArray(*v) + if err != nil { + return err + } + fpnrc.Rules = &rules + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fpnrc.Name = &name + } + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fpnrc.Priority = &priority + } + case "ruleCollectionType": + if v != nil { + var ruleCollectionType RuleCollectionType + err = json.Unmarshal(*v, &ruleCollectionType) + if err != nil { + return err + } + fpnrc.RuleCollectionType = ruleCollectionType + } + } + } + + return nil +} + +// FirewallPolicyNatRuleCollectionAction properties of the FirewallPolicyNatRuleCollectionAction. +type FirewallPolicyNatRuleCollectionAction struct { + // Type - The type of action. Possible values include: 'FirewallPolicyNatRuleCollectionActionTypeDNAT' + Type FirewallPolicyNatRuleCollectionActionType `json:"type,omitempty"` +} + +// FirewallPolicyPropertiesFormat firewall Policy definition. +type FirewallPolicyPropertiesFormat struct { + // RuleCollectionGroups - READ-ONLY; List of references to FirewallPolicyRuleCollectionGroups. + RuleCollectionGroups *[]SubResource `json:"ruleCollectionGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // BasePolicy - The parent firewall policy from which rules are inherited. + BasePolicy *SubResource `json:"basePolicy,omitempty"` + // Firewalls - READ-ONLY; List of references to Azure Firewalls that this Firewall Policy is associated with. + Firewalls *[]SubResource `json:"firewalls,omitempty"` + // ChildPolicies - READ-ONLY; List of references to Child Firewall Policies. + ChildPolicies *[]SubResource `json:"childPolicies,omitempty"` + // ThreatIntelMode - The operation mode for Threat Intelligence. Possible values include: 'AzureFirewallThreatIntelModeAlert', 'AzureFirewallThreatIntelModeDeny', 'AzureFirewallThreatIntelModeOff' + ThreatIntelMode AzureFirewallThreatIntelMode `json:"threatIntelMode,omitempty"` + // ThreatIntelWhitelist - ThreatIntel Whitelist for Firewall Policy. + ThreatIntelWhitelist *FirewallPolicyThreatIntelWhitelist `json:"threatIntelWhitelist,omitempty"` + // Insights - Insights on Firewall Policy. + Insights *FirewallPolicyInsights `json:"insights,omitempty"` + // Snat - The private IP addresses/IP ranges to which traffic will not be SNAT. + Snat *FirewallPolicySNAT `json:"snat,omitempty"` + // SQL - SQL Settings definition. + SQL *FirewallPolicySQL `json:"sql,omitempty"` + // DNSSettings - DNS Proxy Settings definition. + DNSSettings *DNSSettings `json:"dnsSettings,omitempty"` + // ExplicitProxySettings - Explicit Proxy Settings definition. + ExplicitProxySettings *ExplicitProxySettings `json:"explicitProxySettings,omitempty"` + // IntrusionDetection - The configuration for Intrusion detection. + IntrusionDetection *FirewallPolicyIntrusionDetection `json:"intrusionDetection,omitempty"` + // TransportSecurity - TLS Configuration definition. + TransportSecurity *FirewallPolicyTransportSecurity `json:"transportSecurity,omitempty"` + // Sku - The Firewall Policy SKU. + Sku *FirewallPolicySku `json:"sku,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyPropertiesFormat. +func (fppf FirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fppf.BasePolicy != nil { + objectMap["basePolicy"] = fppf.BasePolicy + } + if fppf.ThreatIntelMode != "" { + objectMap["threatIntelMode"] = fppf.ThreatIntelMode + } + if fppf.ThreatIntelWhitelist != nil { + objectMap["threatIntelWhitelist"] = fppf.ThreatIntelWhitelist + } + if fppf.Insights != nil { + objectMap["insights"] = fppf.Insights + } + if fppf.Snat != nil { + objectMap["snat"] = fppf.Snat + } + if fppf.SQL != nil { + objectMap["sql"] = fppf.SQL + } + if fppf.DNSSettings != nil { + objectMap["dnsSettings"] = fppf.DNSSettings + } + if fppf.ExplicitProxySettings != nil { + objectMap["explicitProxySettings"] = fppf.ExplicitProxySettings + } + if fppf.IntrusionDetection != nil { + objectMap["intrusionDetection"] = fppf.IntrusionDetection + } + if fppf.TransportSecurity != nil { + objectMap["transportSecurity"] = fppf.TransportSecurity + } + if fppf.Sku != nil { + objectMap["sku"] = fppf.Sku + } + return json.Marshal(objectMap) +} + +// BasicFirewallPolicyRule properties of a rule. +type BasicFirewallPolicyRule interface { + AsApplicationRule() (*ApplicationRule, bool) + AsNatRule() (*NatRule, bool) + AsRule() (*Rule, bool) + AsFirewallPolicyRule() (*FirewallPolicyRule, bool) +} + +// FirewallPolicyRule properties of a rule. +type FirewallPolicyRule struct { + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +func unmarshalBasicFirewallPolicyRule(body []byte) (BasicFirewallPolicyRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["ruleType"] { + case string(RuleTypeApplicationRule): + var ar ApplicationRule + err := json.Unmarshal(body, &ar) + return ar, err + case string(RuleTypeNatRule): + var nr NatRule + err := json.Unmarshal(body, &nr) + return nr, err + case string(RuleTypeNetworkRule): + var r Rule + err := json.Unmarshal(body, &r) + return r, err + default: + var fpr FirewallPolicyRule + err := json.Unmarshal(body, &fpr) + return fpr, err + } +} +func unmarshalBasicFirewallPolicyRuleArray(body []byte) ([]BasicFirewallPolicyRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fprArray := make([]BasicFirewallPolicyRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fpr, err := unmarshalBasicFirewallPolicyRule(*rawMessage) + if err != nil { + return nil, err + } + fprArray[index] = fpr + } + return fprArray, nil +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRule. +func (fpr FirewallPolicyRule) MarshalJSON() ([]byte, error) { + fpr.RuleType = RuleTypeFirewallPolicyRule + objectMap := make(map[string]interface{}) + if fpr.Name != nil { + objectMap["name"] = fpr.Name + } + if fpr.Description != nil { + objectMap["description"] = fpr.Description + } + if fpr.RuleType != "" { + objectMap["ruleType"] = fpr.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return &fpr, true +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for FirewallPolicyRule. +func (fpr FirewallPolicyRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &fpr, true +} + +// FirewallPolicyRuleApplicationProtocol properties of the application rule protocol. +type FirewallPolicyRuleApplicationProtocol struct { + // ProtocolType - Protocol type. Possible values include: 'FirewallPolicyRuleApplicationProtocolTypeHTTP', 'FirewallPolicyRuleApplicationProtocolTypeHTTPS' + ProtocolType FirewallPolicyRuleApplicationProtocolType `json:"protocolType,omitempty"` + // Port - Port number for the protocol, cannot be greater than 64000. + Port *int32 `json:"port,omitempty"` +} + +// BasicFirewallPolicyRuleCollection properties of the rule collection. +type BasicFirewallPolicyRuleCollection interface { + AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) + AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) + AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) +} + +// FirewallPolicyRuleCollection properties of the rule collection. +type FirewallPolicyRuleCollection struct { + // Name - The name of the rule collection. + Name *string `json:"name,omitempty"` + // Priority - Priority of the Firewall Policy Rule Collection resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollectionType - Possible values include: 'RuleCollectionTypeFirewallPolicyRuleCollection', 'RuleCollectionTypeFirewallPolicyNatRuleCollection', 'RuleCollectionTypeFirewallPolicyFilterRuleCollection' + RuleCollectionType RuleCollectionType `json:"ruleCollectionType,omitempty"` +} + +func unmarshalBasicFirewallPolicyRuleCollection(body []byte) (BasicFirewallPolicyRuleCollection, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["ruleCollectionType"] { + case string(RuleCollectionTypeFirewallPolicyNatRuleCollection): + var fpnrc FirewallPolicyNatRuleCollection + err := json.Unmarshal(body, &fpnrc) + return fpnrc, err + case string(RuleCollectionTypeFirewallPolicyFilterRuleCollection): + var fpfrc FirewallPolicyFilterRuleCollection + err := json.Unmarshal(body, &fpfrc) + return fpfrc, err + default: + var fprc FirewallPolicyRuleCollection + err := json.Unmarshal(body, &fprc) + return fprc, err + } +} +func unmarshalBasicFirewallPolicyRuleCollectionArray(body []byte) ([]BasicFirewallPolicyRuleCollection, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + fprcArray := make([]BasicFirewallPolicyRuleCollection, len(rawMessages)) + + for index, rawMessage := range rawMessages { + fprc, err := unmarshalBasicFirewallPolicyRuleCollection(*rawMessage) + if err != nil { + return nil, err + } + fprcArray[index] = fprc + } + return fprcArray, nil +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) MarshalJSON() ([]byte, error) { + fprc.RuleCollectionType = RuleCollectionTypeFirewallPolicyRuleCollection + objectMap := make(map[string]interface{}) + if fprc.Name != nil { + objectMap["name"] = fprc.Name + } + if fprc.Priority != nil { + objectMap["priority"] = fprc.Priority + } + if fprc.RuleCollectionType != "" { + objectMap["ruleCollectionType"] = fprc.RuleCollectionType + } + return json.Marshal(objectMap) +} + +// AsFirewallPolicyNatRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyNatRuleCollection() (*FirewallPolicyNatRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyFilterRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyFilterRuleCollection() (*FirewallPolicyFilterRuleCollection, bool) { + return nil, false +} + +// AsFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsFirewallPolicyRuleCollection() (*FirewallPolicyRuleCollection, bool) { + return &fprc, true +} + +// AsBasicFirewallPolicyRuleCollection is the BasicFirewallPolicyRuleCollection implementation for FirewallPolicyRuleCollection. +func (fprc FirewallPolicyRuleCollection) AsBasicFirewallPolicyRuleCollection() (BasicFirewallPolicyRuleCollection, bool) { + return &fprc, true +} + +// FirewallPolicyRuleCollectionGroup rule Collection Group resource. +type FirewallPolicyRuleCollectionGroup struct { + autorest.Response `json:"-"` + // FirewallPolicyRuleCollectionGroupProperties - The properties of the firewall policy rule collection group. + *FirewallPolicyRuleCollectionGroupProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Rule Group type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroup. +func (fprcg FirewallPolicyRuleCollectionGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fprcg.FirewallPolicyRuleCollectionGroupProperties != nil { + objectMap["properties"] = fprcg.FirewallPolicyRuleCollectionGroupProperties + } + if fprcg.Name != nil { + objectMap["name"] = fprcg.Name + } + if fprcg.ID != nil { + objectMap["id"] = fprcg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroup struct. +func (fprcg *FirewallPolicyRuleCollectionGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var firewallPolicyRuleCollectionGroupProperties FirewallPolicyRuleCollectionGroupProperties + err = json.Unmarshal(*v, &firewallPolicyRuleCollectionGroupProperties) + if err != nil { + return err + } + fprcg.FirewallPolicyRuleCollectionGroupProperties = &firewallPolicyRuleCollectionGroupProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fprcg.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fprcg.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fprcg.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fprcg.ID = &ID + } + } + } + + return nil +} + +// FirewallPolicyRuleCollectionGroupListResult response for ListFirewallPolicyRuleCollectionGroups API +// service call. +type FirewallPolicyRuleCollectionGroupListResult struct { + autorest.Response `json:"-"` + // Value - List of FirewallPolicyRuleCollectionGroups in a FirewallPolicy. + Value *[]FirewallPolicyRuleCollectionGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// FirewallPolicyRuleCollectionGroupListResultIterator provides access to a complete listing of +// FirewallPolicyRuleCollectionGroup values. +type FirewallPolicyRuleCollectionGroupListResultIterator struct { + i int + page FirewallPolicyRuleCollectionGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FirewallPolicyRuleCollectionGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Response() FirewallPolicyRuleCollectionGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FirewallPolicyRuleCollectionGroupListResultIterator) Value() FirewallPolicyRuleCollectionGroup { + if !iter.page.NotDone() { + return FirewallPolicyRuleCollectionGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultIterator type. +func NewFirewallPolicyRuleCollectionGroupListResultIterator(page FirewallPolicyRuleCollectionGroupListResultPage) FirewallPolicyRuleCollectionGroupListResultIterator { + return FirewallPolicyRuleCollectionGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) IsEmpty() bool { + return fprcglr.Value == nil || len(*fprcglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) hasNextLink() bool { + return fprcglr.NextLink != nil && len(*fprcglr.NextLink) != 0 +} + +// firewallPolicyRuleCollectionGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fprcglr FirewallPolicyRuleCollectionGroupListResult) firewallPolicyRuleCollectionGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fprcglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fprcglr.NextLink))) +} + +// FirewallPolicyRuleCollectionGroupListResultPage contains a page of FirewallPolicyRuleCollectionGroup +// values. +type FirewallPolicyRuleCollectionGroupListResultPage struct { + fn func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error) + fprcglr FirewallPolicyRuleCollectionGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FirewallPolicyRuleCollectionGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FirewallPolicyRuleCollectionGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fprcglr) + if err != nil { + return err + } + page.fprcglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FirewallPolicyRuleCollectionGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FirewallPolicyRuleCollectionGroupListResultPage) NotDone() bool { + return !page.fprcglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FirewallPolicyRuleCollectionGroupListResultPage) Response() FirewallPolicyRuleCollectionGroupListResult { + return page.fprcglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FirewallPolicyRuleCollectionGroupListResultPage) Values() []FirewallPolicyRuleCollectionGroup { + if page.fprcglr.IsEmpty() { + return nil + } + return *page.fprcglr.Value +} + +// Creates a new instance of the FirewallPolicyRuleCollectionGroupListResultPage type. +func NewFirewallPolicyRuleCollectionGroupListResultPage(cur FirewallPolicyRuleCollectionGroupListResult, getNextPage func(context.Context, FirewallPolicyRuleCollectionGroupListResult) (FirewallPolicyRuleCollectionGroupListResult, error)) FirewallPolicyRuleCollectionGroupListResultPage { + return FirewallPolicyRuleCollectionGroupListResultPage{ + fn: getNextPage, + fprcglr: cur, + } +} + +// FirewallPolicyRuleCollectionGroupProperties properties of the rule collection group. +type FirewallPolicyRuleCollectionGroupProperties struct { + // Priority - Priority of the Firewall Policy Rule Collection Group resource. + Priority *int32 `json:"priority,omitempty"` + // RuleCollections - Group of Firewall Policy rule collections. + RuleCollections *[]BasicFirewallPolicyRuleCollection `json:"ruleCollections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the firewall policy rule collection group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FirewallPolicyRuleCollectionGroupProperties. +func (fprcgp FirewallPolicyRuleCollectionGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fprcgp.Priority != nil { + objectMap["priority"] = fprcgp.Priority + } + if fprcgp.RuleCollections != nil { + objectMap["ruleCollections"] = fprcgp.RuleCollections + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FirewallPolicyRuleCollectionGroupProperties struct. +func (fprcgp *FirewallPolicyRuleCollectionGroupProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "priority": + if v != nil { + var priority int32 + err = json.Unmarshal(*v, &priority) + if err != nil { + return err + } + fprcgp.Priority = &priority + } + case "ruleCollections": + if v != nil { + ruleCollections, err := unmarshalBasicFirewallPolicyRuleCollectionArray(*v) + if err != nil { + return err + } + fprcgp.RuleCollections = &ruleCollections + } + case "provisioningState": + if v != nil { + var provisioningState ProvisioningState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + fprcgp.ProvisioningState = provisioningState + } + } + } + + return nil +} + +// FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPolicyRuleCollectionGroupsClient) (FirewallPolicyRuleCollectionGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture.Result. +func (future *FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (fprcg FirewallPolicyRuleCollectionGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fprcg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fprcg.Response.Response, err = future.GetResult(sender); err == nil && fprcg.Response.Response.StatusCode != http.StatusNoContent { + fprcg, err = client.CreateOrUpdateResponder(fprcg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture", "Result", fprcg.Response.Response, "Failure responding to request") + } + } + return +} + +// FirewallPolicyRuleCollectionGroupsDeleteFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type FirewallPolicyRuleCollectionGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FirewallPolicyRuleCollectionGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FirewallPolicyRuleCollectionGroupsDeleteFuture.Result. +func (future *FirewallPolicyRuleCollectionGroupsDeleteFuture) result(client FirewallPolicyRuleCollectionGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FirewallPolicyRuleCollectionGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FirewallPolicyRuleCollectionGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FirewallPolicySku SKU of Firewall policy. +type FirewallPolicySku struct { + // Tier - Tier of Firewall Policy. Possible values include: 'FirewallPolicySkuTierStandard', 'FirewallPolicySkuTierPremium', 'FirewallPolicySkuTierBasic' + Tier FirewallPolicySkuTier `json:"tier,omitempty"` +} + +// FirewallPolicySNAT the private IP addresses/IP ranges to which traffic will not be SNAT. +type FirewallPolicySNAT struct { + // PrivateRanges - List of private IP addresses/IP address ranges to not be SNAT. + PrivateRanges *[]string `json:"privateRanges,omitempty"` +} + +// FirewallPolicySQL SQL Settings in Firewall Policy. +type FirewallPolicySQL struct { + // AllowSQLRedirect - A flag to indicate if SQL Redirect traffic filtering is enabled. Turning on the flag requires no rule using port 11000-11999. + AllowSQLRedirect *bool `json:"allowSqlRedirect,omitempty"` +} + +// FirewallPolicyThreatIntelWhitelist threatIntel Whitelist for Firewall Policy. +type FirewallPolicyThreatIntelWhitelist struct { + // IPAddresses - List of IP addresses for the ThreatIntel Whitelist. + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // Fqdns - List of FQDNs for the ThreatIntel Whitelist. + Fqdns *[]string `json:"fqdns,omitempty"` +} + +// FirewallPolicyTransportSecurity configuration needed to perform TLS termination & initiation. +type FirewallPolicyTransportSecurity struct { + // CertificateAuthority - The CA used for intermediate CA generation. + CertificateAuthority *FirewallPolicyCertificateAuthority `json:"certificateAuthority,omitempty"` +} + +// FlowLog a flow log resource. +type FlowLog struct { + autorest.Response `json:"-"` + // FlowLogPropertiesFormat - Properties of the flow log. + *FlowLogPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for FlowLog. +func (fl FlowLog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fl.FlowLogPropertiesFormat != nil { + objectMap["properties"] = fl.FlowLogPropertiesFormat + } + if fl.ID != nil { + objectMap["id"] = fl.ID + } + if fl.Location != nil { + objectMap["location"] = fl.Location + } + if fl.Tags != nil { + objectMap["tags"] = fl.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FlowLog struct. +func (fl *FlowLog) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var flowLogPropertiesFormat FlowLogPropertiesFormat + err = json.Unmarshal(*v, &flowLogPropertiesFormat) + if err != nil { + return err + } + fl.FlowLogPropertiesFormat = &flowLogPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fl.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fl.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fl.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + fl.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + fl.Tags = tags + } + } + } + + return nil +} + +// FlowLogFormatParameters parameters that define the flow log format. +type FlowLogFormatParameters struct { + // Type - The file type of flow log. Possible values include: 'FlowLogFormatTypeJSON' + Type FlowLogFormatType `json:"type,omitempty"` + // Version - The version (revision) of the flow log. + Version *int32 `json:"version,omitempty"` +} + +// FlowLogInformation information on the configuration of flow log and traffic analytics (optional) . +type FlowLogInformation struct { + autorest.Response `json:"-"` + // TargetResourceID - The ID of the resource to configure for flow log and traffic analytics (optional) . + TargetResourceID *string `json:"targetResourceId,omitempty"` + // FlowLogProperties - Properties of the flow log. + *FlowLogProperties `json:"properties,omitempty"` + // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogInformation. +func (fli FlowLogInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fli.TargetResourceID != nil { + objectMap["targetResourceId"] = fli.TargetResourceID + } + if fli.FlowLogProperties != nil { + objectMap["properties"] = fli.FlowLogProperties + } + if fli.FlowAnalyticsConfiguration != nil { + objectMap["flowAnalyticsConfiguration"] = fli.FlowAnalyticsConfiguration + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FlowLogInformation struct. +func (fli *FlowLogInformation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "targetResourceId": + if v != nil { + var targetResourceID string + err = json.Unmarshal(*v, &targetResourceID) + if err != nil { + return err + } + fli.TargetResourceID = &targetResourceID + } + case "properties": + if v != nil { + var flowLogProperties FlowLogProperties + err = json.Unmarshal(*v, &flowLogProperties) + if err != nil { + return err + } + fli.FlowLogProperties = &flowLogProperties + } + case "flowAnalyticsConfiguration": + if v != nil { + var flowAnalyticsConfiguration TrafficAnalyticsProperties + err = json.Unmarshal(*v, &flowAnalyticsConfiguration) + if err != nil { + return err + } + fli.FlowAnalyticsConfiguration = &flowAnalyticsConfiguration + } + } + } + + return nil +} + +// FlowLogListResult list of flow logs. +type FlowLogListResult struct { + autorest.Response `json:"-"` + // Value - Information about flow log resource. + Value *[]FlowLog `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogListResult. +func (fllr FlowLogListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fllr.Value != nil { + objectMap["value"] = fllr.Value + } + return json.Marshal(objectMap) +} + +// FlowLogListResultIterator provides access to a complete listing of FlowLog values. +type FlowLogListResultIterator struct { + i int + page FlowLogListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FlowLogListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FlowLogListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FlowLogListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FlowLogListResultIterator) Response() FlowLogListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FlowLogListResultIterator) Value() FlowLog { + if !iter.page.NotDone() { + return FlowLog{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FlowLogListResultIterator type. +func NewFlowLogListResultIterator(page FlowLogListResultPage) FlowLogListResultIterator { + return FlowLogListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fllr FlowLogListResult) IsEmpty() bool { + return fllr.Value == nil || len(*fllr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fllr FlowLogListResult) hasNextLink() bool { + return fllr.NextLink != nil && len(*fllr.NextLink) != 0 +} + +// flowLogListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fllr FlowLogListResult) flowLogListResultPreparer(ctx context.Context) (*http.Request, error) { + if !fllr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fllr.NextLink))) +} + +// FlowLogListResultPage contains a page of FlowLog values. +type FlowLogListResultPage struct { + fn func(context.Context, FlowLogListResult) (FlowLogListResult, error) + fllr FlowLogListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FlowLogListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FlowLogListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fllr) + if err != nil { + return err + } + page.fllr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FlowLogListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FlowLogListResultPage) NotDone() bool { + return !page.fllr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FlowLogListResultPage) Response() FlowLogListResult { + return page.fllr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FlowLogListResultPage) Values() []FlowLog { + if page.fllr.IsEmpty() { + return nil + } + return *page.fllr.Value +} + +// Creates a new instance of the FlowLogListResultPage type. +func NewFlowLogListResultPage(cur FlowLogListResult, getNextPage func(context.Context, FlowLogListResult) (FlowLogListResult, error)) FlowLogListResultPage { + return FlowLogListResultPage{ + fn: getNextPage, + fllr: cur, + } +} + +// FlowLogProperties parameters that define the configuration of flow log. +type FlowLogProperties struct { + // StorageID - ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + // Enabled - Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` + // Format - Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` +} + +// FlowLogPropertiesFormat parameters that define the configuration of flow log. +type FlowLogPropertiesFormat struct { + // TargetResourceID - ID of network security group to which flow log will be applied. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // TargetResourceGUID - READ-ONLY; Guid of network security group to which flow log will be applied. + TargetResourceGUID *string `json:"targetResourceGuid,omitempty"` + // StorageID - ID of the storage account which is used to store the flow log. + StorageID *string `json:"storageId,omitempty"` + // Enabled - Flag to enable/disable flow logging. + Enabled *bool `json:"enabled,omitempty"` + // RetentionPolicy - Parameters that define the retention policy for flow log. + RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"` + // Format - Parameters that define the flow log format. + Format *FlowLogFormatParameters `json:"format,omitempty"` + // FlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + FlowAnalyticsConfiguration *TrafficAnalyticsProperties `json:"flowAnalyticsConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the flow log. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FlowLogPropertiesFormat. +func (flpf FlowLogPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if flpf.TargetResourceID != nil { + objectMap["targetResourceId"] = flpf.TargetResourceID + } + if flpf.StorageID != nil { + objectMap["storageId"] = flpf.StorageID + } + if flpf.Enabled != nil { + objectMap["enabled"] = flpf.Enabled + } + if flpf.RetentionPolicy != nil { + objectMap["retentionPolicy"] = flpf.RetentionPolicy + } + if flpf.Format != nil { + objectMap["format"] = flpf.Format + } + if flpf.FlowAnalyticsConfiguration != nil { + objectMap["flowAnalyticsConfiguration"] = flpf.FlowAnalyticsConfiguration + } + return json.Marshal(objectMap) +} + +// FlowLogsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FlowLogsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FlowLogsClient) (FlowLog, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FlowLogsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FlowLogsCreateOrUpdateFuture.Result. +func (future *FlowLogsCreateOrUpdateFuture) result(client FlowLogsClient) (fl FlowLog, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FlowLogsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fl.Response.Response, err = future.GetResult(sender); err == nil && fl.Response.Response.StatusCode != http.StatusNoContent { + fl, err = client.CreateOrUpdateResponder(fl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsCreateOrUpdateFuture", "Result", fl.Response.Response, "Failure responding to request") + } + } + return +} + +// FlowLogsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type FlowLogsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FlowLogsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FlowLogsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FlowLogsDeleteFuture.Result. +func (future *FlowLogsDeleteFuture) result(client FlowLogsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.FlowLogsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.FlowLogsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FlowLogStatusParameters parameters that define a resource to query flow log and traffic analytics +// (optional) status. +type FlowLogStatusParameters struct { + // TargetResourceID - The target resource where getting the flow log and traffic analytics (optional) status. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// FrontendIPConfiguration frontend IP address of the load balancer. +type FrontendIPConfiguration struct { + autorest.Response `json:"-"` + // FrontendIPConfigurationPropertiesFormat - Properties of the load balancer probe. + *FrontendIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendIPConfiguration. +func (fic FrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fic.FrontendIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = fic.FrontendIPConfigurationPropertiesFormat + } + if fic.Name != nil { + objectMap["name"] = fic.Name + } + if fic.Zones != nil { + objectMap["zones"] = fic.Zones + } + if fic.ID != nil { + objectMap["id"] = fic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FrontendIPConfiguration struct. +func (fic *FrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var frontendIPConfigurationPropertiesFormat FrontendIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &frontendIPConfigurationPropertiesFormat) + if err != nil { + return err + } + fic.FrontendIPConfigurationPropertiesFormat = &frontendIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + fic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fic.Type = &typeVar + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + fic.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fic.ID = &ID + } + } + } + + return nil +} + +// FrontendIPConfigurationPropertiesFormat properties of Frontend IP Configuration of the load balancer. +type FrontendIPConfigurationPropertiesFormat struct { + // InboundNatRules - READ-ONLY; An array of references to inbound rules that use this frontend IP. + InboundNatRules *[]SubResource `json:"inboundNatRules,omitempty"` + // InboundNatPools - READ-ONLY; An array of references to inbound pools that use this frontend IP. + InboundNatPools *[]SubResource `json:"inboundNatPools,omitempty"` + // OutboundRules - READ-ONLY; An array of references to outbound rules that use this frontend IP. + OutboundRules *[]SubResource `json:"outboundRules,omitempty"` + // LoadBalancingRules - READ-ONLY; An array of references to load balancing rules that use this frontend IP. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The Private IP allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // PrivateIPAddressVersion - Whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the Public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // PublicIPPrefix - The reference to the Public IP Prefix resource. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the frontend IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for FrontendIPConfigurationPropertiesFormat. +func (ficpf FrontendIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ficpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = ficpf.PrivateIPAddress + } + if ficpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = ficpf.PrivateIPAllocationMethod + } + if ficpf.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = ficpf.PrivateIPAddressVersion + } + if ficpf.Subnet != nil { + objectMap["subnet"] = ficpf.Subnet + } + if ficpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = ficpf.PublicIPAddress + } + if ficpf.PublicIPPrefix != nil { + objectMap["publicIPPrefix"] = ficpf.PublicIPPrefix + } + if ficpf.GatewayLoadBalancer != nil { + objectMap["gatewayLoadBalancer"] = ficpf.GatewayLoadBalancer + } + return json.Marshal(objectMap) +} + +// GatewayCustomBgpIPAddressIPConfiguration gatewayCustomBgpIpAddressIpConfiguration for a virtual network +// gateway connection. +type GatewayCustomBgpIPAddressIPConfiguration struct { + // IPConfigurationID - The IpconfigurationId of ipconfiguration which belongs to gateway. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + // CustomBgpIPAddress - The custom BgpPeeringAddress which belongs to IpconfigurationId. + CustomBgpIPAddress *string `json:"customBgpIpAddress,omitempty"` +} + +// GatewayLoadBalancerTunnelInterface gateway load balancer tunnel interface of a load balancer backend +// address pool. +type GatewayLoadBalancerTunnelInterface struct { + // Port - Port of gateway load balancer tunnel interface. + Port *int32 `json:"port,omitempty"` + // Identifier - Identifier of gateway load balancer tunnel interface. + Identifier *int32 `json:"identifier,omitempty"` + // Protocol - Protocol of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelProtocolNone', 'GatewayLoadBalancerTunnelProtocolNative', 'GatewayLoadBalancerTunnelProtocolVXLAN' + Protocol GatewayLoadBalancerTunnelProtocol `json:"protocol,omitempty"` + // Type - Traffic type of gateway load balancer tunnel interface. Possible values include: 'GatewayLoadBalancerTunnelInterfaceTypeNone', 'GatewayLoadBalancerTunnelInterfaceTypeInternal', 'GatewayLoadBalancerTunnelInterfaceTypeExternal' + Type GatewayLoadBalancerTunnelInterfaceType `json:"type,omitempty"` +} + +// GatewayRoute gateway routing details. +type GatewayRoute struct { + // LocalAddress - READ-ONLY; The gateway's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // NetworkProperty - READ-ONLY; The route's network prefix. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty"` + // SourcePeer - READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty"` + // Origin - READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty"` + // AsPath - READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty"` + // Weight - READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty"` +} + +// MarshalJSON is the custom marshaler for GatewayRoute. +func (gr GatewayRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GatewayRouteListResult list of virtual network gateway routes. +type GatewayRouteListResult struct { + autorest.Response `json:"-"` + // Value - List of gateway routes. + Value *[]GatewayRoute `json:"value,omitempty"` +} + +// GenerateExpressRoutePortsLOARequest the customer name to be printed on a letter of authorization. +type GenerateExpressRoutePortsLOARequest struct { + // CustomerName - The customer name. + CustomerName *string `json:"customerName,omitempty"` +} + +// GenerateExpressRoutePortsLOAResult response for GenerateExpressRoutePortsLOA API service call. +type GenerateExpressRoutePortsLOAResult struct { + autorest.Response `json:"-"` + // EncodedContent - The content as a base64 encoded string. + EncodedContent *string `json:"encodedContent,omitempty"` +} + +// GeneratevirtualwanvpnserverconfigurationvpnprofileFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type GeneratevirtualwanvpnserverconfigurationvpnprofileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (VpnProfileResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GeneratevirtualwanvpnserverconfigurationvpnprofileFuture.Result. +func (future *GeneratevirtualwanvpnserverconfigurationvpnprofileFuture) result(client BaseClient) (vpr VpnProfileResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { + vpr, err = client.GeneratevirtualwanvpnserverconfigurationvpnprofileResponder(vpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture", "Result", vpr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetActiveSessionsAllFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GetActiveSessionsAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionActiveSessionListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GetActiveSessionsAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GetActiveSessionsAllFuture.Result. +func (future *GetActiveSessionsAllFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + baslrp.baslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { + baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsAllFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetActiveSessionsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type GetActiveSessionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionActiveSessionListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *GetActiveSessionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for GetActiveSessionsFuture.Result. +func (future *GetActiveSessionsFuture) result(client BaseClient) (baslrp BastionActiveSessionListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + baslrp.baslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.GetActiveSessionsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if baslrp.baslr.Response.Response, err = future.GetResult(sender); err == nil && baslrp.baslr.Response.Response.StatusCode != http.StatusNoContent { + baslrp, err = client.GetActiveSessionsResponder(baslrp.baslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.GetActiveSessionsFuture", "Result", baslrp.baslr.Response.Response, "Failure responding to request") + } + } + return +} + +// GetVpnSitesConfigurationRequest list of Vpn-Sites. +type GetVpnSitesConfigurationRequest struct { + // VpnSites - List of resource-ids of the vpn-sites for which config is to be downloaded. + VpnSites *[]string `json:"vpnSites,omitempty"` + // OutputBlobSasURL - The sas-url to download the configurations for vpn-sites. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` +} + +// HopLink hop link. +type HopLink struct { + // NextHopID - READ-ONLY; The ID of the next hop. + NextHopID *string `json:"nextHopId,omitempty"` + // LinkType - READ-ONLY; Link type. + LinkType *string `json:"linkType,omitempty"` + // HopLinkProperties - Hop link properties. + *HopLinkProperties `json:"properties,omitempty"` + // Issues - READ-ONLY; List of issues. + Issues *[]ConnectivityIssue `json:"issues,omitempty"` + // Context - READ-ONLY; Provides additional context on links. + Context map[string]*string `json:"context"` + // ResourceID - READ-ONLY; Resource ID. + ResourceID *string `json:"resourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for HopLink. +func (hl HopLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hl.HopLinkProperties != nil { + objectMap["properties"] = hl.HopLinkProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HopLink struct. +func (hl *HopLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "nextHopId": + if v != nil { + var nextHopID string + err = json.Unmarshal(*v, &nextHopID) + if err != nil { + return err + } + hl.NextHopID = &nextHopID + } + case "linkType": + if v != nil { + var linkType string + err = json.Unmarshal(*v, &linkType) + if err != nil { + return err + } + hl.LinkType = &linkType + } + case "properties": + if v != nil { + var hopLinkProperties HopLinkProperties + err = json.Unmarshal(*v, &hopLinkProperties) + if err != nil { + return err + } + hl.HopLinkProperties = &hopLinkProperties + } + case "issues": + if v != nil { + var issues []ConnectivityIssue + err = json.Unmarshal(*v, &issues) + if err != nil { + return err + } + hl.Issues = &issues + } + case "context": + if v != nil { + var context map[string]*string + err = json.Unmarshal(*v, &context) + if err != nil { + return err + } + hl.Context = context + } + case "resourceId": + if v != nil { + var resourceID string + err = json.Unmarshal(*v, &resourceID) + if err != nil { + return err + } + hl.ResourceID = &resourceID + } + } + } + + return nil +} + +// HopLinkProperties hop link properties. +type HopLinkProperties struct { + // RoundTripTimeMin - READ-ONLY; Minimum roundtrip time in milliseconds. + RoundTripTimeMin *int64 `json:"roundTripTimeMin,omitempty"` + // RoundTripTimeAvg - READ-ONLY; Average roundtrip time in milliseconds. + RoundTripTimeAvg *int64 `json:"roundTripTimeAvg,omitempty"` + // RoundTripTimeMax - READ-ONLY; Maximum roundtrip time in milliseconds. + RoundTripTimeMax *int64 `json:"roundTripTimeMax,omitempty"` +} + +// MarshalJSON is the custom marshaler for HopLinkProperties. +func (hlp HopLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// HTTPConfiguration HTTP configuration of the connectivity check. +type HTTPConfiguration struct { + // Method - HTTP method. Possible values include: 'HTTPMethodGet' + Method HTTPMethod `json:"method,omitempty"` + // Headers - List of HTTP headers. + Headers *[]HTTPHeader `json:"headers,omitempty"` + // ValidStatusCodes - Valid status codes. + ValidStatusCodes *[]int32 `json:"validStatusCodes,omitempty"` +} + +// HTTPHeader the HTTP header. +type HTTPHeader struct { + // Name - The name in HTTP header. + Name *string `json:"name,omitempty"` + // Value - The value in HTTP header. + Value *string `json:"value,omitempty"` +} + +// HubIPAddresses IP addresses associated with azure firewall. +type HubIPAddresses struct { + // PublicIPs - Public IP addresses associated with azure firewall. + PublicIPs *HubPublicIPAddresses `json:"publicIPs,omitempty"` + // PrivateIPAddress - Private IP Address associated with azure firewall. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` +} + +// HubIPConfiguration ipConfigurations. +type HubIPConfiguration struct { + autorest.Response `json:"-"` + // HubIPConfigurationPropertiesFormat - The properties of the Virtual Hub IPConfigurations. + *HubIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the Ip Configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Ipconfiguration type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubIPConfiguration. +func (hic HubIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hic.HubIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = hic.HubIPConfigurationPropertiesFormat + } + if hic.Name != nil { + objectMap["name"] = hic.Name + } + if hic.ID != nil { + objectMap["id"] = hic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubIPConfiguration struct. +func (hic *HubIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubIPConfigurationPropertiesFormat HubIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &hubIPConfigurationPropertiesFormat) + if err != nil { + return err + } + hic.HubIPConfigurationPropertiesFormat = &hubIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hic.ID = &ID + } + } + } + + return nil +} + +// HubIPConfigurationPropertiesFormat properties of IP configuration. +type HubIPConfigurationPropertiesFormat struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubIPConfigurationPropertiesFormat. +func (hicpf HubIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hicpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = hicpf.PrivateIPAddress + } + if hicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = hicpf.PrivateIPAllocationMethod + } + if hicpf.Subnet != nil { + objectMap["subnet"] = hicpf.Subnet + } + if hicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = hicpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// HubPublicIPAddresses public IP addresses associated with azure firewall. +type HubPublicIPAddresses struct { + // Addresses - The list of Public IP addresses associated with azure firewall or IP addresses to be retained. + Addresses *[]AzureFirewallPublicIPAddress `json:"addresses,omitempty"` + // Count - The number of Public IP addresses associated with azure firewall. + Count *int32 `json:"count,omitempty"` +} + +// HubRoute routeTable route. +type HubRoute struct { + // Name - The name of the Route that is unique within a RouteTable. This name can be used to access this route. + Name *string `json:"name,omitempty"` + // DestinationType - The type of destinations (eg: CIDR, ResourceId, Service). + DestinationType *string `json:"destinationType,omitempty"` + // Destinations - List of all destinations. + Destinations *[]string `json:"destinations,omitempty"` + // NextHopType - The type of next hop (eg: ResourceId). + NextHopType *string `json:"nextHopType,omitempty"` + // NextHop - NextHop resource ID. + NextHop *string `json:"nextHop,omitempty"` +} + +// HubRouteTable routeTable resource in a virtual hub. +type HubRouteTable struct { + autorest.Response `json:"-"` + // HubRouteTableProperties - Properties of the RouteTable resource. + *HubRouteTableProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubRouteTable. +func (hrt HubRouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hrt.HubRouteTableProperties != nil { + objectMap["properties"] = hrt.HubRouteTableProperties + } + if hrt.Name != nil { + objectMap["name"] = hrt.Name + } + if hrt.ID != nil { + objectMap["id"] = hrt.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubRouteTable struct. +func (hrt *HubRouteTable) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubRouteTableProperties HubRouteTableProperties + err = json.Unmarshal(*v, &hubRouteTableProperties) + if err != nil { + return err + } + hrt.HubRouteTableProperties = &hubRouteTableProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hrt.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hrt.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + hrt.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hrt.ID = &ID + } + } + } + + return nil +} + +// HubRouteTableProperties parameters for RouteTable. +type HubRouteTableProperties struct { + // Routes - List of all routes. + Routes *[]HubRoute `json:"routes,omitempty"` + // Labels - List of labels associated with this route table. + Labels *[]string `json:"labels,omitempty"` + // AssociatedConnections - READ-ONLY; List of all connections associated with this route table. + AssociatedConnections *[]string `json:"associatedConnections,omitempty"` + // PropagatingConnections - READ-ONLY; List of all connections that advertise to this route table. + PropagatingConnections *[]string `json:"propagatingConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the RouteTable resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubRouteTableProperties. +func (hrtp HubRouteTableProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hrtp.Routes != nil { + objectMap["routes"] = hrtp.Routes + } + if hrtp.Labels != nil { + objectMap["labels"] = hrtp.Labels + } + return json.Marshal(objectMap) +} + +// HubRouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type HubRouteTablesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubRouteTablesClient) (HubRouteTable, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubRouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubRouteTablesCreateOrUpdateFuture.Result. +func (future *HubRouteTablesCreateOrUpdateFuture) result(client HubRouteTablesClient) (hrt HubRouteTable, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hrt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hrt.Response.Response, err = future.GetResult(sender); err == nil && hrt.Response.Response.StatusCode != http.StatusNoContent { + hrt, err = client.CreateOrUpdateResponder(hrt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesCreateOrUpdateFuture", "Result", hrt.Response.Response, "Failure responding to request") + } + } + return +} + +// HubRouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type HubRouteTablesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubRouteTablesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubRouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubRouteTablesDeleteFuture.Result. +func (future *HubRouteTablesDeleteFuture) result(client HubRouteTablesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubRouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubRouteTablesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// HubVirtualNetworkConnection hubVirtualNetworkConnection Resource. +type HubVirtualNetworkConnection struct { + autorest.Response `json:"-"` + // HubVirtualNetworkConnectionProperties - Properties of the hub virtual network connection. + *HubVirtualNetworkConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubVirtualNetworkConnection. +func (hvnc HubVirtualNetworkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hvnc.HubVirtualNetworkConnectionProperties != nil { + objectMap["properties"] = hvnc.HubVirtualNetworkConnectionProperties + } + if hvnc.Name != nil { + objectMap["name"] = hvnc.Name + } + if hvnc.ID != nil { + objectMap["id"] = hvnc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for HubVirtualNetworkConnection struct. +func (hvnc *HubVirtualNetworkConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var hubVirtualNetworkConnectionProperties HubVirtualNetworkConnectionProperties + err = json.Unmarshal(*v, &hubVirtualNetworkConnectionProperties) + if err != nil { + return err + } + hvnc.HubVirtualNetworkConnectionProperties = &hubVirtualNetworkConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + hvnc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + hvnc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + hvnc.ID = &ID + } + } + } + + return nil +} + +// HubVirtualNetworkConnectionProperties parameters for HubVirtualNetworkConnection. +type HubVirtualNetworkConnectionProperties struct { + // RemoteVirtualNetwork - Reference to the remote virtual network. + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + // AllowHubToRemoteVnetTransit - Deprecated: VirtualHub to RemoteVnet transit to enabled or not. + AllowHubToRemoteVnetTransit *bool `json:"allowHubToRemoteVnetTransit,omitempty"` + // AllowRemoteVnetToUseHubVnetGateways - Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. + AllowRemoteVnetToUseHubVnetGateways *bool `json:"allowRemoteVnetToUseHubVnetGateways,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the hub virtual network connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for HubVirtualNetworkConnectionProperties. +func (hvncp HubVirtualNetworkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if hvncp.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = hvncp.RemoteVirtualNetwork + } + if hvncp.AllowHubToRemoteVnetTransit != nil { + objectMap["allowHubToRemoteVnetTransit"] = hvncp.AllowHubToRemoteVnetTransit + } + if hvncp.AllowRemoteVnetToUseHubVnetGateways != nil { + objectMap["allowRemoteVnetToUseHubVnetGateways"] = hvncp.AllowRemoteVnetToUseHubVnetGateways + } + if hvncp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = hvncp.EnableInternetSecurity + } + if hvncp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = hvncp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// HubVirtualNetworkConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type HubVirtualNetworkConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubVirtualNetworkConnectionsClient) (HubVirtualNetworkConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubVirtualNetworkConnectionsCreateOrUpdateFuture.Result. +func (future *HubVirtualNetworkConnectionsCreateOrUpdateFuture) result(client HubVirtualNetworkConnectionsClient) (hvnc HubVirtualNetworkConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hvnc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hvnc.Response.Response, err = future.GetResult(sender); err == nil && hvnc.Response.Response.StatusCode != http.StatusNoContent { + hvnc, err = client.CreateOrUpdateResponder(hvnc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsCreateOrUpdateFuture", "Result", hvnc.Response.Response, "Failure responding to request") + } + } + return +} + +// HubVirtualNetworkConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type HubVirtualNetworkConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(HubVirtualNetworkConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *HubVirtualNetworkConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for HubVirtualNetworkConnectionsDeleteFuture.Result. +func (future *HubVirtualNetworkConnectionsDeleteFuture) result(client HubVirtualNetworkConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.HubVirtualNetworkConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.HubVirtualNetworkConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IDPSQueryObject will describe the query to run against the IDPS signatures DB +type IDPSQueryObject struct { + // Filters - Contain all filters names and values + Filters *[]FilterItems `json:"filters,omitempty"` + // Search - Search term in all columns + Search *string `json:"search,omitempty"` + // OrderBy - Column to sort response by + OrderBy *OrderBy `json:"orderBy,omitempty"` + // ResultsPerPage - The number of the results to return in each page + ResultsPerPage *int32 `json:"resultsPerPage,omitempty"` + // Skip - The number of records matching the filter to skip + Skip *int32 `json:"skip,omitempty"` +} + +// InboundNatPool inbound NAT pool of the load balancer. +type InboundNatPool struct { + // InboundNatPoolPropertiesFormat - Properties of load balancer inbound nat pool. + *InboundNatPoolPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatPool. +func (inp InboundNatPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inp.InboundNatPoolPropertiesFormat != nil { + objectMap["properties"] = inp.InboundNatPoolPropertiesFormat + } + if inp.Name != nil { + objectMap["name"] = inp.Name + } + if inp.ID != nil { + objectMap["id"] = inp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundNatPool struct. +func (inp *InboundNatPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundNatPoolPropertiesFormat InboundNatPoolPropertiesFormat + err = json.Unmarshal(*v, &inboundNatPoolPropertiesFormat) + if err != nil { + return err + } + inp.InboundNatPoolPropertiesFormat = &inboundNatPoolPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + inp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + inp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + inp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + inp.ID = &ID + } + } + } + + return nil +} + +// InboundNatPoolPropertiesFormat properties of Inbound NAT pool. +type InboundNatPoolPropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // Protocol - The reference to the transport protocol used by the inbound NAT pool. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPortRangeStart - The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65535. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT pool resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatPoolPropertiesFormat. +func (inppf InboundNatPoolPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inppf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = inppf.FrontendIPConfiguration + } + if inppf.Protocol != "" { + objectMap["protocol"] = inppf.Protocol + } + if inppf.FrontendPortRangeStart != nil { + objectMap["frontendPortRangeStart"] = inppf.FrontendPortRangeStart + } + if inppf.FrontendPortRangeEnd != nil { + objectMap["frontendPortRangeEnd"] = inppf.FrontendPortRangeEnd + } + if inppf.BackendPort != nil { + objectMap["backendPort"] = inppf.BackendPort + } + if inppf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = inppf.IdleTimeoutInMinutes + } + if inppf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = inppf.EnableFloatingIP + } + if inppf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = inppf.EnableTCPReset + } + return json.Marshal(objectMap) +} + +// InboundNatRule inbound NAT rule of the load balancer. +type InboundNatRule struct { + autorest.Response `json:"-"` + // InboundNatRulePropertiesFormat - Properties of load balancer inbound NAT rule. + *InboundNatRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRule. +func (inr InboundNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inr.InboundNatRulePropertiesFormat != nil { + objectMap["properties"] = inr.InboundNatRulePropertiesFormat + } + if inr.Name != nil { + objectMap["name"] = inr.Name + } + if inr.ID != nil { + objectMap["id"] = inr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundNatRule struct. +func (inr *InboundNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundNatRulePropertiesFormat InboundNatRulePropertiesFormat + err = json.Unmarshal(*v, &inboundNatRulePropertiesFormat) + if err != nil { + return err + } + inr.InboundNatRulePropertiesFormat = &inboundNatRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + inr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + inr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + inr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + inr.ID = &ID + } + } + } + + return nil +} + +// InboundNatRuleListResult response for ListInboundNatRule API service call. +type InboundNatRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of inbound NAT rules in a load balancer. + Value *[]InboundNatRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRuleListResult. +func (inrlr InboundNatRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inrlr.Value != nil { + objectMap["value"] = inrlr.Value + } + return json.Marshal(objectMap) +} + +// InboundNatRuleListResultIterator provides access to a complete listing of InboundNatRule values. +type InboundNatRuleListResultIterator struct { + i int + page InboundNatRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InboundNatRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InboundNatRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InboundNatRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InboundNatRuleListResultIterator) Response() InboundNatRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InboundNatRuleListResultIterator) Value() InboundNatRule { + if !iter.page.NotDone() { + return InboundNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InboundNatRuleListResultIterator type. +func NewInboundNatRuleListResultIterator(page InboundNatRuleListResultPage) InboundNatRuleListResultIterator { + return InboundNatRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (inrlr InboundNatRuleListResult) IsEmpty() bool { + return inrlr.Value == nil || len(*inrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (inrlr InboundNatRuleListResult) hasNextLink() bool { + return inrlr.NextLink != nil && len(*inrlr.NextLink) != 0 +} + +// inboundNatRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (inrlr InboundNatRuleListResult) inboundNatRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !inrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(inrlr.NextLink))) +} + +// InboundNatRuleListResultPage contains a page of InboundNatRule values. +type InboundNatRuleListResultPage struct { + fn func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error) + inrlr InboundNatRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InboundNatRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InboundNatRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.inrlr) + if err != nil { + return err + } + page.inrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InboundNatRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InboundNatRuleListResultPage) NotDone() bool { + return !page.inrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InboundNatRuleListResultPage) Response() InboundNatRuleListResult { + return page.inrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InboundNatRuleListResultPage) Values() []InboundNatRule { + if page.inrlr.IsEmpty() { + return nil + } + return *page.inrlr.Value +} + +// Creates a new instance of the InboundNatRuleListResultPage type. +func NewInboundNatRuleListResultPage(cur InboundNatRuleListResult, getNextPage func(context.Context, InboundNatRuleListResult) (InboundNatRuleListResult, error)) InboundNatRuleListResultPage { + return InboundNatRuleListResultPage{ + fn: getNextPage, + inrlr: cur, + } +} + +// InboundNatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. +type InboundNatRulePortMapping struct { + // InboundNatRuleName - READ-ONLY; Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` + // Protocol - READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPort - READ-ONLY; Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - READ-ONLY; Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRulePortMapping. +func (inrpm InboundNatRulePortMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InboundNatRulePropertiesFormat properties of the inbound NAT rule. +type InboundNatRulePropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // BackendIPConfiguration - READ-ONLY; A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP. + BackendIPConfiguration *InterfaceIPConfiguration `json:"backendIPConfiguration,omitempty"` + // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // FrontendPort - The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values range from 1 to 65534. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port used for the internal endpoint. Acceptable values range from 1 to 65535. + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // FrontendPortRangeStart - The port range start for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeEnd. Individual inbound NAT rule port mappings will be created for each backend address from BackendAddressPool. Acceptable values range from 1 to 65534. + FrontendPortRangeStart *int32 `json:"frontendPortRangeStart,omitempty"` + // FrontendPortRangeEnd - The port range end for the external endpoint. This property is used together with BackendAddressPool and FrontendPortRangeStart. Individual inbound NAT rule port mappings will be created for each backend address from BackendAddressPool. Acceptable values range from 1 to 65534. + FrontendPortRangeEnd *int32 `json:"frontendPortRangeEnd,omitempty"` + // BackendAddressPool - A reference to backendAddressPool resource. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the inbound NAT rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundNatRulePropertiesFormat. +func (inrpf InboundNatRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if inrpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = inrpf.FrontendIPConfiguration + } + if inrpf.Protocol != "" { + objectMap["protocol"] = inrpf.Protocol + } + if inrpf.FrontendPort != nil { + objectMap["frontendPort"] = inrpf.FrontendPort + } + if inrpf.BackendPort != nil { + objectMap["backendPort"] = inrpf.BackendPort + } + if inrpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = inrpf.IdleTimeoutInMinutes + } + if inrpf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = inrpf.EnableFloatingIP + } + if inrpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = inrpf.EnableTCPReset + } + if inrpf.FrontendPortRangeStart != nil { + objectMap["frontendPortRangeStart"] = inrpf.FrontendPortRangeStart + } + if inrpf.FrontendPortRangeEnd != nil { + objectMap["frontendPortRangeEnd"] = inrpf.FrontendPortRangeEnd + } + if inrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = inrpf.BackendAddressPool + } + return json.Marshal(objectMap) +} + +// InboundNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InboundNatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundNatRulesClient) (InboundNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundNatRulesCreateOrUpdateFuture.Result. +func (future *InboundNatRulesCreateOrUpdateFuture) result(client InboundNatRulesClient) (inr InboundNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + inr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if inr.Response.Response, err = future.GetResult(sender); err == nil && inr.Response.Response.StatusCode != http.StatusNoContent { + inr, err = client.CreateOrUpdateResponder(inr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesCreateOrUpdateFuture", "Result", inr.Response.Response, "Failure responding to request") + } + } + return +} + +// InboundNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InboundNatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundNatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundNatRulesDeleteFuture.Result. +func (future *InboundNatRulesDeleteFuture) result(client InboundNatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundNatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InboundSecurityRule NVA Inbound Security Rule resource. +type InboundSecurityRule struct { + autorest.Response `json:"-"` + // InboundSecurityRuleProperties - The properties of the Inbound Security Rules. + *InboundSecurityRuleProperties `json:"properties,omitempty"` + // Name - Name of security rule collection. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; NVA inbound security rule type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundSecurityRule. +func (isr InboundSecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if isr.InboundSecurityRuleProperties != nil { + objectMap["properties"] = isr.InboundSecurityRuleProperties + } + if isr.Name != nil { + objectMap["name"] = isr.Name + } + if isr.ID != nil { + objectMap["id"] = isr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InboundSecurityRule struct. +func (isr *InboundSecurityRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var inboundSecurityRuleProperties InboundSecurityRuleProperties + err = json.Unmarshal(*v, &inboundSecurityRuleProperties) + if err != nil { + return err + } + isr.InboundSecurityRuleProperties = &inboundSecurityRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + isr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + isr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + isr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + isr.ID = &ID + } + } + } + + return nil +} + +// InboundSecurityRuleCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InboundSecurityRuleCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InboundSecurityRuleClient) (InboundSecurityRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InboundSecurityRuleCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InboundSecurityRuleCreateOrUpdateFuture.Result. +func (future *InboundSecurityRuleCreateOrUpdateFuture) result(client InboundSecurityRuleClient) (isr InboundSecurityRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + isr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InboundSecurityRuleCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if isr.Response.Response, err = future.GetResult(sender); err == nil && isr.Response.Response.StatusCode != http.StatusNoContent { + isr, err = client.CreateOrUpdateResponder(isr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InboundSecurityRuleCreateOrUpdateFuture", "Result", isr.Response.Response, "Failure responding to request") + } + } + return +} + +// InboundSecurityRuleProperties properties of the Inbound Security Rules resource. +type InboundSecurityRuleProperties struct { + // Rules - List of allowed rules. + Rules *[]InboundSecurityRules `json:"rules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InboundSecurityRuleProperties. +func (isrp InboundSecurityRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if isrp.Rules != nil { + objectMap["rules"] = isrp.Rules + } + return json.Marshal(objectMap) +} + +// InboundSecurityRules properties of the Inbound Security Rules resource. +type InboundSecurityRules struct { + // Protocol - Protocol. This should be either TCP or UDP. Possible values include: 'InboundSecurityRulesProtocolTCP', 'InboundSecurityRulesProtocolUDP' + Protocol InboundSecurityRulesProtocol `json:"protocol,omitempty"` + // SourceAddressPrefix - The CIDR or source IP range. Only /30, /31 and /32 Ip ranges are allowed. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // DestinationPortRange - NVA port ranges to be opened up. One needs to provide specific ports. + DestinationPortRange *int32 `json:"destinationPortRange,omitempty"` +} + +// IntentPolicy network Intent Policy resource. +type IntentPolicy struct { + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IntentPolicy. +func (IP IntentPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if IP.ID != nil { + objectMap["id"] = IP.ID + } + if IP.Location != nil { + objectMap["location"] = IP.Location + } + if IP.Tags != nil { + objectMap["tags"] = IP.Tags + } + return json.Marshal(objectMap) +} + +// IntentPolicyConfiguration details of NetworkIntentPolicyConfiguration for PrepareNetworkPoliciesRequest. +type IntentPolicyConfiguration struct { + // NetworkIntentPolicyName - The name of the Network Intent Policy for storing in target subscription. + NetworkIntentPolicyName *string `json:"networkIntentPolicyName,omitempty"` + // SourceNetworkIntentPolicy - Source network intent policy. + SourceNetworkIntentPolicy *IntentPolicy `json:"sourceNetworkIntentPolicy,omitempty"` +} + +// Interface a network interface in a resource group. +type Interface struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the network interface. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // InterfacePropertiesFormat - Properties of the network interface. + *InterfacePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Interface. +func (i Interface) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.ExtendedLocation != nil { + objectMap["extendedLocation"] = i.ExtendedLocation + } + if i.InterfacePropertiesFormat != nil { + objectMap["properties"] = i.InterfacePropertiesFormat + } + if i.ID != nil { + objectMap["id"] = i.ID + } + if i.Location != nil { + objectMap["location"] = i.Location + } + if i.Tags != nil { + objectMap["tags"] = i.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Interface struct. +func (i *Interface) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + i.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var interfacePropertiesFormat InterfacePropertiesFormat + err = json.Unmarshal(*v, &interfacePropertiesFormat) + if err != nil { + return err + } + i.InterfacePropertiesFormat = &interfacePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + i.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + i.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + i.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + i.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + i.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + i.Tags = tags + } + } + } + + return nil +} + +// InterfaceAssociation network interface and its custom security rules. +type InterfaceAssociation struct { + // ID - READ-ONLY; Network interface ID. + ID *string `json:"id,omitempty"` + // SecurityRules - Collection of custom security rules. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceAssociation. +func (ia InterfaceAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.SecurityRules != nil { + objectMap["securityRules"] = ia.SecurityRules + } + return json.Marshal(objectMap) +} + +// InterfaceDNSSettings DNS settings of a network interface. +type InterfaceDNSSettings struct { + // DNSServers - List of DNS servers IP addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the only value in dnsServers collection. + DNSServers *[]string `json:"dnsServers,omitempty"` + // AppliedDNSServers - READ-ONLY; If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set. This property is what is configured on each of those VMs. + AppliedDNSServers *[]string `json:"appliedDnsServers,omitempty"` + // InternalDNSNameLabel - Relative DNS name for this NIC used for internal communications between VMs in the same virtual network. + InternalDNSNameLabel *string `json:"internalDnsNameLabel,omitempty"` + // InternalFqdn - READ-ONLY; Fully qualified DNS name supporting internal communications between VMs in the same virtual network. + InternalFqdn *string `json:"internalFqdn,omitempty"` + // InternalDomainNameSuffix - READ-ONLY; Even if internalDnsNameLabel is not specified, a DNS entry is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the VM name with the value of internalDomainNameSuffix. + InternalDomainNameSuffix *string `json:"internalDomainNameSuffix,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceDNSSettings. +func (ids InterfaceDNSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ids.DNSServers != nil { + objectMap["dnsServers"] = ids.DNSServers + } + if ids.InternalDNSNameLabel != nil { + objectMap["internalDnsNameLabel"] = ids.InternalDNSNameLabel + } + return json.Marshal(objectMap) +} + +// InterfaceIPConfiguration iPConfiguration in a network interface. +type InterfaceIPConfiguration struct { + autorest.Response `json:"-"` + // InterfaceIPConfigurationPropertiesFormat - Network interface IP configuration properties. + *InterfaceIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfiguration. +func (iic InterfaceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iic.InterfaceIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = iic.InterfaceIPConfigurationPropertiesFormat + } + if iic.Name != nil { + objectMap["name"] = iic.Name + } + if iic.Type != nil { + objectMap["type"] = iic.Type + } + if iic.ID != nil { + objectMap["id"] = iic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InterfaceIPConfiguration struct. +func (iic *InterfaceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var interfaceIPConfigurationPropertiesFormat InterfaceIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &interfaceIPConfigurationPropertiesFormat) + if err != nil { + return err + } + iic.InterfaceIPConfigurationPropertiesFormat = &interfaceIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + iic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + iic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + iic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + iic.ID = &ID + } + } + } + + return nil +} + +// InterfaceIPConfigurationListResult response for list ip configurations API service call. +type InterfaceIPConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of ip configurations. + Value *[]InterfaceIPConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationListResult. +func (iiclr InterfaceIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iiclr.Value != nil { + objectMap["value"] = iiclr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceIPConfigurationListResultIterator provides access to a complete listing of +// InterfaceIPConfiguration values. +type InterfaceIPConfigurationListResultIterator struct { + i int + page InterfaceIPConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceIPConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceIPConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceIPConfigurationListResultIterator) Response() InterfaceIPConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceIPConfigurationListResultIterator) Value() InterfaceIPConfiguration { + if !iter.page.NotDone() { + return InterfaceIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceIPConfigurationListResultIterator type. +func NewInterfaceIPConfigurationListResultIterator(page InterfaceIPConfigurationListResultPage) InterfaceIPConfigurationListResultIterator { + return InterfaceIPConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (iiclr InterfaceIPConfigurationListResult) IsEmpty() bool { + return iiclr.Value == nil || len(*iiclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (iiclr InterfaceIPConfigurationListResult) hasNextLink() bool { + return iiclr.NextLink != nil && len(*iiclr.NextLink) != 0 +} + +// interfaceIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (iiclr InterfaceIPConfigurationListResult) interfaceIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iiclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(iiclr.NextLink))) +} + +// InterfaceIPConfigurationListResultPage contains a page of InterfaceIPConfiguration values. +type InterfaceIPConfigurationListResultPage struct { + fn func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error) + iiclr InterfaceIPConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceIPConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.iiclr) + if err != nil { + return err + } + page.iiclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceIPConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceIPConfigurationListResultPage) NotDone() bool { + return !page.iiclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceIPConfigurationListResultPage) Response() InterfaceIPConfigurationListResult { + return page.iiclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceIPConfigurationListResultPage) Values() []InterfaceIPConfiguration { + if page.iiclr.IsEmpty() { + return nil + } + return *page.iiclr.Value +} + +// Creates a new instance of the InterfaceIPConfigurationListResultPage type. +func NewInterfaceIPConfigurationListResultPage(cur InterfaceIPConfigurationListResult, getNextPage func(context.Context, InterfaceIPConfigurationListResult) (InterfaceIPConfigurationListResult, error)) InterfaceIPConfigurationListResultPage { + return InterfaceIPConfigurationListResultPage{ + fn: getNextPage, + iiclr: cur, + } +} + +// InterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnection properties for the network +// interface. +type InterfaceIPConfigurationPrivateLinkConnectionProperties struct { + // GroupID - READ-ONLY; The group ID for current private link connection. + GroupID *string `json:"groupId,omitempty"` + // RequiredMemberName - READ-ONLY; The required member name for current private link connection. + RequiredMemberName *string `json:"requiredMemberName,omitempty"` + // Fqdns - READ-ONLY; List of FQDNs for current private link connection. + Fqdns *[]string `json:"fqdns,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPrivateLinkConnectionProperties. +func (iicplcp InterfaceIPConfigurationPrivateLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// InterfaceIPConfigurationPropertiesFormat properties of IP configuration. +type InterfaceIPConfigurationPropertiesFormat struct { + // GatewayLoadBalancer - The reference to gateway load balancer frontend IP. + GatewayLoadBalancer *SubResource `json:"gatewayLoadBalancer,omitempty"` + // VirtualNetworkTaps - The reference to Virtual Network Taps. + VirtualNetworkTaps *[]VirtualNetworkTap `json:"virtualNetworkTaps,omitempty"` + // ApplicationGatewayBackendAddressPools - The reference to ApplicationGatewayBackendAddressPool resource. + ApplicationGatewayBackendAddressPools *[]ApplicationGatewayBackendAddressPool `json:"applicationGatewayBackendAddressPools,omitempty"` + // LoadBalancerBackendAddressPools - The reference to LoadBalancerBackendAddressPool resource. + LoadBalancerBackendAddressPools *[]BackendAddressPool `json:"loadBalancerBackendAddressPools,omitempty"` + // LoadBalancerInboundNatRules - A list of references of LoadBalancerInboundNatRules. + LoadBalancerInboundNatRules *[]InboundNatRule `json:"loadBalancerInboundNatRules,omitempty"` + // PrivateIPAddress - Private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` + // Subnet - Subnet bound to the IP configuration. + Subnet *Subnet `json:"subnet,omitempty"` + // Primary - Whether this is a primary customer address on the network interface. + Primary *bool `json:"primary,omitempty"` + // PublicIPAddress - Public IP address bound to the IP configuration. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ApplicationSecurityGroups - Application security groups in which the IP configuration is included. + ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface IP configuration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkConnectionProperties - READ-ONLY; PrivateLinkConnection properties for the network interface. + PrivateLinkConnectionProperties *InterfaceIPConfigurationPrivateLinkConnectionProperties `json:"privateLinkConnectionProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceIPConfigurationPropertiesFormat. +func (iicpf InterfaceIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iicpf.GatewayLoadBalancer != nil { + objectMap["gatewayLoadBalancer"] = iicpf.GatewayLoadBalancer + } + if iicpf.VirtualNetworkTaps != nil { + objectMap["virtualNetworkTaps"] = iicpf.VirtualNetworkTaps + } + if iicpf.ApplicationGatewayBackendAddressPools != nil { + objectMap["applicationGatewayBackendAddressPools"] = iicpf.ApplicationGatewayBackendAddressPools + } + if iicpf.LoadBalancerBackendAddressPools != nil { + objectMap["loadBalancerBackendAddressPools"] = iicpf.LoadBalancerBackendAddressPools + } + if iicpf.LoadBalancerInboundNatRules != nil { + objectMap["loadBalancerInboundNatRules"] = iicpf.LoadBalancerInboundNatRules + } + if iicpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = iicpf.PrivateIPAddress + } + if iicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = iicpf.PrivateIPAllocationMethod + } + if iicpf.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = iicpf.PrivateIPAddressVersion + } + if iicpf.Subnet != nil { + objectMap["subnet"] = iicpf.Subnet + } + if iicpf.Primary != nil { + objectMap["primary"] = iicpf.Primary + } + if iicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = iicpf.PublicIPAddress + } + if iicpf.ApplicationSecurityGroups != nil { + objectMap["applicationSecurityGroups"] = iicpf.ApplicationSecurityGroups + } + return json.Marshal(objectMap) +} + +// InterfaceListResult response for the ListNetworkInterface API service call. +type InterfaceListResult struct { + autorest.Response `json:"-"` + // Value - A list of network interfaces in a resource group. + Value *[]Interface `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceListResult. +func (ilr InterfaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ilr.Value != nil { + objectMap["value"] = ilr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceListResultIterator provides access to a complete listing of Interface values. +type InterfaceListResultIterator struct { + i int + page InterfaceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceListResultIterator) Response() InterfaceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceListResultIterator) Value() Interface { + if !iter.page.NotDone() { + return Interface{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceListResultIterator type. +func NewInterfaceListResultIterator(page InterfaceListResultPage) InterfaceListResultIterator { + return InterfaceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilr InterfaceListResult) IsEmpty() bool { + return ilr.Value == nil || len(*ilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ilr InterfaceListResult) hasNextLink() bool { + return ilr.NextLink != nil && len(*ilr.NextLink) != 0 +} + +// interfaceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilr InterfaceListResult) interfaceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilr.NextLink))) +} + +// InterfaceListResultPage contains a page of Interface values. +type InterfaceListResultPage struct { + fn func(context.Context, InterfaceListResult) (InterfaceListResult, error) + ilr InterfaceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ilr) + if err != nil { + return err + } + page.ilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceListResultPage) NotDone() bool { + return !page.ilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceListResultPage) Response() InterfaceListResult { + return page.ilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceListResultPage) Values() []Interface { + if page.ilr.IsEmpty() { + return nil + } + return *page.ilr.Value +} + +// Creates a new instance of the InterfaceListResultPage type. +func NewInterfaceListResultPage(cur InterfaceListResult, getNextPage func(context.Context, InterfaceListResult) (InterfaceListResult, error)) InterfaceListResultPage { + return InterfaceListResultPage{ + fn: getNextPage, + ilr: cur, + } +} + +// InterfaceLoadBalancerListResult response for list ip configurations API service call. +type InterfaceLoadBalancerListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancers. + Value *[]LoadBalancer `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceLoadBalancerListResult. +func (ilblr InterfaceLoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ilblr.Value != nil { + objectMap["value"] = ilblr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceLoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. +type InterfaceLoadBalancerListResultIterator struct { + i int + page InterfaceLoadBalancerListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceLoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceLoadBalancerListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceLoadBalancerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceLoadBalancerListResultIterator) Response() InterfaceLoadBalancerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceLoadBalancerListResultIterator) Value() LoadBalancer { + if !iter.page.NotDone() { + return LoadBalancer{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceLoadBalancerListResultIterator type. +func NewInterfaceLoadBalancerListResultIterator(page InterfaceLoadBalancerListResultPage) InterfaceLoadBalancerListResultIterator { + return InterfaceLoadBalancerListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ilblr InterfaceLoadBalancerListResult) IsEmpty() bool { + return ilblr.Value == nil || len(*ilblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ilblr InterfaceLoadBalancerListResult) hasNextLink() bool { + return ilblr.NextLink != nil && len(*ilblr.NextLink) != 0 +} + +// interfaceLoadBalancerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ilblr InterfaceLoadBalancerListResult) interfaceLoadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ilblr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ilblr.NextLink))) +} + +// InterfaceLoadBalancerListResultPage contains a page of LoadBalancer values. +type InterfaceLoadBalancerListResultPage struct { + fn func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error) + ilblr InterfaceLoadBalancerListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceLoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceLoadBalancerListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ilblr) + if err != nil { + return err + } + page.ilblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceLoadBalancerListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceLoadBalancerListResultPage) NotDone() bool { + return !page.ilblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceLoadBalancerListResultPage) Response() InterfaceLoadBalancerListResult { + return page.ilblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceLoadBalancerListResultPage) Values() []LoadBalancer { + if page.ilblr.IsEmpty() { + return nil + } + return *page.ilblr.Value +} + +// Creates a new instance of the InterfaceLoadBalancerListResultPage type. +func NewInterfaceLoadBalancerListResultPage(cur InterfaceLoadBalancerListResult, getNextPage func(context.Context, InterfaceLoadBalancerListResult) (InterfaceLoadBalancerListResult, error)) InterfaceLoadBalancerListResultPage { + return InterfaceLoadBalancerListResultPage{ + fn: getNextPage, + ilblr: cur, + } +} + +// InterfacePropertiesFormat networkInterface properties. +type InterfacePropertiesFormat struct { + // VirtualMachine - READ-ONLY; The reference to a virtual machine. + VirtualMachine *SubResource `json:"virtualMachine,omitempty"` + // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + // PrivateEndpoint - READ-ONLY; A reference to the private endpoint to which the network interface is linked. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // IPConfigurations - A list of IPConfigurations of the network interface. + IPConfigurations *[]InterfaceIPConfiguration `json:"ipConfigurations,omitempty"` + // TapConfigurations - READ-ONLY; A list of TapConfigurations of the network interface. + TapConfigurations *[]InterfaceTapConfiguration `json:"tapConfigurations,omitempty"` + // DNSSettings - The DNS settings in network interface. + DNSSettings *InterfaceDNSSettings `json:"dnsSettings,omitempty"` + // MacAddress - READ-ONLY; The MAC address of the network interface. + MacAddress *string `json:"macAddress,omitempty"` + // Primary - READ-ONLY; Whether this is a primary network interface on a virtual machine. + Primary *bool `json:"primary,omitempty"` + // VnetEncryptionSupported - READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. + VnetEncryptionSupported *bool `json:"vnetEncryptionSupported,omitempty"` + // EnableAcceleratedNetworking - If the network interface is accelerated networking enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + // EnableIPForwarding - Indicates whether IP forwarding is enabled on this network interface. + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + // HostedWorkloads - READ-ONLY; A list of references to linked BareMetal resources. + HostedWorkloads *[]string `json:"hostedWorkloads,omitempty"` + // DscpConfiguration - READ-ONLY; A reference to the dscp configuration to which the network interface is linked. + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network interface resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // WorkloadType - WorkloadType of the NetworkInterface for BareMetal resources + WorkloadType *string `json:"workloadType,omitempty"` + // NicType - Type of Network Interface resource. Possible values include: 'InterfaceNicTypeStandard', 'InterfaceNicTypeElastic' + NicType InterfaceNicType `json:"nicType,omitempty"` + // PrivateLinkService - Privatelinkservice of the network interface resource. + PrivateLinkService *PrivateLinkService `json:"privateLinkService,omitempty"` + // MigrationPhase - Migration phase of Network Interface resource. Possible values include: 'InterfaceMigrationPhaseNone', 'InterfaceMigrationPhasePrepare', 'InterfaceMigrationPhaseCommit', 'InterfaceMigrationPhaseAbort', 'InterfaceMigrationPhaseCommitted' + MigrationPhase InterfaceMigrationPhase `json:"migrationPhase,omitempty"` + // AuxiliaryMode - Auxiliary mode of Network Interface resource. Possible values include: 'InterfaceAuxiliaryModeNone', 'InterfaceAuxiliaryModeMaxConnections', 'InterfaceAuxiliaryModeFloating' + AuxiliaryMode InterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfacePropertiesFormat. +func (ipf InterfacePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ipf.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = ipf.NetworkSecurityGroup + } + if ipf.IPConfigurations != nil { + objectMap["ipConfigurations"] = ipf.IPConfigurations + } + if ipf.DNSSettings != nil { + objectMap["dnsSettings"] = ipf.DNSSettings + } + if ipf.EnableAcceleratedNetworking != nil { + objectMap["enableAcceleratedNetworking"] = ipf.EnableAcceleratedNetworking + } + if ipf.EnableIPForwarding != nil { + objectMap["enableIPForwarding"] = ipf.EnableIPForwarding + } + if ipf.WorkloadType != nil { + objectMap["workloadType"] = ipf.WorkloadType + } + if ipf.NicType != "" { + objectMap["nicType"] = ipf.NicType + } + if ipf.PrivateLinkService != nil { + objectMap["privateLinkService"] = ipf.PrivateLinkService + } + if ipf.MigrationPhase != "" { + objectMap["migrationPhase"] = ipf.MigrationPhase + } + if ipf.AuxiliaryMode != "" { + objectMap["auxiliaryMode"] = ipf.AuxiliaryMode + } + return json.Marshal(objectMap) +} + +// InterfacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfacesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (Interface, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesCreateOrUpdateFuture.Result. +func (future *InterfacesCreateOrUpdateFuture) result(client InterfacesClient) (i Interface, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + i.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if i.Response.Response, err = future.GetResult(sender); err == nil && i.Response.Response.StatusCode != http.StatusNoContent { + i, err = client.CreateOrUpdateResponder(i.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesCreateOrUpdateFuture", "Result", i.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type InterfacesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesDeleteFuture.Result. +func (future *InterfacesDeleteFuture) result(client InterfacesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// InterfacesGetEffectiveRouteTableFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfacesGetEffectiveRouteTableFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (EffectiveRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesGetEffectiveRouteTableFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesGetEffectiveRouteTableFuture.Result. +func (future *InterfacesGetEffectiveRouteTableFuture) result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + erlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesGetEffectiveRouteTableFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if erlr.Response.Response, err = future.GetResult(sender); err == nil && erlr.Response.Response.StatusCode != http.StatusNoContent { + erlr, err = client.GetEffectiveRouteTableResponder(erlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesGetEffectiveRouteTableFuture", "Result", erlr.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfacesListEffectiveNetworkSecurityGroupsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type InterfacesListEffectiveNetworkSecurityGroupsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfacesClient) (EffectiveNetworkSecurityGroupListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfacesListEffectiveNetworkSecurityGroupsFuture.Result. +func (future *InterfacesListEffectiveNetworkSecurityGroupsFuture) result(client InterfacesClient) (ensglr EffectiveNetworkSecurityGroupListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ensglr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfacesListEffectiveNetworkSecurityGroupsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ensglr.Response.Response, err = future.GetResult(sender); err == nil && ensglr.Response.Response.StatusCode != http.StatusNoContent { + ensglr, err = client.ListEffectiveNetworkSecurityGroupsResponder(ensglr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfacesListEffectiveNetworkSecurityGroupsFuture", "Result", ensglr.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfaceTapConfiguration tap configuration in a Network Interface. +type InterfaceTapConfiguration struct { + autorest.Response `json:"-"` + // InterfaceTapConfigurationPropertiesFormat - Properties of the Virtual Network Tap configuration. + *InterfaceTapConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfiguration. +func (itc InterfaceTapConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itc.InterfaceTapConfigurationPropertiesFormat != nil { + objectMap["properties"] = itc.InterfaceTapConfigurationPropertiesFormat + } + if itc.Name != nil { + objectMap["name"] = itc.Name + } + if itc.ID != nil { + objectMap["id"] = itc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for InterfaceTapConfiguration struct. +func (itc *InterfaceTapConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var interfaceTapConfigurationPropertiesFormat InterfaceTapConfigurationPropertiesFormat + err = json.Unmarshal(*v, &interfaceTapConfigurationPropertiesFormat) + if err != nil { + return err + } + itc.InterfaceTapConfigurationPropertiesFormat = &interfaceTapConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + itc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itc.ID = &ID + } + } + } + + return nil +} + +// InterfaceTapConfigurationListResult response for list tap configurations API service call. +type InterfaceTapConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of tap configurations. + Value *[]InterfaceTapConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfigurationListResult. +func (itclr InterfaceTapConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itclr.Value != nil { + objectMap["value"] = itclr.Value + } + return json.Marshal(objectMap) +} + +// InterfaceTapConfigurationListResultIterator provides access to a complete listing of +// InterfaceTapConfiguration values. +type InterfaceTapConfigurationListResultIterator struct { + i int + page InterfaceTapConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *InterfaceTapConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *InterfaceTapConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter InterfaceTapConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter InterfaceTapConfigurationListResultIterator) Response() InterfaceTapConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter InterfaceTapConfigurationListResultIterator) Value() InterfaceTapConfiguration { + if !iter.page.NotDone() { + return InterfaceTapConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the InterfaceTapConfigurationListResultIterator type. +func NewInterfaceTapConfigurationListResultIterator(page InterfaceTapConfigurationListResultPage) InterfaceTapConfigurationListResultIterator { + return InterfaceTapConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (itclr InterfaceTapConfigurationListResult) IsEmpty() bool { + return itclr.Value == nil || len(*itclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (itclr InterfaceTapConfigurationListResult) hasNextLink() bool { + return itclr.NextLink != nil && len(*itclr.NextLink) != 0 +} + +// interfaceTapConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (itclr InterfaceTapConfigurationListResult) interfaceTapConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !itclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(itclr.NextLink))) +} + +// InterfaceTapConfigurationListResultPage contains a page of InterfaceTapConfiguration values. +type InterfaceTapConfigurationListResultPage struct { + fn func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error) + itclr InterfaceTapConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *InterfaceTapConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InterfaceTapConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.itclr) + if err != nil { + return err + } + page.itclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *InterfaceTapConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page InterfaceTapConfigurationListResultPage) NotDone() bool { + return !page.itclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page InterfaceTapConfigurationListResultPage) Response() InterfaceTapConfigurationListResult { + return page.itclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page InterfaceTapConfigurationListResultPage) Values() []InterfaceTapConfiguration { + if page.itclr.IsEmpty() { + return nil + } + return *page.itclr.Value +} + +// Creates a new instance of the InterfaceTapConfigurationListResultPage type. +func NewInterfaceTapConfigurationListResultPage(cur InterfaceTapConfigurationListResult, getNextPage func(context.Context, InterfaceTapConfigurationListResult) (InterfaceTapConfigurationListResult, error)) InterfaceTapConfigurationListResultPage { + return InterfaceTapConfigurationListResultPage{ + fn: getNextPage, + itclr: cur, + } +} + +// InterfaceTapConfigurationPropertiesFormat properties of Virtual Network Tap configuration. +type InterfaceTapConfigurationPropertiesFormat struct { + // VirtualNetworkTap - The reference to the Virtual Network Tap resource. + VirtualNetworkTap *VirtualNetworkTap `json:"virtualNetworkTap,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network interface tap configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for InterfaceTapConfigurationPropertiesFormat. +func (itcpf InterfaceTapConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itcpf.VirtualNetworkTap != nil { + objectMap["virtualNetworkTap"] = itcpf.VirtualNetworkTap + } + return json.Marshal(objectMap) +} + +// InterfaceTapConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type InterfaceTapConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfaceTapConfigurationsClient) (InterfaceTapConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfaceTapConfigurationsCreateOrUpdateFuture.Result. +func (future *InterfaceTapConfigurationsCreateOrUpdateFuture) result(client InterfaceTapConfigurationsClient) (itc InterfaceTapConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + itc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if itc.Response.Response, err = future.GetResult(sender); err == nil && itc.Response.Response.StatusCode != http.StatusNoContent { + itc, err = client.CreateOrUpdateResponder(itc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsCreateOrUpdateFuture", "Result", itc.Response.Response, "Failure responding to request") + } + } + return +} + +// InterfaceTapConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type InterfaceTapConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(InterfaceTapConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *InterfaceTapConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for InterfaceTapConfigurationsDeleteFuture.Result. +func (future *InterfaceTapConfigurationsDeleteFuture) result(client InterfaceTapConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.InterfaceTapConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.InterfaceTapConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IPAddressAvailabilityResult response for CheckIPAddressAvailability API service call. +type IPAddressAvailabilityResult struct { + autorest.Response `json:"-"` + // Available - Private IP address availability. + Available *bool `json:"available,omitempty"` + // AvailableIPAddresses - Contains other available private IP addresses if the asked for address is taken. + AvailableIPAddresses *[]string `json:"availableIPAddresses,omitempty"` + // IsPlatformReserved - Private IP address platform reserved. + IsPlatformReserved *bool `json:"isPlatformReserved,omitempty"` +} + +// IPAllocation ipAllocation resource. +type IPAllocation struct { + autorest.Response `json:"-"` + // IPAllocationPropertiesFormat - Properties of the IpAllocation. + *IPAllocationPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IPAllocation. +func (ia IPAllocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ia.IPAllocationPropertiesFormat != nil { + objectMap["properties"] = ia.IPAllocationPropertiesFormat + } + if ia.ID != nil { + objectMap["id"] = ia.ID + } + if ia.Location != nil { + objectMap["location"] = ia.Location + } + if ia.Tags != nil { + objectMap["tags"] = ia.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPAllocation struct. +func (ia *IPAllocation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPAllocationPropertiesFormat IPAllocationPropertiesFormat + err = json.Unmarshal(*v, &IPAllocationPropertiesFormat) + if err != nil { + return err + } + ia.IPAllocationPropertiesFormat = &IPAllocationPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ia.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ia.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ia.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ia.Tags = tags + } + } + } + + return nil +} + +// IPAllocationListResult response for the ListIpAllocations API service call. +type IPAllocationListResult struct { + autorest.Response `json:"-"` + // Value - A list of IpAllocation resources. + Value *[]IPAllocation `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// IPAllocationListResultIterator provides access to a complete listing of IPAllocation values. +type IPAllocationListResultIterator struct { + i int + page IPAllocationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IPAllocationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IPAllocationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IPAllocationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IPAllocationListResultIterator) Response() IPAllocationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IPAllocationListResultIterator) Value() IPAllocation { + if !iter.page.NotDone() { + return IPAllocation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IPAllocationListResultIterator type. +func NewIPAllocationListResultIterator(page IPAllocationListResultPage) IPAllocationListResultIterator { + return IPAllocationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ialr IPAllocationListResult) IsEmpty() bool { + return ialr.Value == nil || len(*ialr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ialr IPAllocationListResult) hasNextLink() bool { + return ialr.NextLink != nil && len(*ialr.NextLink) != 0 +} + +// iPAllocationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ialr IPAllocationListResult) iPAllocationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ialr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ialr.NextLink))) +} + +// IPAllocationListResultPage contains a page of IPAllocation values. +type IPAllocationListResultPage struct { + fn func(context.Context, IPAllocationListResult) (IPAllocationListResult, error) + ialr IPAllocationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IPAllocationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPAllocationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ialr) + if err != nil { + return err + } + page.ialr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IPAllocationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IPAllocationListResultPage) NotDone() bool { + return !page.ialr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IPAllocationListResultPage) Response() IPAllocationListResult { + return page.ialr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IPAllocationListResultPage) Values() []IPAllocation { + if page.ialr.IsEmpty() { + return nil + } + return *page.ialr.Value +} + +// Creates a new instance of the IPAllocationListResultPage type. +func NewIPAllocationListResultPage(cur IPAllocationListResult, getNextPage func(context.Context, IPAllocationListResult) (IPAllocationListResult, error)) IPAllocationListResultPage { + return IPAllocationListResultPage{ + fn: getNextPage, + ialr: cur, + } +} + +// IPAllocationPropertiesFormat properties of the IpAllocation. +type IPAllocationPropertiesFormat struct { + // Subnet - READ-ONLY; The Subnet that using the prefix of this IpAllocation resource. + Subnet *SubResource `json:"subnet,omitempty"` + // VirtualNetwork - READ-ONLY; The VirtualNetwork that using the prefix of this IpAllocation resource. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + // Type - The type for the IpAllocation. Possible values include: 'IPAllocationTypeUndefined', 'IPAllocationTypeHypernet' + Type IPAllocationType `json:"type,omitempty"` + // Prefix - The address prefix for the IpAllocation. + Prefix *string `json:"prefix,omitempty"` + // PrefixLength - The address prefix length for the IpAllocation. + PrefixLength *int32 `json:"prefixLength,omitempty"` + // PrefixType - The address prefix Type for the IpAllocation. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrefixType IPVersion `json:"prefixType,omitempty"` + // IpamAllocationID - The IPAM allocation ID. + IpamAllocationID *string `json:"ipamAllocationId,omitempty"` + // AllocationTags - IpAllocation tags. + AllocationTags map[string]*string `json:"allocationTags"` +} + +// MarshalJSON is the custom marshaler for IPAllocationPropertiesFormat. +func (iapf IPAllocationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if iapf.Type != "" { + objectMap["type"] = iapf.Type + } + if iapf.Prefix != nil { + objectMap["prefix"] = iapf.Prefix + } + if iapf.PrefixLength != nil { + objectMap["prefixLength"] = iapf.PrefixLength + } + if iapf.PrefixType != "" { + objectMap["prefixType"] = iapf.PrefixType + } + if iapf.IpamAllocationID != nil { + objectMap["ipamAllocationId"] = iapf.IpamAllocationID + } + if iapf.AllocationTags != nil { + objectMap["allocationTags"] = iapf.AllocationTags + } + return json.Marshal(objectMap) +} + +// IPAllocationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type IPAllocationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPAllocationsClient) (IPAllocation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPAllocationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPAllocationsCreateOrUpdateFuture.Result. +func (future *IPAllocationsCreateOrUpdateFuture) result(client IPAllocationsClient) (ia IPAllocation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ia.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPAllocationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ia.Response.Response, err = future.GetResult(sender); err == nil && ia.Response.Response.StatusCode != http.StatusNoContent { + ia, err = client.CreateOrUpdateResponder(ia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsCreateOrUpdateFuture", "Result", ia.Response.Response, "Failure responding to request") + } + } + return +} + +// IPAllocationsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPAllocationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPAllocationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPAllocationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPAllocationsDeleteFuture.Result. +func (future *IPAllocationsDeleteFuture) result(client IPAllocationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPAllocationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPAllocationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IPConfiguration IP configuration. +type IPConfiguration struct { + // IPConfigurationPropertiesFormat - Properties of the IP configuration. + *IPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfiguration. +func (ic IPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ic.IPConfigurationPropertiesFormat != nil { + objectMap["properties"] = ic.IPConfigurationPropertiesFormat + } + if ic.Name != nil { + objectMap["name"] = ic.Name + } + if ic.ID != nil { + objectMap["id"] = ic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPConfiguration struct. +func (ic *IPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPConfigurationPropertiesFormat IPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &IPConfigurationPropertiesFormat) + if err != nil { + return err + } + ic.IPConfigurationPropertiesFormat = &IPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ic.ID = &ID + } + } + } + + return nil +} + +// IPConfigurationBgpPeeringAddress properties of IPConfigurationBgpPeeringAddress. +type IPConfigurationBgpPeeringAddress struct { + // IpconfigurationID - The ID of IP configuration which belongs to gateway. + IpconfigurationID *string `json:"ipconfigurationId,omitempty"` + // DefaultBgpIPAddresses - READ-ONLY; The list of default BGP peering addresses which belong to IP configuration. + DefaultBgpIPAddresses *[]string `json:"defaultBgpIpAddresses,omitempty"` + // CustomBgpIPAddresses - The list of custom BGP peering addresses which belong to IP configuration. + CustomBgpIPAddresses *[]string `json:"customBgpIpAddresses,omitempty"` + // TunnelIPAddresses - READ-ONLY; The list of tunnel public IP addresses which belong to IP configuration. + TunnelIPAddresses *[]string `json:"tunnelIpAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationBgpPeeringAddress. +func (icbpa IPConfigurationBgpPeeringAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icbpa.IpconfigurationID != nil { + objectMap["ipconfigurationId"] = icbpa.IpconfigurationID + } + if icbpa.CustomBgpIPAddresses != nil { + objectMap["customBgpIpAddresses"] = icbpa.CustomBgpIPAddresses + } + return json.Marshal(objectMap) +} + +// IPConfigurationProfile IP configuration profile child resource. +type IPConfigurationProfile struct { + // IPConfigurationProfilePropertiesFormat - Properties of the IP configuration profile. + *IPConfigurationProfilePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Sub Resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationProfile. +func (icp IPConfigurationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icp.IPConfigurationProfilePropertiesFormat != nil { + objectMap["properties"] = icp.IPConfigurationProfilePropertiesFormat + } + if icp.Name != nil { + objectMap["name"] = icp.Name + } + if icp.ID != nil { + objectMap["id"] = icp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPConfigurationProfile struct. +func (icp *IPConfigurationProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPConfigurationProfilePropertiesFormat IPConfigurationProfilePropertiesFormat + err = json.Unmarshal(*v, &IPConfigurationProfilePropertiesFormat) + if err != nil { + return err + } + icp.IPConfigurationProfilePropertiesFormat = &IPConfigurationProfilePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + icp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + icp.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + icp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + icp.ID = &ID + } + } + } + + return nil +} + +// IPConfigurationProfilePropertiesFormat IP configuration profile properties. +type IPConfigurationProfilePropertiesFormat struct { + // Subnet - The reference to the subnet resource to create a container network interface ip configuration. + Subnet *Subnet `json:"subnet,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationProfilePropertiesFormat. +func (icppf IPConfigurationProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icppf.Subnet != nil { + objectMap["subnet"] = icppf.Subnet + } + return json.Marshal(objectMap) +} + +// IPConfigurationPropertiesFormat properties of IP configuration. +type IPConfigurationPropertiesFormat struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *PublicIPAddress `json:"publicIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPConfigurationPropertiesFormat. +func (icpf IPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if icpf.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = icpf.PrivateIPAddress + } + if icpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = icpf.PrivateIPAllocationMethod + } + if icpf.Subnet != nil { + objectMap["subnet"] = icpf.Subnet + } + if icpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = icpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// IPGroup the IpGroups resource information. +type IPGroup struct { + autorest.Response `json:"-"` + // IPGroupPropertiesFormat - Properties of the IpGroups. + *IPGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for IPGroup. +func (ig IPGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ig.IPGroupPropertiesFormat != nil { + objectMap["properties"] = ig.IPGroupPropertiesFormat + } + if ig.ID != nil { + objectMap["id"] = ig.ID + } + if ig.Location != nil { + objectMap["location"] = ig.Location + } + if ig.Tags != nil { + objectMap["tags"] = ig.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for IPGroup struct. +func (ig *IPGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var IPGroupPropertiesFormat IPGroupPropertiesFormat + err = json.Unmarshal(*v, &IPGroupPropertiesFormat) + if err != nil { + return err + } + ig.IPGroupPropertiesFormat = &IPGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ig.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ig.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ig.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ig.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ig.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ig.Tags = tags + } + } + } + + return nil +} + +// IPGroupListResult response for the ListIpGroups API service call. +type IPGroupListResult struct { + autorest.Response `json:"-"` + // Value - The list of IpGroups information resources. + Value *[]IPGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// IPGroupListResultIterator provides access to a complete listing of IPGroup values. +type IPGroupListResultIterator struct { + i int + page IPGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *IPGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *IPGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter IPGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter IPGroupListResultIterator) Response() IPGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter IPGroupListResultIterator) Value() IPGroup { + if !iter.page.NotDone() { + return IPGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the IPGroupListResultIterator type. +func NewIPGroupListResultIterator(page IPGroupListResultPage) IPGroupListResultIterator { + return IPGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (iglr IPGroupListResult) IsEmpty() bool { + return iglr.Value == nil || len(*iglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (iglr IPGroupListResult) hasNextLink() bool { + return iglr.NextLink != nil && len(*iglr.NextLink) != 0 +} + +// iPGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (iglr IPGroupListResult) iPGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !iglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(iglr.NextLink))) +} + +// IPGroupListResultPage contains a page of IPGroup values. +type IPGroupListResultPage struct { + fn func(context.Context, IPGroupListResult) (IPGroupListResult, error) + iglr IPGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *IPGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IPGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.iglr) + if err != nil { + return err + } + page.iglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *IPGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page IPGroupListResultPage) NotDone() bool { + return !page.iglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page IPGroupListResultPage) Response() IPGroupListResult { + return page.iglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page IPGroupListResultPage) Values() []IPGroup { + if page.iglr.IsEmpty() { + return nil + } + return *page.iglr.Value +} + +// Creates a new instance of the IPGroupListResultPage type. +func NewIPGroupListResultPage(cur IPGroupListResult, getNextPage func(context.Context, IPGroupListResult) (IPGroupListResult, error)) IPGroupListResultPage { + return IPGroupListResultPage{ + fn: getNextPage, + iglr: cur, + } +} + +// IPGroupPropertiesFormat the IpGroups property information. +type IPGroupPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the IpGroups resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IPAddresses - IpAddresses/IpAddressPrefixes in the IpGroups resource. + IPAddresses *[]string `json:"ipAddresses,omitempty"` + // Firewalls - READ-ONLY; List of references to Firewall resources that this IpGroups is associated with. + Firewalls *[]SubResource `json:"firewalls,omitempty"` + // FirewallPolicies - READ-ONLY; List of references to Firewall Policies resources that this IpGroups is associated with. + FirewallPolicies *[]SubResource `json:"firewallPolicies,omitempty"` +} + +// MarshalJSON is the custom marshaler for IPGroupPropertiesFormat. +func (igpf IPGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if igpf.IPAddresses != nil { + objectMap["ipAddresses"] = igpf.IPAddresses + } + return json.Marshal(objectMap) +} + +// IPGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPGroupsClient) (IPGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPGroupsCreateOrUpdateFuture.Result. +func (future *IPGroupsCreateOrUpdateFuture) result(client IPGroupsClient) (ig IPGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ig.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ig.Response.Response, err = future.GetResult(sender); err == nil && ig.Response.Response.StatusCode != http.StatusNoContent { + ig, err = client.CreateOrUpdateResponder(ig.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsCreateOrUpdateFuture", "Result", ig.Response.Response, "Failure responding to request") + } + } + return +} + +// IPGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type IPGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(IPGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *IPGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for IPGroupsDeleteFuture.Result. +func (future *IPGroupsDeleteFuture) result(client IPGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.IPGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.IPGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// IpsecPolicy an IPSec Policy configuration for a virtual network gateway connection. +type IpsecPolicy struct { + // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN tunnel. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` + // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN tunnel. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' + IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` + // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' + IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` + // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' + IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` + // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' + IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` + // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' + DhGroup DhGroup `json:"dhGroup,omitempty"` + // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' + PfsGroup PfsGroup `json:"pfsGroup,omitempty"` +} + +// IPTag contains the IpTag associated with the object. +type IPTag struct { + // IPTagType - The IP tag type. Example: FirstPartyUsage. + IPTagType *string `json:"ipTagType,omitempty"` + // Tag - The value of the IP tag associated with the public IP. Example: SQL. + Tag *string `json:"tag,omitempty"` +} + +// Ipv6CircuitConnectionConfig iPv6 Circuit Connection properties for global reach. +type Ipv6CircuitConnectionConfig struct { + // AddressPrefix - /125 IP address space to carve out customer addresses for global reach. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // CircuitConnectionStatus - READ-ONLY; Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for Ipv6CircuitConnectionConfig. +func (i6ccc Ipv6CircuitConnectionConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i6ccc.AddressPrefix != nil { + objectMap["addressPrefix"] = i6ccc.AddressPrefix + } + return json.Marshal(objectMap) +} + +// Ipv6ExpressRouteCircuitPeeringConfig contains IPv6 peering config. +type Ipv6ExpressRouteCircuitPeeringConfig struct { + // PrimaryPeerAddressPrefix - The primary address prefix. + PrimaryPeerAddressPrefix *string `json:"primaryPeerAddressPrefix,omitempty"` + // SecondaryPeerAddressPrefix - The secondary address prefix. + SecondaryPeerAddressPrefix *string `json:"secondaryPeerAddressPrefix,omitempty"` + // MicrosoftPeeringConfig - The Microsoft peering configuration. + MicrosoftPeeringConfig *ExpressRouteCircuitPeeringConfig `json:"microsoftPeeringConfig,omitempty"` + // RouteFilter - The reference to the RouteFilter resource. + RouteFilter *SubResource `json:"routeFilter,omitempty"` + // State - The state of peering. Possible values include: 'ExpressRouteCircuitPeeringStateDisabled', 'ExpressRouteCircuitPeeringStateEnabled' + State ExpressRouteCircuitPeeringState `json:"state,omitempty"` +} + +// ListHubRouteTablesResult list of RouteTables and a URL nextLink to get the next set of results. +type ListHubRouteTablesResult struct { + autorest.Response `json:"-"` + // Value - List of RouteTables. + Value *[]HubRouteTable `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListHubRouteTablesResultIterator provides access to a complete listing of HubRouteTable values. +type ListHubRouteTablesResultIterator struct { + i int + page ListHubRouteTablesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListHubRouteTablesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListHubRouteTablesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListHubRouteTablesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListHubRouteTablesResultIterator) Response() ListHubRouteTablesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListHubRouteTablesResultIterator) Value() HubRouteTable { + if !iter.page.NotDone() { + return HubRouteTable{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListHubRouteTablesResultIterator type. +func NewListHubRouteTablesResultIterator(page ListHubRouteTablesResultPage) ListHubRouteTablesResultIterator { + return ListHubRouteTablesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lhrtr ListHubRouteTablesResult) IsEmpty() bool { + return lhrtr.Value == nil || len(*lhrtr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lhrtr ListHubRouteTablesResult) hasNextLink() bool { + return lhrtr.NextLink != nil && len(*lhrtr.NextLink) != 0 +} + +// listHubRouteTablesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lhrtr ListHubRouteTablesResult) listHubRouteTablesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lhrtr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lhrtr.NextLink))) +} + +// ListHubRouteTablesResultPage contains a page of HubRouteTable values. +type ListHubRouteTablesResultPage struct { + fn func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error) + lhrtr ListHubRouteTablesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListHubRouteTablesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubRouteTablesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lhrtr) + if err != nil { + return err + } + page.lhrtr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListHubRouteTablesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListHubRouteTablesResultPage) NotDone() bool { + return !page.lhrtr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListHubRouteTablesResultPage) Response() ListHubRouteTablesResult { + return page.lhrtr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListHubRouteTablesResultPage) Values() []HubRouteTable { + if page.lhrtr.IsEmpty() { + return nil + } + return *page.lhrtr.Value +} + +// Creates a new instance of the ListHubRouteTablesResultPage type. +func NewListHubRouteTablesResultPage(cur ListHubRouteTablesResult, getNextPage func(context.Context, ListHubRouteTablesResult) (ListHubRouteTablesResult, error)) ListHubRouteTablesResultPage { + return ListHubRouteTablesResultPage{ + fn: getNextPage, + lhrtr: cur, + } +} + +// ListHubVirtualNetworkConnectionsResult list of HubVirtualNetworkConnections and a URL nextLink to get +// the next set of results. +type ListHubVirtualNetworkConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of HubVirtualNetworkConnections. + Value *[]HubVirtualNetworkConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListHubVirtualNetworkConnectionsResultIterator provides access to a complete listing of +// HubVirtualNetworkConnection values. +type ListHubVirtualNetworkConnectionsResultIterator struct { + i int + page ListHubVirtualNetworkConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListHubVirtualNetworkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListHubVirtualNetworkConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListHubVirtualNetworkConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListHubVirtualNetworkConnectionsResultIterator) Response() ListHubVirtualNetworkConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListHubVirtualNetworkConnectionsResultIterator) Value() HubVirtualNetworkConnection { + if !iter.page.NotDone() { + return HubVirtualNetworkConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListHubVirtualNetworkConnectionsResultIterator type. +func NewListHubVirtualNetworkConnectionsResultIterator(page ListHubVirtualNetworkConnectionsResultPage) ListHubVirtualNetworkConnectionsResultIterator { + return ListHubVirtualNetworkConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lhvncr ListHubVirtualNetworkConnectionsResult) IsEmpty() bool { + return lhvncr.Value == nil || len(*lhvncr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lhvncr ListHubVirtualNetworkConnectionsResult) hasNextLink() bool { + return lhvncr.NextLink != nil && len(*lhvncr.NextLink) != 0 +} + +// listHubVirtualNetworkConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lhvncr ListHubVirtualNetworkConnectionsResult) listHubVirtualNetworkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lhvncr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lhvncr.NextLink))) +} + +// ListHubVirtualNetworkConnectionsResultPage contains a page of HubVirtualNetworkConnection values. +type ListHubVirtualNetworkConnectionsResultPage struct { + fn func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error) + lhvncr ListHubVirtualNetworkConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListHubVirtualNetworkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListHubVirtualNetworkConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lhvncr) + if err != nil { + return err + } + page.lhvncr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListHubVirtualNetworkConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListHubVirtualNetworkConnectionsResultPage) NotDone() bool { + return !page.lhvncr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListHubVirtualNetworkConnectionsResultPage) Response() ListHubVirtualNetworkConnectionsResult { + return page.lhvncr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListHubVirtualNetworkConnectionsResultPage) Values() []HubVirtualNetworkConnection { + if page.lhvncr.IsEmpty() { + return nil + } + return *page.lhvncr.Value +} + +// Creates a new instance of the ListHubVirtualNetworkConnectionsResultPage type. +func NewListHubVirtualNetworkConnectionsResultPage(cur ListHubVirtualNetworkConnectionsResult, getNextPage func(context.Context, ListHubVirtualNetworkConnectionsResult) (ListHubVirtualNetworkConnectionsResult, error)) ListHubVirtualNetworkConnectionsResultPage { + return ListHubVirtualNetworkConnectionsResultPage{ + fn: getNextPage, + lhvncr: cur, + } +} + +// ListP2SVpnGatewaysResult result of the request to list P2SVpnGateways. It contains a list of +// P2SVpnGateways and a URL nextLink to get the next set of results. +type ListP2SVpnGatewaysResult struct { + autorest.Response `json:"-"` + // Value - List of P2SVpnGateways. + Value *[]P2SVpnGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListP2SVpnGatewaysResultIterator provides access to a complete listing of P2SVpnGateway values. +type ListP2SVpnGatewaysResultIterator struct { + i int + page ListP2SVpnGatewaysResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListP2SVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListP2SVpnGatewaysResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListP2SVpnGatewaysResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListP2SVpnGatewaysResultIterator) Response() ListP2SVpnGatewaysResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListP2SVpnGatewaysResultIterator) Value() P2SVpnGateway { + if !iter.page.NotDone() { + return P2SVpnGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListP2SVpnGatewaysResultIterator type. +func NewListP2SVpnGatewaysResultIterator(page ListP2SVpnGatewaysResultPage) ListP2SVpnGatewaysResultIterator { + return ListP2SVpnGatewaysResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lpvgr ListP2SVpnGatewaysResult) IsEmpty() bool { + return lpvgr.Value == nil || len(*lpvgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lpvgr ListP2SVpnGatewaysResult) hasNextLink() bool { + return lpvgr.NextLink != nil && len(*lpvgr.NextLink) != 0 +} + +// listP2SVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lpvgr ListP2SVpnGatewaysResult) listP2SVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { + if !lpvgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lpvgr.NextLink))) +} + +// ListP2SVpnGatewaysResultPage contains a page of P2SVpnGateway values. +type ListP2SVpnGatewaysResultPage struct { + fn func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error) + lpvgr ListP2SVpnGatewaysResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListP2SVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListP2SVpnGatewaysResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lpvgr) + if err != nil { + return err + } + page.lpvgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListP2SVpnGatewaysResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListP2SVpnGatewaysResultPage) NotDone() bool { + return !page.lpvgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListP2SVpnGatewaysResultPage) Response() ListP2SVpnGatewaysResult { + return page.lpvgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListP2SVpnGatewaysResultPage) Values() []P2SVpnGateway { + if page.lpvgr.IsEmpty() { + return nil + } + return *page.lpvgr.Value +} + +// Creates a new instance of the ListP2SVpnGatewaysResultPage type. +func NewListP2SVpnGatewaysResultPage(cur ListP2SVpnGatewaysResult, getNextPage func(context.Context, ListP2SVpnGatewaysResult) (ListP2SVpnGatewaysResult, error)) ListP2SVpnGatewaysResultPage { + return ListP2SVpnGatewaysResultPage{ + fn: getNextPage, + lpvgr: cur, + } +} + +// ListRoutingIntentResult list of the routing intent result and a URL nextLink to get the next set of +// results. +type ListRoutingIntentResult struct { + autorest.Response `json:"-"` + // Value - List of RoutingIntent resource. + Value *[]RoutingIntent `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListRoutingIntentResultIterator provides access to a complete listing of RoutingIntent values. +type ListRoutingIntentResultIterator struct { + i int + page ListRoutingIntentResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListRoutingIntentResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListRoutingIntentResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListRoutingIntentResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListRoutingIntentResultIterator) Response() ListRoutingIntentResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListRoutingIntentResultIterator) Value() RoutingIntent { + if !iter.page.NotDone() { + return RoutingIntent{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListRoutingIntentResultIterator type. +func NewListRoutingIntentResultIterator(page ListRoutingIntentResultPage) ListRoutingIntentResultIterator { + return ListRoutingIntentResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lrir ListRoutingIntentResult) IsEmpty() bool { + return lrir.Value == nil || len(*lrir.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lrir ListRoutingIntentResult) hasNextLink() bool { + return lrir.NextLink != nil && len(*lrir.NextLink) != 0 +} + +// listRoutingIntentResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lrir ListRoutingIntentResult) listRoutingIntentResultPreparer(ctx context.Context) (*http.Request, error) { + if !lrir.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lrir.NextLink))) +} + +// ListRoutingIntentResultPage contains a page of RoutingIntent values. +type ListRoutingIntentResultPage struct { + fn func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error) + lrir ListRoutingIntentResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListRoutingIntentResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListRoutingIntentResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lrir) + if err != nil { + return err + } + page.lrir = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListRoutingIntentResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListRoutingIntentResultPage) NotDone() bool { + return !page.lrir.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListRoutingIntentResultPage) Response() ListRoutingIntentResult { + return page.lrir +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListRoutingIntentResultPage) Values() []RoutingIntent { + if page.lrir.IsEmpty() { + return nil + } + return *page.lrir.Value +} + +// Creates a new instance of the ListRoutingIntentResultPage type. +func NewListRoutingIntentResultPage(cur ListRoutingIntentResult, getNextPage func(context.Context, ListRoutingIntentResult) (ListRoutingIntentResult, error)) ListRoutingIntentResultPage { + return ListRoutingIntentResultPage{ + fn: getNextPage, + lrir: cur, + } +} + +// ListString ... +type ListString struct { + autorest.Response `json:"-"` + Value *[]string `json:"value,omitempty"` +} + +// ListVirtualHubBgpConnectionResults virtualHubBgpConnections list. +type ListVirtualHubBgpConnectionResults struct { + autorest.Response `json:"-"` + // Value - The list of VirtualHubBgpConnections. + Value *[]BgpConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubBgpConnectionResultsIterator provides access to a complete listing of BgpConnection +// values. +type ListVirtualHubBgpConnectionResultsIterator struct { + i int + page ListVirtualHubBgpConnectionResultsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubBgpConnectionResultsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubBgpConnectionResultsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubBgpConnectionResultsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubBgpConnectionResultsIterator) Response() ListVirtualHubBgpConnectionResults { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubBgpConnectionResultsIterator) Value() BgpConnection { + if !iter.page.NotDone() { + return BgpConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubBgpConnectionResultsIterator type. +func NewListVirtualHubBgpConnectionResultsIterator(page ListVirtualHubBgpConnectionResultsPage) ListVirtualHubBgpConnectionResultsIterator { + return ListVirtualHubBgpConnectionResultsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhbcr ListVirtualHubBgpConnectionResults) IsEmpty() bool { + return lvhbcr.Value == nil || len(*lvhbcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhbcr ListVirtualHubBgpConnectionResults) hasNextLink() bool { + return lvhbcr.NextLink != nil && len(*lvhbcr.NextLink) != 0 +} + +// listVirtualHubBgpConnectionResultsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhbcr ListVirtualHubBgpConnectionResults) listVirtualHubBgpConnectionResultsPreparer(ctx context.Context) (*http.Request, error) { + if !lvhbcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhbcr.NextLink))) +} + +// ListVirtualHubBgpConnectionResultsPage contains a page of BgpConnection values. +type ListVirtualHubBgpConnectionResultsPage struct { + fn func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error) + lvhbcr ListVirtualHubBgpConnectionResults +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubBgpConnectionResultsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubBgpConnectionResultsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhbcr) + if err != nil { + return err + } + page.lvhbcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubBgpConnectionResultsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubBgpConnectionResultsPage) NotDone() bool { + return !page.lvhbcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubBgpConnectionResultsPage) Response() ListVirtualHubBgpConnectionResults { + return page.lvhbcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubBgpConnectionResultsPage) Values() []BgpConnection { + if page.lvhbcr.IsEmpty() { + return nil + } + return *page.lvhbcr.Value +} + +// Creates a new instance of the ListVirtualHubBgpConnectionResultsPage type. +func NewListVirtualHubBgpConnectionResultsPage(cur ListVirtualHubBgpConnectionResults, getNextPage func(context.Context, ListVirtualHubBgpConnectionResults) (ListVirtualHubBgpConnectionResults, error)) ListVirtualHubBgpConnectionResultsPage { + return ListVirtualHubBgpConnectionResultsPage{ + fn: getNextPage, + lvhbcr: cur, + } +} + +// ListVirtualHubIPConfigurationResults virtualHubIpConfigurations list. +type ListVirtualHubIPConfigurationResults struct { + autorest.Response `json:"-"` + // Value - The list of VirtualHubIpConfigurations. + Value *[]HubIPConfiguration `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubIPConfigurationResultsIterator provides access to a complete listing of HubIPConfiguration +// values. +type ListVirtualHubIPConfigurationResultsIterator struct { + i int + page ListVirtualHubIPConfigurationResultsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubIPConfigurationResultsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubIPConfigurationResultsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubIPConfigurationResultsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubIPConfigurationResultsIterator) Response() ListVirtualHubIPConfigurationResults { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubIPConfigurationResultsIterator) Value() HubIPConfiguration { + if !iter.page.NotDone() { + return HubIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubIPConfigurationResultsIterator type. +func NewListVirtualHubIPConfigurationResultsIterator(page ListVirtualHubIPConfigurationResultsPage) ListVirtualHubIPConfigurationResultsIterator { + return ListVirtualHubIPConfigurationResultsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhicr ListVirtualHubIPConfigurationResults) IsEmpty() bool { + return lvhicr.Value == nil || len(*lvhicr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhicr ListVirtualHubIPConfigurationResults) hasNextLink() bool { + return lvhicr.NextLink != nil && len(*lvhicr.NextLink) != 0 +} + +// listVirtualHubIPConfigurationResultsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhicr ListVirtualHubIPConfigurationResults) listVirtualHubIPConfigurationResultsPreparer(ctx context.Context) (*http.Request, error) { + if !lvhicr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhicr.NextLink))) +} + +// ListVirtualHubIPConfigurationResultsPage contains a page of HubIPConfiguration values. +type ListVirtualHubIPConfigurationResultsPage struct { + fn func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error) + lvhicr ListVirtualHubIPConfigurationResults +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubIPConfigurationResultsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubIPConfigurationResultsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhicr) + if err != nil { + return err + } + page.lvhicr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubIPConfigurationResultsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubIPConfigurationResultsPage) NotDone() bool { + return !page.lvhicr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubIPConfigurationResultsPage) Response() ListVirtualHubIPConfigurationResults { + return page.lvhicr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubIPConfigurationResultsPage) Values() []HubIPConfiguration { + if page.lvhicr.IsEmpty() { + return nil + } + return *page.lvhicr.Value +} + +// Creates a new instance of the ListVirtualHubIPConfigurationResultsPage type. +func NewListVirtualHubIPConfigurationResultsPage(cur ListVirtualHubIPConfigurationResults, getNextPage func(context.Context, ListVirtualHubIPConfigurationResults) (ListVirtualHubIPConfigurationResults, error)) ListVirtualHubIPConfigurationResultsPage { + return ListVirtualHubIPConfigurationResultsPage{ + fn: getNextPage, + lvhicr: cur, + } +} + +// ListVirtualHubRouteTableV2sResult list of VirtualHubRouteTableV2s and a URL nextLink to get the next set +// of results. +type ListVirtualHubRouteTableV2sResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualHubRouteTableV2s. + Value *[]VirtualHubRouteTableV2 `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubRouteTableV2sResultIterator provides access to a complete listing of +// VirtualHubRouteTableV2 values. +type ListVirtualHubRouteTableV2sResultIterator struct { + i int + page ListVirtualHubRouteTableV2sResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubRouteTableV2sResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubRouteTableV2sResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubRouteTableV2sResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubRouteTableV2sResultIterator) Response() ListVirtualHubRouteTableV2sResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubRouteTableV2sResultIterator) Value() VirtualHubRouteTableV2 { + if !iter.page.NotDone() { + return VirtualHubRouteTableV2{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubRouteTableV2sResultIterator type. +func NewListVirtualHubRouteTableV2sResultIterator(page ListVirtualHubRouteTableV2sResultPage) ListVirtualHubRouteTableV2sResultIterator { + return ListVirtualHubRouteTableV2sResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) IsEmpty() bool { + return lvhrtvr.Value == nil || len(*lvhrtvr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) hasNextLink() bool { + return lvhrtvr.NextLink != nil && len(*lvhrtvr.NextLink) != 0 +} + +// listVirtualHubRouteTableV2sResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhrtvr ListVirtualHubRouteTableV2sResult) listVirtualHubRouteTableV2sResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvhrtvr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhrtvr.NextLink))) +} + +// ListVirtualHubRouteTableV2sResultPage contains a page of VirtualHubRouteTableV2 values. +type ListVirtualHubRouteTableV2sResultPage struct { + fn func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error) + lvhrtvr ListVirtualHubRouteTableV2sResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubRouteTableV2sResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubRouteTableV2sResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhrtvr) + if err != nil { + return err + } + page.lvhrtvr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubRouteTableV2sResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubRouteTableV2sResultPage) NotDone() bool { + return !page.lvhrtvr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubRouteTableV2sResultPage) Response() ListVirtualHubRouteTableV2sResult { + return page.lvhrtvr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubRouteTableV2sResultPage) Values() []VirtualHubRouteTableV2 { + if page.lvhrtvr.IsEmpty() { + return nil + } + return *page.lvhrtvr.Value +} + +// Creates a new instance of the ListVirtualHubRouteTableV2sResultPage type. +func NewListVirtualHubRouteTableV2sResultPage(cur ListVirtualHubRouteTableV2sResult, getNextPage func(context.Context, ListVirtualHubRouteTableV2sResult) (ListVirtualHubRouteTableV2sResult, error)) ListVirtualHubRouteTableV2sResultPage { + return ListVirtualHubRouteTableV2sResultPage{ + fn: getNextPage, + lvhrtvr: cur, + } +} + +// ListVirtualHubsResult result of the request to list VirtualHubs. It contains a list of VirtualHubs and a +// URL nextLink to get the next set of results. +type ListVirtualHubsResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualHubs. + Value *[]VirtualHub `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualHubsResultIterator provides access to a complete listing of VirtualHub values. +type ListVirtualHubsResultIterator struct { + i int + page ListVirtualHubsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualHubsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualHubsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualHubsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualHubsResultIterator) Response() ListVirtualHubsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualHubsResultIterator) Value() VirtualHub { + if !iter.page.NotDone() { + return VirtualHub{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualHubsResultIterator type. +func NewListVirtualHubsResultIterator(page ListVirtualHubsResultPage) ListVirtualHubsResultIterator { + return ListVirtualHubsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvhr ListVirtualHubsResult) IsEmpty() bool { + return lvhr.Value == nil || len(*lvhr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvhr ListVirtualHubsResult) hasNextLink() bool { + return lvhr.NextLink != nil && len(*lvhr.NextLink) != 0 +} + +// listVirtualHubsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvhr ListVirtualHubsResult) listVirtualHubsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvhr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvhr.NextLink))) +} + +// ListVirtualHubsResultPage contains a page of VirtualHub values. +type ListVirtualHubsResultPage struct { + fn func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error) + lvhr ListVirtualHubsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualHubsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualHubsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvhr) + if err != nil { + return err + } + page.lvhr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualHubsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualHubsResultPage) NotDone() bool { + return !page.lvhr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualHubsResultPage) Response() ListVirtualHubsResult { + return page.lvhr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualHubsResultPage) Values() []VirtualHub { + if page.lvhr.IsEmpty() { + return nil + } + return *page.lvhr.Value +} + +// Creates a new instance of the ListVirtualHubsResultPage type. +func NewListVirtualHubsResultPage(cur ListVirtualHubsResult, getNextPage func(context.Context, ListVirtualHubsResult) (ListVirtualHubsResult, error)) ListVirtualHubsResultPage { + return ListVirtualHubsResultPage{ + fn: getNextPage, + lvhr: cur, + } +} + +// ListVirtualNetworkGatewayNatRulesResult result of the request to list all nat rules to a virtual network +// gateway. It contains a list of Nat rules and a URL nextLink to get the next set of results. +type ListVirtualNetworkGatewayNatRulesResult struct { + autorest.Response `json:"-"` + // Value - List of Nat Rules. + Value *[]VirtualNetworkGatewayNatRule `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualNetworkGatewayNatRulesResultIterator provides access to a complete listing of +// VirtualNetworkGatewayNatRule values. +type ListVirtualNetworkGatewayNatRulesResultIterator struct { + i int + page ListVirtualNetworkGatewayNatRulesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualNetworkGatewayNatRulesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Response() ListVirtualNetworkGatewayNatRulesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualNetworkGatewayNatRulesResultIterator) Value() VirtualNetworkGatewayNatRule { + if !iter.page.NotDone() { + return VirtualNetworkGatewayNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultIterator type. +func NewListVirtualNetworkGatewayNatRulesResultIterator(page ListVirtualNetworkGatewayNatRulesResultPage) ListVirtualNetworkGatewayNatRulesResultIterator { + return ListVirtualNetworkGatewayNatRulesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) IsEmpty() bool { + return lvngnrr.Value == nil || len(*lvngnrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) hasNextLink() bool { + return lvngnrr.NextLink != nil && len(*lvngnrr.NextLink) != 0 +} + +// listVirtualNetworkGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvngnrr ListVirtualNetworkGatewayNatRulesResult) listVirtualNetworkGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvngnrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvngnrr.NextLink))) +} + +// ListVirtualNetworkGatewayNatRulesResultPage contains a page of VirtualNetworkGatewayNatRule values. +type ListVirtualNetworkGatewayNatRulesResultPage struct { + fn func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error) + lvngnrr ListVirtualNetworkGatewayNatRulesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualNetworkGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualNetworkGatewayNatRulesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvngnrr) + if err != nil { + return err + } + page.lvngnrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualNetworkGatewayNatRulesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualNetworkGatewayNatRulesResultPage) NotDone() bool { + return !page.lvngnrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualNetworkGatewayNatRulesResultPage) Response() ListVirtualNetworkGatewayNatRulesResult { + return page.lvngnrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualNetworkGatewayNatRulesResultPage) Values() []VirtualNetworkGatewayNatRule { + if page.lvngnrr.IsEmpty() { + return nil + } + return *page.lvngnrr.Value +} + +// Creates a new instance of the ListVirtualNetworkGatewayNatRulesResultPage type. +func NewListVirtualNetworkGatewayNatRulesResultPage(cur ListVirtualNetworkGatewayNatRulesResult, getNextPage func(context.Context, ListVirtualNetworkGatewayNatRulesResult) (ListVirtualNetworkGatewayNatRulesResult, error)) ListVirtualNetworkGatewayNatRulesResultPage { + return ListVirtualNetworkGatewayNatRulesResultPage{ + fn: getNextPage, + lvngnrr: cur, + } +} + +// ListVirtualWANsResult result of the request to list VirtualWANs. It contains a list of VirtualWANs and a +// URL nextLink to get the next set of results. +type ListVirtualWANsResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualWANs. + Value *[]VirtualWAN `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVirtualWANsResultIterator provides access to a complete listing of VirtualWAN values. +type ListVirtualWANsResultIterator struct { + i int + page ListVirtualWANsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVirtualWANsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVirtualWANsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVirtualWANsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVirtualWANsResultIterator) Response() ListVirtualWANsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVirtualWANsResultIterator) Value() VirtualWAN { + if !iter.page.NotDone() { + return VirtualWAN{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVirtualWANsResultIterator type. +func NewListVirtualWANsResultIterator(page ListVirtualWANsResultPage) ListVirtualWANsResultIterator { + return ListVirtualWANsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvwnr ListVirtualWANsResult) IsEmpty() bool { + return lvwnr.Value == nil || len(*lvwnr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvwnr ListVirtualWANsResult) hasNextLink() bool { + return lvwnr.NextLink != nil && len(*lvwnr.NextLink) != 0 +} + +// listVirtualWANsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvwnr ListVirtualWANsResult) listVirtualWANsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvwnr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvwnr.NextLink))) +} + +// ListVirtualWANsResultPage contains a page of VirtualWAN values. +type ListVirtualWANsResultPage struct { + fn func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error) + lvwnr ListVirtualWANsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVirtualWANsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVirtualWANsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvwnr) + if err != nil { + return err + } + page.lvwnr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVirtualWANsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVirtualWANsResultPage) NotDone() bool { + return !page.lvwnr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVirtualWANsResultPage) Response() ListVirtualWANsResult { + return page.lvwnr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVirtualWANsResultPage) Values() []VirtualWAN { + if page.lvwnr.IsEmpty() { + return nil + } + return *page.lvwnr.Value +} + +// Creates a new instance of the ListVirtualWANsResultPage type. +func NewListVirtualWANsResultPage(cur ListVirtualWANsResult, getNextPage func(context.Context, ListVirtualWANsResult) (ListVirtualWANsResult, error)) ListVirtualWANsResultPage { + return ListVirtualWANsResultPage{ + fn: getNextPage, + lvwnr: cur, + } +} + +// ListVpnConnectionsResult result of the request to list all vpn connections to a virtual wan vpn gateway. +// It contains a list of Vpn Connections and a URL nextLink to get the next set of results. +type ListVpnConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of Vpn Connections. + Value *[]VpnConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnConnectionsResultIterator provides access to a complete listing of VpnConnection values. +type ListVpnConnectionsResultIterator struct { + i int + page ListVpnConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnConnectionsResultIterator) Response() ListVpnConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnConnectionsResultIterator) Value() VpnConnection { + if !iter.page.NotDone() { + return VpnConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnConnectionsResultIterator type. +func NewListVpnConnectionsResultIterator(page ListVpnConnectionsResultPage) ListVpnConnectionsResultIterator { + return ListVpnConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvcr ListVpnConnectionsResult) IsEmpty() bool { + return lvcr.Value == nil || len(*lvcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvcr ListVpnConnectionsResult) hasNextLink() bool { + return lvcr.NextLink != nil && len(*lvcr.NextLink) != 0 +} + +// listVpnConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvcr ListVpnConnectionsResult) listVpnConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvcr.NextLink))) +} + +// ListVpnConnectionsResultPage contains a page of VpnConnection values. +type ListVpnConnectionsResultPage struct { + fn func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error) + lvcr ListVpnConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvcr) + if err != nil { + return err + } + page.lvcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnConnectionsResultPage) NotDone() bool { + return !page.lvcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnConnectionsResultPage) Response() ListVpnConnectionsResult { + return page.lvcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnConnectionsResultPage) Values() []VpnConnection { + if page.lvcr.IsEmpty() { + return nil + } + return *page.lvcr.Value +} + +// Creates a new instance of the ListVpnConnectionsResultPage type. +func NewListVpnConnectionsResultPage(cur ListVpnConnectionsResult, getNextPage func(context.Context, ListVpnConnectionsResult) (ListVpnConnectionsResult, error)) ListVpnConnectionsResultPage { + return ListVpnConnectionsResultPage{ + fn: getNextPage, + lvcr: cur, + } +} + +// ListVpnGatewayNatRulesResult result of the request to list all nat rules to a virtual wan vpn gateway. +// It contains a list of Nat rules and a URL nextLink to get the next set of results. +type ListVpnGatewayNatRulesResult struct { + autorest.Response `json:"-"` + // Value - List of Nat Rules. + Value *[]VpnGatewayNatRule `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnGatewayNatRulesResultIterator provides access to a complete listing of VpnGatewayNatRule values. +type ListVpnGatewayNatRulesResultIterator struct { + i int + page ListVpnGatewayNatRulesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnGatewayNatRulesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnGatewayNatRulesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnGatewayNatRulesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnGatewayNatRulesResultIterator) Response() ListVpnGatewayNatRulesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnGatewayNatRulesResultIterator) Value() VpnGatewayNatRule { + if !iter.page.NotDone() { + return VpnGatewayNatRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnGatewayNatRulesResultIterator type. +func NewListVpnGatewayNatRulesResultIterator(page ListVpnGatewayNatRulesResultPage) ListVpnGatewayNatRulesResultIterator { + return ListVpnGatewayNatRulesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvgnrr ListVpnGatewayNatRulesResult) IsEmpty() bool { + return lvgnrr.Value == nil || len(*lvgnrr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvgnrr ListVpnGatewayNatRulesResult) hasNextLink() bool { + return lvgnrr.NextLink != nil && len(*lvgnrr.NextLink) != 0 +} + +// listVpnGatewayNatRulesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvgnrr ListVpnGatewayNatRulesResult) listVpnGatewayNatRulesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvgnrr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvgnrr.NextLink))) +} + +// ListVpnGatewayNatRulesResultPage contains a page of VpnGatewayNatRule values. +type ListVpnGatewayNatRulesResultPage struct { + fn func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error) + lvgnrr ListVpnGatewayNatRulesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnGatewayNatRulesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewayNatRulesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvgnrr) + if err != nil { + return err + } + page.lvgnrr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnGatewayNatRulesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnGatewayNatRulesResultPage) NotDone() bool { + return !page.lvgnrr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnGatewayNatRulesResultPage) Response() ListVpnGatewayNatRulesResult { + return page.lvgnrr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnGatewayNatRulesResultPage) Values() []VpnGatewayNatRule { + if page.lvgnrr.IsEmpty() { + return nil + } + return *page.lvgnrr.Value +} + +// Creates a new instance of the ListVpnGatewayNatRulesResultPage type. +func NewListVpnGatewayNatRulesResultPage(cur ListVpnGatewayNatRulesResult, getNextPage func(context.Context, ListVpnGatewayNatRulesResult) (ListVpnGatewayNatRulesResult, error)) ListVpnGatewayNatRulesResultPage { + return ListVpnGatewayNatRulesResultPage{ + fn: getNextPage, + lvgnrr: cur, + } +} + +// ListVpnGatewaysResult result of the request to list VpnGateways. It contains a list of VpnGateways and a +// URL nextLink to get the next set of results. +type ListVpnGatewaysResult struct { + autorest.Response `json:"-"` + // Value - List of VpnGateways. + Value *[]VpnGateway `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnGatewaysResultIterator provides access to a complete listing of VpnGateway values. +type ListVpnGatewaysResultIterator struct { + i int + page ListVpnGatewaysResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnGatewaysResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnGatewaysResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnGatewaysResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnGatewaysResultIterator) Response() ListVpnGatewaysResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnGatewaysResultIterator) Value() VpnGateway { + if !iter.page.NotDone() { + return VpnGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnGatewaysResultIterator type. +func NewListVpnGatewaysResultIterator(page ListVpnGatewaysResultPage) ListVpnGatewaysResultIterator { + return ListVpnGatewaysResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvgr ListVpnGatewaysResult) IsEmpty() bool { + return lvgr.Value == nil || len(*lvgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvgr ListVpnGatewaysResult) hasNextLink() bool { + return lvgr.NextLink != nil && len(*lvgr.NextLink) != 0 +} + +// listVpnGatewaysResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvgr ListVpnGatewaysResult) listVpnGatewaysResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvgr.NextLink))) +} + +// ListVpnGatewaysResultPage contains a page of VpnGateway values. +type ListVpnGatewaysResultPage struct { + fn func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error) + lvgr ListVpnGatewaysResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnGatewaysResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnGatewaysResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvgr) + if err != nil { + return err + } + page.lvgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnGatewaysResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnGatewaysResultPage) NotDone() bool { + return !page.lvgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnGatewaysResultPage) Response() ListVpnGatewaysResult { + return page.lvgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnGatewaysResultPage) Values() []VpnGateway { + if page.lvgr.IsEmpty() { + return nil + } + return *page.lvgr.Value +} + +// Creates a new instance of the ListVpnGatewaysResultPage type. +func NewListVpnGatewaysResultPage(cur ListVpnGatewaysResult, getNextPage func(context.Context, ListVpnGatewaysResult) (ListVpnGatewaysResult, error)) ListVpnGatewaysResultPage { + return ListVpnGatewaysResultPage{ + fn: getNextPage, + lvgr: cur, + } +} + +// ListVpnServerConfigurationPolicyGroupsResult result of the request to list +// VpnServerConfigurationPolicyGroups. It contains a list of VpnServerConfigurationPolicyGroups and a URL +// nextLink to get the next set of results. +type ListVpnServerConfigurationPolicyGroupsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnServerConfigurationPolicyGroups. + Value *[]VpnServerConfigurationPolicyGroup `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnServerConfigurationPolicyGroupsResultIterator provides access to a complete listing of +// VpnServerConfigurationPolicyGroup values. +type ListVpnServerConfigurationPolicyGroupsResultIterator struct { + i int + page ListVpnServerConfigurationPolicyGroupsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnServerConfigurationPolicyGroupsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Response() ListVpnServerConfigurationPolicyGroupsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnServerConfigurationPolicyGroupsResultIterator) Value() VpnServerConfigurationPolicyGroup { + if !iter.page.NotDone() { + return VpnServerConfigurationPolicyGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultIterator type. +func NewListVpnServerConfigurationPolicyGroupsResultIterator(page ListVpnServerConfigurationPolicyGroupsResultPage) ListVpnServerConfigurationPolicyGroupsResultIterator { + return ListVpnServerConfigurationPolicyGroupsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) IsEmpty() bool { + return lvscpgr.Value == nil || len(*lvscpgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) hasNextLink() bool { + return lvscpgr.NextLink != nil && len(*lvscpgr.NextLink) != 0 +} + +// listVpnServerConfigurationPolicyGroupsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvscpgr ListVpnServerConfigurationPolicyGroupsResult) listVpnServerConfigurationPolicyGroupsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvscpgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvscpgr.NextLink))) +} + +// ListVpnServerConfigurationPolicyGroupsResultPage contains a page of VpnServerConfigurationPolicyGroup +// values. +type ListVpnServerConfigurationPolicyGroupsResultPage struct { + fn func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error) + lvscpgr ListVpnServerConfigurationPolicyGroupsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnServerConfigurationPolicyGroupsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationPolicyGroupsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvscpgr) + if err != nil { + return err + } + page.lvscpgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnServerConfigurationPolicyGroupsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) NotDone() bool { + return !page.lvscpgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) Response() ListVpnServerConfigurationPolicyGroupsResult { + return page.lvscpgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnServerConfigurationPolicyGroupsResultPage) Values() []VpnServerConfigurationPolicyGroup { + if page.lvscpgr.IsEmpty() { + return nil + } + return *page.lvscpgr.Value +} + +// Creates a new instance of the ListVpnServerConfigurationPolicyGroupsResultPage type. +func NewListVpnServerConfigurationPolicyGroupsResultPage(cur ListVpnServerConfigurationPolicyGroupsResult, getNextPage func(context.Context, ListVpnServerConfigurationPolicyGroupsResult) (ListVpnServerConfigurationPolicyGroupsResult, error)) ListVpnServerConfigurationPolicyGroupsResultPage { + return ListVpnServerConfigurationPolicyGroupsResultPage{ + fn: getNextPage, + lvscpgr: cur, + } +} + +// ListVpnServerConfigurationsResult result of the request to list all VpnServerConfigurations. It contains +// a list of VpnServerConfigurations and a URL nextLink to get the next set of results. +type ListVpnServerConfigurationsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnServerConfigurations. + Value *[]VpnServerConfiguration `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnServerConfigurationsResultIterator provides access to a complete listing of +// VpnServerConfiguration values. +type ListVpnServerConfigurationsResultIterator struct { + i int + page ListVpnServerConfigurationsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnServerConfigurationsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnServerConfigurationsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnServerConfigurationsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnServerConfigurationsResultIterator) Response() ListVpnServerConfigurationsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnServerConfigurationsResultIterator) Value() VpnServerConfiguration { + if !iter.page.NotDone() { + return VpnServerConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnServerConfigurationsResultIterator type. +func NewListVpnServerConfigurationsResultIterator(page ListVpnServerConfigurationsResultPage) ListVpnServerConfigurationsResultIterator { + return ListVpnServerConfigurationsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvscr ListVpnServerConfigurationsResult) IsEmpty() bool { + return lvscr.Value == nil || len(*lvscr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvscr ListVpnServerConfigurationsResult) hasNextLink() bool { + return lvscr.NextLink != nil && len(*lvscr.NextLink) != 0 +} + +// listVpnServerConfigurationsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvscr ListVpnServerConfigurationsResult) listVpnServerConfigurationsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvscr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvscr.NextLink))) +} + +// ListVpnServerConfigurationsResultPage contains a page of VpnServerConfiguration values. +type ListVpnServerConfigurationsResultPage struct { + fn func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error) + lvscr ListVpnServerConfigurationsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnServerConfigurationsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnServerConfigurationsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvscr) + if err != nil { + return err + } + page.lvscr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnServerConfigurationsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnServerConfigurationsResultPage) NotDone() bool { + return !page.lvscr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnServerConfigurationsResultPage) Response() ListVpnServerConfigurationsResult { + return page.lvscr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnServerConfigurationsResultPage) Values() []VpnServerConfiguration { + if page.lvscr.IsEmpty() { + return nil + } + return *page.lvscr.Value +} + +// Creates a new instance of the ListVpnServerConfigurationsResultPage type. +func NewListVpnServerConfigurationsResultPage(cur ListVpnServerConfigurationsResult, getNextPage func(context.Context, ListVpnServerConfigurationsResult) (ListVpnServerConfigurationsResult, error)) ListVpnServerConfigurationsResultPage { + return ListVpnServerConfigurationsResultPage{ + fn: getNextPage, + lvscr: cur, + } +} + +// ListVpnSiteLinkConnectionsResult result of the request to list all vpn connections to a virtual wan vpn +// gateway. It contains a list of Vpn Connections and a URL nextLink to get the next set of results. +type ListVpnSiteLinkConnectionsResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSiteLinkConnections. + Value *[]VpnSiteLinkConnection `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSiteLinkConnectionsResultIterator provides access to a complete listing of VpnSiteLinkConnection +// values. +type ListVpnSiteLinkConnectionsResultIterator struct { + i int + page ListVpnSiteLinkConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSiteLinkConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSiteLinkConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSiteLinkConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSiteLinkConnectionsResultIterator) Response() ListVpnSiteLinkConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSiteLinkConnectionsResultIterator) Value() VpnSiteLinkConnection { + if !iter.page.NotDone() { + return VpnSiteLinkConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSiteLinkConnectionsResultIterator type. +func NewListVpnSiteLinkConnectionsResultIterator(page ListVpnSiteLinkConnectionsResultPage) ListVpnSiteLinkConnectionsResultIterator { + return ListVpnSiteLinkConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvslcr ListVpnSiteLinkConnectionsResult) IsEmpty() bool { + return lvslcr.Value == nil || len(*lvslcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvslcr ListVpnSiteLinkConnectionsResult) hasNextLink() bool { + return lvslcr.NextLink != nil && len(*lvslcr.NextLink) != 0 +} + +// listVpnSiteLinkConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvslcr ListVpnSiteLinkConnectionsResult) listVpnSiteLinkConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvslcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvslcr.NextLink))) +} + +// ListVpnSiteLinkConnectionsResultPage contains a page of VpnSiteLinkConnection values. +type ListVpnSiteLinkConnectionsResultPage struct { + fn func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error) + lvslcr ListVpnSiteLinkConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSiteLinkConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinkConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvslcr) + if err != nil { + return err + } + page.lvslcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSiteLinkConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSiteLinkConnectionsResultPage) NotDone() bool { + return !page.lvslcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSiteLinkConnectionsResultPage) Response() ListVpnSiteLinkConnectionsResult { + return page.lvslcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSiteLinkConnectionsResultPage) Values() []VpnSiteLinkConnection { + if page.lvslcr.IsEmpty() { + return nil + } + return *page.lvslcr.Value +} + +// Creates a new instance of the ListVpnSiteLinkConnectionsResultPage type. +func NewListVpnSiteLinkConnectionsResultPage(cur ListVpnSiteLinkConnectionsResult, getNextPage func(context.Context, ListVpnSiteLinkConnectionsResult) (ListVpnSiteLinkConnectionsResult, error)) ListVpnSiteLinkConnectionsResultPage { + return ListVpnSiteLinkConnectionsResultPage{ + fn: getNextPage, + lvslcr: cur, + } +} + +// ListVpnSiteLinksResult result of the request to list VpnSiteLinks. It contains a list of VpnSiteLinks +// and a URL nextLink to get the next set of results. +type ListVpnSiteLinksResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSitesLinks. + Value *[]VpnSiteLink `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSiteLinksResultIterator provides access to a complete listing of VpnSiteLink values. +type ListVpnSiteLinksResultIterator struct { + i int + page ListVpnSiteLinksResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSiteLinksResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSiteLinksResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSiteLinksResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSiteLinksResultIterator) Response() ListVpnSiteLinksResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSiteLinksResultIterator) Value() VpnSiteLink { + if !iter.page.NotDone() { + return VpnSiteLink{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSiteLinksResultIterator type. +func NewListVpnSiteLinksResultIterator(page ListVpnSiteLinksResultPage) ListVpnSiteLinksResultIterator { + return ListVpnSiteLinksResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvslr ListVpnSiteLinksResult) IsEmpty() bool { + return lvslr.Value == nil || len(*lvslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvslr ListVpnSiteLinksResult) hasNextLink() bool { + return lvslr.NextLink != nil && len(*lvslr.NextLink) != 0 +} + +// listVpnSiteLinksResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvslr ListVpnSiteLinksResult) listVpnSiteLinksResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvslr.NextLink))) +} + +// ListVpnSiteLinksResultPage contains a page of VpnSiteLink values. +type ListVpnSiteLinksResultPage struct { + fn func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error) + lvslr ListVpnSiteLinksResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSiteLinksResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSiteLinksResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvslr) + if err != nil { + return err + } + page.lvslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSiteLinksResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSiteLinksResultPage) NotDone() bool { + return !page.lvslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSiteLinksResultPage) Response() ListVpnSiteLinksResult { + return page.lvslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSiteLinksResultPage) Values() []VpnSiteLink { + if page.lvslr.IsEmpty() { + return nil + } + return *page.lvslr.Value +} + +// Creates a new instance of the ListVpnSiteLinksResultPage type. +func NewListVpnSiteLinksResultPage(cur ListVpnSiteLinksResult, getNextPage func(context.Context, ListVpnSiteLinksResult) (ListVpnSiteLinksResult, error)) ListVpnSiteLinksResultPage { + return ListVpnSiteLinksResultPage{ + fn: getNextPage, + lvslr: cur, + } +} + +// ListVpnSitesResult result of the request to list VpnSites. It contains a list of VpnSites and a URL +// nextLink to get the next set of results. +type ListVpnSitesResult struct { + autorest.Response `json:"-"` + // Value - List of VpnSites. + Value *[]VpnSite `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListVpnSitesResultIterator provides access to a complete listing of VpnSite values. +type ListVpnSitesResultIterator struct { + i int + page ListVpnSitesResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListVpnSitesResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListVpnSitesResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListVpnSitesResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListVpnSitesResultIterator) Response() ListVpnSitesResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListVpnSitesResultIterator) Value() VpnSite { + if !iter.page.NotDone() { + return VpnSite{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListVpnSitesResultIterator type. +func NewListVpnSitesResultIterator(page ListVpnSitesResultPage) ListVpnSitesResultIterator { + return ListVpnSitesResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lvsr ListVpnSitesResult) IsEmpty() bool { + return lvsr.Value == nil || len(*lvsr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lvsr ListVpnSitesResult) hasNextLink() bool { + return lvsr.NextLink != nil && len(*lvsr.NextLink) != 0 +} + +// listVpnSitesResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lvsr ListVpnSitesResult) listVpnSitesResultPreparer(ctx context.Context) (*http.Request, error) { + if !lvsr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lvsr.NextLink))) +} + +// ListVpnSitesResultPage contains a page of VpnSite values. +type ListVpnSitesResultPage struct { + fn func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error) + lvsr ListVpnSitesResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListVpnSitesResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListVpnSitesResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lvsr) + if err != nil { + return err + } + page.lvsr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListVpnSitesResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListVpnSitesResultPage) NotDone() bool { + return !page.lvsr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListVpnSitesResultPage) Response() ListVpnSitesResult { + return page.lvsr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListVpnSitesResultPage) Values() []VpnSite { + if page.lvsr.IsEmpty() { + return nil + } + return *page.lvsr.Value +} + +// Creates a new instance of the ListVpnSitesResultPage type. +func NewListVpnSitesResultPage(cur ListVpnSitesResult, getNextPage func(context.Context, ListVpnSitesResult) (ListVpnSitesResult, error)) ListVpnSitesResultPage { + return ListVpnSitesResultPage{ + fn: getNextPage, + lvsr: cur, + } +} + +// LoadBalancer loadBalancer resource. +type LoadBalancer struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The load balancer SKU. + Sku *LoadBalancerSku `json:"sku,omitempty"` + // LoadBalancerPropertiesFormat - Properties of load balancer. + *LoadBalancerPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LoadBalancer. +func (lb LoadBalancer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lb.ExtendedLocation != nil { + objectMap["extendedLocation"] = lb.ExtendedLocation + } + if lb.Sku != nil { + objectMap["sku"] = lb.Sku + } + if lb.LoadBalancerPropertiesFormat != nil { + objectMap["properties"] = lb.LoadBalancerPropertiesFormat + } + if lb.ID != nil { + objectMap["id"] = lb.ID + } + if lb.Location != nil { + objectMap["location"] = lb.Location + } + if lb.Tags != nil { + objectMap["tags"] = lb.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancer struct. +func (lb *LoadBalancer) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + lb.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku LoadBalancerSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + lb.Sku = &sku + } + case "properties": + if v != nil { + var loadBalancerPropertiesFormat LoadBalancerPropertiesFormat + err = json.Unmarshal(*v, &loadBalancerPropertiesFormat) + if err != nil { + return err + } + lb.LoadBalancerPropertiesFormat = &loadBalancerPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lb.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lb.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lb.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lb.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lb.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lb.Tags = tags + } + } + } + + return nil +} + +// LoadBalancerBackendAddress load balancer backend addresses. +type LoadBalancerBackendAddress struct { + // LoadBalancerBackendAddressPropertiesFormat - Properties of load balancer backend address pool. + *LoadBalancerBackendAddressPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the backend address. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddress. +func (lbba LoadBalancerBackendAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbba.LoadBalancerBackendAddressPropertiesFormat != nil { + objectMap["properties"] = lbba.LoadBalancerBackendAddressPropertiesFormat + } + if lbba.Name != nil { + objectMap["name"] = lbba.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancerBackendAddress struct. +func (lbba *LoadBalancerBackendAddress) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var loadBalancerBackendAddressPropertiesFormat LoadBalancerBackendAddressPropertiesFormat + err = json.Unmarshal(*v, &loadBalancerBackendAddressPropertiesFormat) + if err != nil { + return err + } + lbba.LoadBalancerBackendAddressPropertiesFormat = &loadBalancerBackendAddressPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lbba.Name = &name + } + } + } + + return nil +} + +// LoadBalancerBackendAddressPoolListResult response for ListBackendAddressPool API service call. +type LoadBalancerBackendAddressPoolListResult struct { + autorest.Response `json:"-"` + // Value - A list of backend address pools in a load balancer. + Value *[]BackendAddressPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPoolListResult. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbbaplr.Value != nil { + objectMap["value"] = lbbaplr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerBackendAddressPoolListResultIterator provides access to a complete listing of +// BackendAddressPool values. +type LoadBalancerBackendAddressPoolListResultIterator struct { + i int + page LoadBalancerBackendAddressPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerBackendAddressPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerBackendAddressPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerBackendAddressPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerBackendAddressPoolListResultIterator) Response() LoadBalancerBackendAddressPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerBackendAddressPoolListResultIterator) Value() BackendAddressPool { + if !iter.page.NotDone() { + return BackendAddressPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerBackendAddressPoolListResultIterator type. +func NewLoadBalancerBackendAddressPoolListResultIterator(page LoadBalancerBackendAddressPoolListResultPage) LoadBalancerBackendAddressPoolListResultIterator { + return LoadBalancerBackendAddressPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) IsEmpty() bool { + return lbbaplr.Value == nil || len(*lbbaplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) hasNextLink() bool { + return lbbaplr.NextLink != nil && len(*lbbaplr.NextLink) != 0 +} + +// loadBalancerBackendAddressPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbbaplr LoadBalancerBackendAddressPoolListResult) loadBalancerBackendAddressPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbbaplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbbaplr.NextLink))) +} + +// LoadBalancerBackendAddressPoolListResultPage contains a page of BackendAddressPool values. +type LoadBalancerBackendAddressPoolListResultPage struct { + fn func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error) + lbbaplr LoadBalancerBackendAddressPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerBackendAddressPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerBackendAddressPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbbaplr) + if err != nil { + return err + } + page.lbbaplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerBackendAddressPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerBackendAddressPoolListResultPage) NotDone() bool { + return !page.lbbaplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerBackendAddressPoolListResultPage) Response() LoadBalancerBackendAddressPoolListResult { + return page.lbbaplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerBackendAddressPoolListResultPage) Values() []BackendAddressPool { + if page.lbbaplr.IsEmpty() { + return nil + } + return *page.lbbaplr.Value +} + +// Creates a new instance of the LoadBalancerBackendAddressPoolListResultPage type. +func NewLoadBalancerBackendAddressPoolListResultPage(cur LoadBalancerBackendAddressPoolListResult, getNextPage func(context.Context, LoadBalancerBackendAddressPoolListResult) (LoadBalancerBackendAddressPoolListResult, error)) LoadBalancerBackendAddressPoolListResultPage { + return LoadBalancerBackendAddressPoolListResultPage{ + fn: getNextPage, + lbbaplr: cur, + } +} + +// LoadBalancerBackendAddressPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LoadBalancerBackendAddressPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancerBackendAddressPoolsClient) (BackendAddressPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancerBackendAddressPoolsCreateOrUpdateFuture.Result. +func (future *LoadBalancerBackendAddressPoolsCreateOrUpdateFuture) result(client LoadBalancerBackendAddressPoolsClient) (bap BackendAddressPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bap.Response.Response, err = future.GetResult(sender); err == nil && bap.Response.Response.StatusCode != http.StatusNoContent { + bap, err = client.CreateOrUpdateResponder(bap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture", "Result", bap.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancerBackendAddressPoolsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type LoadBalancerBackendAddressPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancerBackendAddressPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancerBackendAddressPoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancerBackendAddressPoolsDeleteFuture.Result. +func (future *LoadBalancerBackendAddressPoolsDeleteFuture) result(client LoadBalancerBackendAddressPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancerBackendAddressPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancerBackendAddressPropertiesFormat properties of the load balancer backend addresses. +type LoadBalancerBackendAddressPropertiesFormat struct { + // VirtualNetwork - Reference to an existing virtual network. + VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + // Subnet - Reference to an existing subnet. + Subnet *SubResource `json:"subnet,omitempty"` + // IPAddress - IP Address belonging to the referenced virtual network. + IPAddress *string `json:"ipAddress,omitempty"` + // NetworkInterfaceIPConfiguration - READ-ONLY; Reference to IP address defined in network interfaces. + NetworkInterfaceIPConfiguration *SubResource `json:"networkInterfaceIPConfiguration,omitempty"` + // LoadBalancerFrontendIPConfiguration - Reference to the frontend ip address configuration defined in regional loadbalancer. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIPConfiguration,omitempty"` + // InboundNatRulesPortMapping - READ-ONLY; Collection of inbound NAT rule port mappings. + InboundNatRulesPortMapping *[]NatRulePortMapping `json:"inboundNatRulesPortMapping,omitempty"` + // AdminState - A list of administrative states which once set can override health probe so that Load Balancer will always forward new connections to backend, or deny new connections and reset existing connections. Possible values include: 'LoadBalancerBackendAddressAdminStateNone', 'LoadBalancerBackendAddressAdminStateUp', 'LoadBalancerBackendAddressAdminStateDown', 'LoadBalancerBackendAddressAdminStateDrain' + AdminState LoadBalancerBackendAddressAdminState `json:"adminState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerBackendAddressPropertiesFormat. +func (lbbapf LoadBalancerBackendAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbbapf.VirtualNetwork != nil { + objectMap["virtualNetwork"] = lbbapf.VirtualNetwork + } + if lbbapf.Subnet != nil { + objectMap["subnet"] = lbbapf.Subnet + } + if lbbapf.IPAddress != nil { + objectMap["ipAddress"] = lbbapf.IPAddress + } + if lbbapf.LoadBalancerFrontendIPConfiguration != nil { + objectMap["loadBalancerFrontendIPConfiguration"] = lbbapf.LoadBalancerFrontendIPConfiguration + } + if lbbapf.AdminState != "" { + objectMap["adminState"] = lbbapf.AdminState + } + return json.Marshal(objectMap) +} + +// LoadBalancerFrontendIPConfigurationListResult response for ListFrontendIPConfiguration API service call. +type LoadBalancerFrontendIPConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - A list of frontend IP configurations in a load balancer. + Value *[]FrontendIPConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerFrontendIPConfigurationListResult. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbficlr.Value != nil { + objectMap["value"] = lbficlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerFrontendIPConfigurationListResultIterator provides access to a complete listing of +// FrontendIPConfiguration values. +type LoadBalancerFrontendIPConfigurationListResultIterator struct { + i int + page LoadBalancerFrontendIPConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerFrontendIPConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Response() LoadBalancerFrontendIPConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerFrontendIPConfigurationListResultIterator) Value() FrontendIPConfiguration { + if !iter.page.NotDone() { + return FrontendIPConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultIterator type. +func NewLoadBalancerFrontendIPConfigurationListResultIterator(page LoadBalancerFrontendIPConfigurationListResultPage) LoadBalancerFrontendIPConfigurationListResultIterator { + return LoadBalancerFrontendIPConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) IsEmpty() bool { + return lbficlr.Value == nil || len(*lbficlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) hasNextLink() bool { + return lbficlr.NextLink != nil && len(*lbficlr.NextLink) != 0 +} + +// loadBalancerFrontendIPConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbficlr LoadBalancerFrontendIPConfigurationListResult) loadBalancerFrontendIPConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbficlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbficlr.NextLink))) +} + +// LoadBalancerFrontendIPConfigurationListResultPage contains a page of FrontendIPConfiguration values. +type LoadBalancerFrontendIPConfigurationListResultPage struct { + fn func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error) + lbficlr LoadBalancerFrontendIPConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerFrontendIPConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerFrontendIPConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbficlr) + if err != nil { + return err + } + page.lbficlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerFrontendIPConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerFrontendIPConfigurationListResultPage) NotDone() bool { + return !page.lbficlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerFrontendIPConfigurationListResultPage) Response() LoadBalancerFrontendIPConfigurationListResult { + return page.lbficlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerFrontendIPConfigurationListResultPage) Values() []FrontendIPConfiguration { + if page.lbficlr.IsEmpty() { + return nil + } + return *page.lbficlr.Value +} + +// Creates a new instance of the LoadBalancerFrontendIPConfigurationListResultPage type. +func NewLoadBalancerFrontendIPConfigurationListResultPage(cur LoadBalancerFrontendIPConfigurationListResult, getNextPage func(context.Context, LoadBalancerFrontendIPConfigurationListResult) (LoadBalancerFrontendIPConfigurationListResult, error)) LoadBalancerFrontendIPConfigurationListResultPage { + return LoadBalancerFrontendIPConfigurationListResultPage{ + fn: getNextPage, + lbficlr: cur, + } +} + +// LoadBalancerListResult response for ListLoadBalancers API service call. +type LoadBalancerListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancers in a resource group. + Value *[]LoadBalancer `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerListResult. +func (lblr LoadBalancerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lblr.Value != nil { + objectMap["value"] = lblr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerListResultIterator provides access to a complete listing of LoadBalancer values. +type LoadBalancerListResultIterator struct { + i int + page LoadBalancerListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerListResultIterator) Response() LoadBalancerListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerListResultIterator) Value() LoadBalancer { + if !iter.page.NotDone() { + return LoadBalancer{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerListResultIterator type. +func NewLoadBalancerListResultIterator(page LoadBalancerListResultPage) LoadBalancerListResultIterator { + return LoadBalancerListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lblr LoadBalancerListResult) IsEmpty() bool { + return lblr.Value == nil || len(*lblr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lblr LoadBalancerListResult) hasNextLink() bool { + return lblr.NextLink != nil && len(*lblr.NextLink) != 0 +} + +// loadBalancerListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lblr LoadBalancerListResult) loadBalancerListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lblr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lblr.NextLink))) +} + +// LoadBalancerListResultPage contains a page of LoadBalancer values. +type LoadBalancerListResultPage struct { + fn func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error) + lblr LoadBalancerListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lblr) + if err != nil { + return err + } + page.lblr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerListResultPage) NotDone() bool { + return !page.lblr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerListResultPage) Response() LoadBalancerListResult { + return page.lblr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerListResultPage) Values() []LoadBalancer { + if page.lblr.IsEmpty() { + return nil + } + return *page.lblr.Value +} + +// Creates a new instance of the LoadBalancerListResultPage type. +func NewLoadBalancerListResultPage(cur LoadBalancerListResult, getNextPage func(context.Context, LoadBalancerListResult) (LoadBalancerListResult, error)) LoadBalancerListResultPage { + return LoadBalancerListResultPage{ + fn: getNextPage, + lblr: cur, + } +} + +// LoadBalancerLoadBalancingRuleListResult response for ListLoadBalancingRule API service call. +type LoadBalancerLoadBalancingRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of load balancing rules in a load balancer. + Value *[]LoadBalancingRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerLoadBalancingRuleListResult. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lblbrlr.Value != nil { + objectMap["value"] = lblbrlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerLoadBalancingRuleListResultIterator provides access to a complete listing of +// LoadBalancingRule values. +type LoadBalancerLoadBalancingRuleListResultIterator struct { + i int + page LoadBalancerLoadBalancingRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerLoadBalancingRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerLoadBalancingRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) Response() LoadBalancerLoadBalancingRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerLoadBalancingRuleListResultIterator) Value() LoadBalancingRule { + if !iter.page.NotDone() { + return LoadBalancingRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultIterator type. +func NewLoadBalancerLoadBalancingRuleListResultIterator(page LoadBalancerLoadBalancingRuleListResultPage) LoadBalancerLoadBalancingRuleListResultIterator { + return LoadBalancerLoadBalancingRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) IsEmpty() bool { + return lblbrlr.Value == nil || len(*lblbrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) hasNextLink() bool { + return lblbrlr.NextLink != nil && len(*lblbrlr.NextLink) != 0 +} + +// loadBalancerLoadBalancingRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lblbrlr LoadBalancerLoadBalancingRuleListResult) loadBalancerLoadBalancingRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lblbrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lblbrlr.NextLink))) +} + +// LoadBalancerLoadBalancingRuleListResultPage contains a page of LoadBalancingRule values. +type LoadBalancerLoadBalancingRuleListResultPage struct { + fn func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error) + lblbrlr LoadBalancerLoadBalancingRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerLoadBalancingRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerLoadBalancingRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lblbrlr) + if err != nil { + return err + } + page.lblbrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerLoadBalancingRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerLoadBalancingRuleListResultPage) NotDone() bool { + return !page.lblbrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerLoadBalancingRuleListResultPage) Response() LoadBalancerLoadBalancingRuleListResult { + return page.lblbrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerLoadBalancingRuleListResultPage) Values() []LoadBalancingRule { + if page.lblbrlr.IsEmpty() { + return nil + } + return *page.lblbrlr.Value +} + +// Creates a new instance of the LoadBalancerLoadBalancingRuleListResultPage type. +func NewLoadBalancerLoadBalancingRuleListResultPage(cur LoadBalancerLoadBalancingRuleListResult, getNextPage func(context.Context, LoadBalancerLoadBalancingRuleListResult) (LoadBalancerLoadBalancingRuleListResult, error)) LoadBalancerLoadBalancingRuleListResultPage { + return LoadBalancerLoadBalancingRuleListResultPage{ + fn: getNextPage, + lblbrlr: cur, + } +} + +// LoadBalancerOutboundRuleListResult response for ListOutboundRule API service call. +type LoadBalancerOutboundRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of outbound rules in a load balancer. + Value *[]OutboundRule `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerOutboundRuleListResult. +func (lborlr LoadBalancerOutboundRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lborlr.Value != nil { + objectMap["value"] = lborlr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerOutboundRuleListResultIterator provides access to a complete listing of OutboundRule values. +type LoadBalancerOutboundRuleListResultIterator struct { + i int + page LoadBalancerOutboundRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerOutboundRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerOutboundRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerOutboundRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerOutboundRuleListResultIterator) Response() LoadBalancerOutboundRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerOutboundRuleListResultIterator) Value() OutboundRule { + if !iter.page.NotDone() { + return OutboundRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerOutboundRuleListResultIterator type. +func NewLoadBalancerOutboundRuleListResultIterator(page LoadBalancerOutboundRuleListResultPage) LoadBalancerOutboundRuleListResultIterator { + return LoadBalancerOutboundRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lborlr LoadBalancerOutboundRuleListResult) IsEmpty() bool { + return lborlr.Value == nil || len(*lborlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lborlr LoadBalancerOutboundRuleListResult) hasNextLink() bool { + return lborlr.NextLink != nil && len(*lborlr.NextLink) != 0 +} + +// loadBalancerOutboundRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lborlr LoadBalancerOutboundRuleListResult) loadBalancerOutboundRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lborlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lborlr.NextLink))) +} + +// LoadBalancerOutboundRuleListResultPage contains a page of OutboundRule values. +type LoadBalancerOutboundRuleListResultPage struct { + fn func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error) + lborlr LoadBalancerOutboundRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerOutboundRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerOutboundRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lborlr) + if err != nil { + return err + } + page.lborlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerOutboundRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerOutboundRuleListResultPage) NotDone() bool { + return !page.lborlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerOutboundRuleListResultPage) Response() LoadBalancerOutboundRuleListResult { + return page.lborlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerOutboundRuleListResultPage) Values() []OutboundRule { + if page.lborlr.IsEmpty() { + return nil + } + return *page.lborlr.Value +} + +// Creates a new instance of the LoadBalancerOutboundRuleListResultPage type. +func NewLoadBalancerOutboundRuleListResultPage(cur LoadBalancerOutboundRuleListResult, getNextPage func(context.Context, LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error)) LoadBalancerOutboundRuleListResultPage { + return LoadBalancerOutboundRuleListResultPage{ + fn: getNextPage, + lborlr: cur, + } +} + +// LoadBalancerProbeListResult response for ListProbe API service call. +type LoadBalancerProbeListResult struct { + autorest.Response `json:"-"` + // Value - A list of probes in a load balancer. + Value *[]Probe `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerProbeListResult. +func (lbplr LoadBalancerProbeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbplr.Value != nil { + objectMap["value"] = lbplr.Value + } + return json.Marshal(objectMap) +} + +// LoadBalancerProbeListResultIterator provides access to a complete listing of Probe values. +type LoadBalancerProbeListResultIterator struct { + i int + page LoadBalancerProbeListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerProbeListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LoadBalancerProbeListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LoadBalancerProbeListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LoadBalancerProbeListResultIterator) Response() LoadBalancerProbeListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LoadBalancerProbeListResultIterator) Value() Probe { + if !iter.page.NotDone() { + return Probe{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LoadBalancerProbeListResultIterator type. +func NewLoadBalancerProbeListResultIterator(page LoadBalancerProbeListResultPage) LoadBalancerProbeListResultIterator { + return LoadBalancerProbeListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lbplr LoadBalancerProbeListResult) IsEmpty() bool { + return lbplr.Value == nil || len(*lbplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lbplr LoadBalancerProbeListResult) hasNextLink() bool { + return lbplr.NextLink != nil && len(*lbplr.NextLink) != 0 +} + +// loadBalancerProbeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lbplr LoadBalancerProbeListResult) loadBalancerProbeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lbplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lbplr.NextLink))) +} + +// LoadBalancerProbeListResultPage contains a page of Probe values. +type LoadBalancerProbeListResultPage struct { + fn func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error) + lbplr LoadBalancerProbeListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerProbeListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LoadBalancerProbeListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lbplr) + if err != nil { + return err + } + page.lbplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LoadBalancerProbeListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LoadBalancerProbeListResultPage) NotDone() bool { + return !page.lbplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LoadBalancerProbeListResultPage) Response() LoadBalancerProbeListResult { + return page.lbplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LoadBalancerProbeListResultPage) Values() []Probe { + if page.lbplr.IsEmpty() { + return nil + } + return *page.lbplr.Value +} + +// Creates a new instance of the LoadBalancerProbeListResultPage type. +func NewLoadBalancerProbeListResultPage(cur LoadBalancerProbeListResult, getNextPage func(context.Context, LoadBalancerProbeListResult) (LoadBalancerProbeListResult, error)) LoadBalancerProbeListResultPage { + return LoadBalancerProbeListResultPage{ + fn: getNextPage, + lbplr: cur, + } +} + +// LoadBalancerPropertiesFormat properties of the load balancer. +type LoadBalancerPropertiesFormat struct { + // FrontendIPConfigurations - Object representing the frontend IPs to be used for the load balancer. + FrontendIPConfigurations *[]FrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` + // BackendAddressPools - Collection of backend address pools used by a load balancer. + BackendAddressPools *[]BackendAddressPool `json:"backendAddressPools,omitempty"` + // LoadBalancingRules - Object collection representing the load balancing rules Gets the provisioning. + LoadBalancingRules *[]LoadBalancingRule `json:"loadBalancingRules,omitempty"` + // Probes - Collection of probe objects used in the load balancer. + Probes *[]Probe `json:"probes,omitempty"` + // InboundNatRules - Collection of inbound NAT Rules used by a load balancer. Defining inbound NAT rules on your load balancer is mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an Inbound NAT pool. They have to reference individual inbound NAT rules. + InboundNatRules *[]InboundNatRule `json:"inboundNatRules,omitempty"` + // InboundNatPools - Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically for each NIC associated with the Load Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT rules. Inbound NAT pools are referenced from virtual machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual inbound NAT rules. + InboundNatPools *[]InboundNatPool `json:"inboundNatPools,omitempty"` + // OutboundRules - The outbound rules. + OutboundRules *[]OutboundRule `json:"outboundRules,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the load balancer resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the load balancer resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerPropertiesFormat. +func (lbpf LoadBalancerPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = lbpf.FrontendIPConfigurations + } + if lbpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = lbpf.BackendAddressPools + } + if lbpf.LoadBalancingRules != nil { + objectMap["loadBalancingRules"] = lbpf.LoadBalancingRules + } + if lbpf.Probes != nil { + objectMap["probes"] = lbpf.Probes + } + if lbpf.InboundNatRules != nil { + objectMap["inboundNatRules"] = lbpf.InboundNatRules + } + if lbpf.InboundNatPools != nil { + objectMap["inboundNatPools"] = lbpf.InboundNatPools + } + if lbpf.OutboundRules != nil { + objectMap["outboundRules"] = lbpf.OutboundRules + } + return json.Marshal(objectMap) +} + +// LoadBalancersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LoadBalancersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (LoadBalancer, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersCreateOrUpdateFuture.Result. +func (future *LoadBalancersCreateOrUpdateFuture) result(client LoadBalancersClient) (lb LoadBalancer, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lb.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lb.Response.Response, err = future.GetResult(sender); err == nil && lb.Response.Response.StatusCode != http.StatusNoContent { + lb, err = client.CreateOrUpdateResponder(lb.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersCreateOrUpdateFuture", "Result", lb.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type LoadBalancersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersDeleteFuture.Result. +func (future *LoadBalancersDeleteFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancerSku SKU of a load balancer. +type LoadBalancerSku struct { + // Name - Name of a load balancer SKU. Possible values include: 'LoadBalancerSkuNameBasic', 'LoadBalancerSkuNameStandard', 'LoadBalancerSkuNameGateway' + Name LoadBalancerSkuName `json:"name,omitempty"` + // Tier - Tier of a load balancer SKU. Possible values include: 'LoadBalancerSkuTierRegional', 'LoadBalancerSkuTierGlobal' + Tier LoadBalancerSkuTier `json:"tier,omitempty"` +} + +// LoadBalancersListInboundNatRulePortMappingsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type LoadBalancersListInboundNatRulePortMappingsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (BackendAddressInboundNatRulePortMappings, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersListInboundNatRulePortMappingsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersListInboundNatRulePortMappingsFuture.Result. +func (future *LoadBalancersListInboundNatRulePortMappingsFuture) result(client LoadBalancersClient) (bainrpm BackendAddressInboundNatRulePortMappings, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bainrpm.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersListInboundNatRulePortMappingsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bainrpm.Response.Response, err = future.GetResult(sender); err == nil && bainrpm.Response.Response.StatusCode != http.StatusNoContent { + bainrpm, err = client.ListInboundNatRulePortMappingsResponder(bainrpm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersListInboundNatRulePortMappingsFuture", "Result", bainrpm.Response.Response, "Failure responding to request") + } + } + return +} + +// LoadBalancersSwapPublicIPAddressesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LoadBalancersSwapPublicIPAddressesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LoadBalancersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LoadBalancersSwapPublicIPAddressesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LoadBalancersSwapPublicIPAddressesFuture.Result. +func (future *LoadBalancersSwapPublicIPAddressesFuture) result(client LoadBalancersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LoadBalancersSwapPublicIPAddressesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LoadBalancersSwapPublicIPAddressesFuture") + return + } + ar.Response = future.Response() + return +} + +// LoadBalancerVipSwapRequest the request for a VIP swap. +type LoadBalancerVipSwapRequest struct { + // FrontendIPConfigurations - A list of frontend IP configuration resources that should swap VIPs. + FrontendIPConfigurations *[]LoadBalancerVipSwapRequestFrontendIPConfiguration `json:"frontendIPConfigurations,omitempty"` +} + +// LoadBalancerVipSwapRequestFrontendIPConfiguration VIP swap request's frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfiguration struct { + // ID - The ID of frontend IP configuration resource. + ID *string `json:"id,omitempty"` + // LoadBalancerVipSwapRequestFrontendIPConfigurationProperties - The properties of VIP swap request's frontend IP configuration object. + *LoadBalancerVipSwapRequestFrontendIPConfigurationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration. +func (lbvsrfic LoadBalancerVipSwapRequestFrontendIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbvsrfic.ID != nil { + objectMap["id"] = lbvsrfic.ID + } + if lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties != nil { + objectMap["properties"] = lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancerVipSwapRequestFrontendIPConfiguration struct. +func (lbvsrfic *LoadBalancerVipSwapRequestFrontendIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lbvsrfic.ID = &ID + } + case "properties": + if v != nil { + var loadBalancerVipSwapRequestFrontendIPConfigurationProperties LoadBalancerVipSwapRequestFrontendIPConfigurationProperties + err = json.Unmarshal(*v, &loadBalancerVipSwapRequestFrontendIPConfigurationProperties) + if err != nil { + return err + } + lbvsrfic.LoadBalancerVipSwapRequestFrontendIPConfigurationProperties = &loadBalancerVipSwapRequestFrontendIPConfigurationProperties + } + } + } + + return nil +} + +// LoadBalancerVipSwapRequestFrontendIPConfigurationProperties the properties of VIP swap request's +// frontend IP configuration object. +type LoadBalancerVipSwapRequestFrontendIPConfigurationProperties struct { + // PublicIPAddress - A reference to public IP address resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` +} + +// LoadBalancingRule a load balancing rule for a load balancer. +type LoadBalancingRule struct { + autorest.Response `json:"-"` + // LoadBalancingRulePropertiesFormat - Properties of load balancer load balancing rule. + *LoadBalancingRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingRule. +func (lbr LoadBalancingRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbr.LoadBalancingRulePropertiesFormat != nil { + objectMap["properties"] = lbr.LoadBalancingRulePropertiesFormat + } + if lbr.Name != nil { + objectMap["name"] = lbr.Name + } + if lbr.ID != nil { + objectMap["id"] = lbr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LoadBalancingRule struct. +func (lbr *LoadBalancingRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var loadBalancingRulePropertiesFormat LoadBalancingRulePropertiesFormat + err = json.Unmarshal(*v, &loadBalancingRulePropertiesFormat) + if err != nil { + return err + } + lbr.LoadBalancingRulePropertiesFormat = &loadBalancingRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lbr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lbr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lbr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lbr.ID = &ID + } + } + } + + return nil +} + +// LoadBalancingRulePropertiesFormat properties of the load balancer. +type LoadBalancingRulePropertiesFormat struct { + // FrontendIPConfiguration - A reference to frontend IP addresses. + FrontendIPConfiguration *SubResource `json:"frontendIPConfiguration,omitempty"` + // BackendAddressPool - A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // BackendAddressPools - An array of references to pool of DIPs. + BackendAddressPools *[]SubResource `json:"backendAddressPools,omitempty"` + // Probe - The reference to the load balancer probe used by the load balancing rule. + Probe *SubResource `json:"probe,omitempty"` + // Protocol - The reference to the transport protocol used by the load balancing rule. Possible values include: 'TransportProtocolUDP', 'TransportProtocolTCP', 'TransportProtocolAll' + Protocol TransportProtocol `json:"protocol,omitempty"` + // LoadDistribution - The load distribution policy for this rule. Possible values include: 'LoadDistributionDefault', 'LoadDistributionSourceIP', 'LoadDistributionSourceIPProtocol' + LoadDistribution LoadDistribution `json:"loadDistribution,omitempty"` + // FrontendPort - The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 0 and 65534. Note that value 0 enables "Any Port". + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - The port used for internal connections on the endpoint. Acceptable values are between 0 and 65535. Note that value 0 enables "Any Port". + BackendPort *int32 `json:"backendPort,omitempty"` + // IdleTimeoutInMinutes - The timeout for the TCP idle connection. The value can be set between 4 and 30 minutes. The default value is 4 minutes. This element is only used when the protocol is set to TCP. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableFloatingIP - Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. + EnableFloatingIP *bool `json:"enableFloatingIP,omitempty"` + // EnableTCPReset - Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // DisableOutboundSnat - Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule. + DisableOutboundSnat *bool `json:"disableOutboundSnat,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the load balancing rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LoadBalancingRulePropertiesFormat. +func (lbrpf LoadBalancingRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lbrpf.FrontendIPConfiguration != nil { + objectMap["frontendIPConfiguration"] = lbrpf.FrontendIPConfiguration + } + if lbrpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = lbrpf.BackendAddressPool + } + if lbrpf.BackendAddressPools != nil { + objectMap["backendAddressPools"] = lbrpf.BackendAddressPools + } + if lbrpf.Probe != nil { + objectMap["probe"] = lbrpf.Probe + } + if lbrpf.Protocol != "" { + objectMap["protocol"] = lbrpf.Protocol + } + if lbrpf.LoadDistribution != "" { + objectMap["loadDistribution"] = lbrpf.LoadDistribution + } + if lbrpf.FrontendPort != nil { + objectMap["frontendPort"] = lbrpf.FrontendPort + } + if lbrpf.BackendPort != nil { + objectMap["backendPort"] = lbrpf.BackendPort + } + if lbrpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = lbrpf.IdleTimeoutInMinutes + } + if lbrpf.EnableFloatingIP != nil { + objectMap["enableFloatingIP"] = lbrpf.EnableFloatingIP + } + if lbrpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = lbrpf.EnableTCPReset + } + if lbrpf.DisableOutboundSnat != nil { + objectMap["disableOutboundSnat"] = lbrpf.DisableOutboundSnat + } + return json.Marshal(objectMap) +} + +// LocalNetworkGateway a common class for general resource information. +type LocalNetworkGateway struct { + autorest.Response `json:"-"` + // LocalNetworkGatewayPropertiesFormat - Properties of the local network gateway. + *LocalNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGateway. +func (lng LocalNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lng.LocalNetworkGatewayPropertiesFormat != nil { + objectMap["properties"] = lng.LocalNetworkGatewayPropertiesFormat + } + if lng.ID != nil { + objectMap["id"] = lng.ID + } + if lng.Location != nil { + objectMap["location"] = lng.Location + } + if lng.Tags != nil { + objectMap["tags"] = lng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for LocalNetworkGateway struct. +func (lng *LocalNetworkGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var localNetworkGatewayPropertiesFormat LocalNetworkGatewayPropertiesFormat + err = json.Unmarshal(*v, &localNetworkGatewayPropertiesFormat) + if err != nil { + return err + } + lng.LocalNetworkGatewayPropertiesFormat = &localNetworkGatewayPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + lng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + lng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + lng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + lng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + lng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + lng.Tags = tags + } + } + } + + return nil +} + +// LocalNetworkGatewayListResult response for ListLocalNetworkGateways API service call. +type LocalNetworkGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of local network gateways that exists in a resource group. + Value *[]LocalNetworkGateway `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGatewayListResult. +func (lnglr LocalNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lnglr.Value != nil { + objectMap["value"] = lnglr.Value + } + return json.Marshal(objectMap) +} + +// LocalNetworkGatewayListResultIterator provides access to a complete listing of LocalNetworkGateway +// values. +type LocalNetworkGatewayListResultIterator struct { + i int + page LocalNetworkGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LocalNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *LocalNetworkGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter LocalNetworkGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter LocalNetworkGatewayListResultIterator) Response() LocalNetworkGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter LocalNetworkGatewayListResultIterator) Value() LocalNetworkGateway { + if !iter.page.NotDone() { + return LocalNetworkGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the LocalNetworkGatewayListResultIterator type. +func NewLocalNetworkGatewayListResultIterator(page LocalNetworkGatewayListResultPage) LocalNetworkGatewayListResultIterator { + return LocalNetworkGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lnglr LocalNetworkGatewayListResult) IsEmpty() bool { + return lnglr.Value == nil || len(*lnglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lnglr LocalNetworkGatewayListResult) hasNextLink() bool { + return lnglr.NextLink != nil && len(*lnglr.NextLink) != 0 +} + +// localNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lnglr LocalNetworkGatewayListResult) localNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !lnglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lnglr.NextLink))) +} + +// LocalNetworkGatewayListResultPage contains a page of LocalNetworkGateway values. +type LocalNetworkGatewayListResultPage struct { + fn func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error) + lnglr LocalNetworkGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LocalNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocalNetworkGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lnglr) + if err != nil { + return err + } + page.lnglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *LocalNetworkGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page LocalNetworkGatewayListResultPage) NotDone() bool { + return !page.lnglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page LocalNetworkGatewayListResultPage) Response() LocalNetworkGatewayListResult { + return page.lnglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page LocalNetworkGatewayListResultPage) Values() []LocalNetworkGateway { + if page.lnglr.IsEmpty() { + return nil + } + return *page.lnglr.Value +} + +// Creates a new instance of the LocalNetworkGatewayListResultPage type. +func NewLocalNetworkGatewayListResultPage(cur LocalNetworkGatewayListResult, getNextPage func(context.Context, LocalNetworkGatewayListResult) (LocalNetworkGatewayListResult, error)) LocalNetworkGatewayListResultPage { + return LocalNetworkGatewayListResultPage{ + fn: getNextPage, + lnglr: cur, + } +} + +// LocalNetworkGatewayPropertiesFormat localNetworkGateway properties. +type LocalNetworkGatewayPropertiesFormat struct { + // LocalNetworkAddressSpace - Local network site address space. + LocalNetworkAddressSpace *AddressSpace `json:"localNetworkAddressSpace,omitempty"` + // GatewayIPAddress - IP address of local network gateway. + GatewayIPAddress *string `json:"gatewayIpAddress,omitempty"` + // Fqdn - FQDN of local network gateway. + Fqdn *string `json:"fqdn,omitempty"` + // BgpSettings - Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the local network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the local network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for LocalNetworkGatewayPropertiesFormat. +func (lngpf LocalNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lngpf.LocalNetworkAddressSpace != nil { + objectMap["localNetworkAddressSpace"] = lngpf.LocalNetworkAddressSpace + } + if lngpf.GatewayIPAddress != nil { + objectMap["gatewayIpAddress"] = lngpf.GatewayIPAddress + } + if lngpf.Fqdn != nil { + objectMap["fqdn"] = lngpf.Fqdn + } + if lngpf.BgpSettings != nil { + objectMap["bgpSettings"] = lngpf.BgpSettings + } + return json.Marshal(objectMap) +} + +// LocalNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LocalNetworkGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LocalNetworkGatewaysClient) (LocalNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LocalNetworkGatewaysCreateOrUpdateFuture.Result. +func (future *LocalNetworkGatewaysCreateOrUpdateFuture) result(client LocalNetworkGatewaysClient) (lng LocalNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lng.Response.Response, err = future.GetResult(sender); err == nil && lng.Response.Response.StatusCode != http.StatusNoContent { + lng, err = client.CreateOrUpdateResponder(lng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysCreateOrUpdateFuture", "Result", lng.Response.Response, "Failure responding to request") + } + } + return +} + +// LocalNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type LocalNetworkGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(LocalNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *LocalNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for LocalNetworkGatewaysDeleteFuture.Result. +func (future *LocalNetworkGatewaysDeleteFuture) result(client LocalNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.LocalNetworkGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// LogSpecification description of logging specification. +type LogSpecification struct { + // Name - The name of the specification. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the specification. + DisplayName *string `json:"displayName,omitempty"` + // BlobDuration - Duration of the blob. + BlobDuration *string `json:"blobDuration,omitempty"` +} + +// ManagedRuleGroupOverride defines a managed rule group override setting. +type ManagedRuleGroupOverride struct { + // RuleGroupName - The managed rule group to override. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + // Rules - List of rules that will be disabled. If none specified, all rules in the group will be disabled. + Rules *[]ManagedRuleOverride `json:"rules,omitempty"` +} + +// ManagedRuleOverride defines a managed rule group override setting. +type ManagedRuleOverride struct { + // RuleID - Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` + // State - The state of the managed rule. Defaults to Disabled if not specified. Possible values include: 'ManagedRuleEnabledStateDisabled' + State ManagedRuleEnabledState `json:"state,omitempty"` +} + +// ManagedRulesDefinition allow to exclude some variable satisfy the condition for the WAF check. +type ManagedRulesDefinition struct { + // Exclusions - The Exclusions that are applied on the policy. + Exclusions *[]OwaspCrsExclusionEntry `json:"exclusions,omitempty"` + // ManagedRuleSets - The managed rule sets that are associated with the policy. + ManagedRuleSets *[]ManagedRuleSet `json:"managedRuleSets,omitempty"` +} + +// ManagedRuleSet defines a managed rule set. +type ManagedRuleSet struct { + // RuleSetType - Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + // RuleSetVersion - Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + // RuleGroupOverrides - Defines the rule group overrides to apply to the rule set. + RuleGroupOverrides *[]ManagedRuleGroupOverride `json:"ruleGroupOverrides,omitempty"` +} + +// ManagedServiceIdentity identity for the resource. +type ManagedServiceIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity. This property will only be provided for a system assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string `json:"tenantId,omitempty"` + // Type - The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine. Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeSystemAssignedUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedServiceIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentity. +func (msi ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if msi.Type != "" { + objectMap["type"] = msi.Type + } + if msi.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = msi.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedServiceIdentityUserAssignedIdentitiesValue ... +type ManagedServiceIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedServiceIdentityUserAssignedIdentitiesValue. +func (msiAiv ManagedServiceIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// MatchCondition define match conditions. +type MatchCondition struct { + // MatchVariables - List of match variables. + MatchVariables *[]MatchVariable `json:"matchVariables,omitempty"` + // Operator - The operator to be matched. Possible values include: 'WebApplicationFirewallOperatorIPMatch', 'WebApplicationFirewallOperatorEqual', 'WebApplicationFirewallOperatorContains', 'WebApplicationFirewallOperatorLessThan', 'WebApplicationFirewallOperatorGreaterThan', 'WebApplicationFirewallOperatorLessThanOrEqual', 'WebApplicationFirewallOperatorGreaterThanOrEqual', 'WebApplicationFirewallOperatorBeginsWith', 'WebApplicationFirewallOperatorEndsWith', 'WebApplicationFirewallOperatorRegex', 'WebApplicationFirewallOperatorGeoMatch' + Operator WebApplicationFirewallOperator `json:"operator,omitempty"` + // NegationConditon - Whether this is negate condition or not. + NegationConditon *bool `json:"negationConditon,omitempty"` + // MatchValues - Match value. + MatchValues *[]string `json:"matchValues,omitempty"` + // Transforms - List of transforms. + Transforms *[]WebApplicationFirewallTransform `json:"transforms,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"` +} + +// MatchVariable define match variables. +type MatchVariable struct { + // VariableName - Match Variable. Possible values include: 'WebApplicationFirewallMatchVariableRemoteAddr', 'WebApplicationFirewallMatchVariableRequestMethod', 'WebApplicationFirewallMatchVariableQueryString', 'WebApplicationFirewallMatchVariablePostArgs', 'WebApplicationFirewallMatchVariableRequestURI', 'WebApplicationFirewallMatchVariableRequestHeaders', 'WebApplicationFirewallMatchVariableRequestBody', 'WebApplicationFirewallMatchVariableRequestCookies' + VariableName WebApplicationFirewallMatchVariable `json:"variableName,omitempty"` + // Selector - The selector of match variable. + Selector *string `json:"selector,omitempty"` +} + +// MetricSpecification description of metrics specification. +type MetricSpecification struct { + // Name - The name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - The display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - The description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Units the metric to be displayed in. + Unit *string `json:"unit,omitempty"` + // AggregationType - The aggregation type. + AggregationType *string `json:"aggregationType,omitempty"` + // Availabilities - List of availability. + Availabilities *[]Availability `json:"availabilities,omitempty"` + // EnableRegionalMdmAccount - Whether regional MDM account enabled. + EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` + // FillGapWithZero - Whether gaps would be filled with zeros. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // MetricFilterPattern - Pattern for the filter of the metric. + MetricFilterPattern *string `json:"metricFilterPattern,omitempty"` + // Dimensions - List of dimensions. + Dimensions *[]Dimension `json:"dimensions,omitempty"` + // IsInternal - Whether the metric is internal. + IsInternal *bool `json:"isInternal,omitempty"` + // SourceMdmAccount - The source MDM account. + SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` + // SourceMdmNamespace - The source MDM namespace. + SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` + // ResourceIDDimensionNameOverride - The resource Id dimension name override. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` +} + +// NatGateway nat Gateway resource. +type NatGateway struct { + autorest.Response `json:"-"` + // Sku - The nat gateway SKU. + Sku *NatGatewaySku `json:"sku,omitempty"` + // NatGatewayPropertiesFormat - Nat Gateway properties. + *NatGatewayPropertiesFormat `json:"properties,omitempty"` + // Zones - A list of availability zones denoting the zone in which Nat Gateway should be deployed. + Zones *[]string `json:"zones,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for NatGateway. +func (ng NatGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ng.Sku != nil { + objectMap["sku"] = ng.Sku + } + if ng.NatGatewayPropertiesFormat != nil { + objectMap["properties"] = ng.NatGatewayPropertiesFormat + } + if ng.Zones != nil { + objectMap["zones"] = ng.Zones + } + if ng.ID != nil { + objectMap["id"] = ng.ID + } + if ng.Location != nil { + objectMap["location"] = ng.Location + } + if ng.Tags != nil { + objectMap["tags"] = ng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NatGateway struct. +func (ng *NatGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku NatGatewaySku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + ng.Sku = &sku + } + case "properties": + if v != nil { + var natGatewayPropertiesFormat NatGatewayPropertiesFormat + err = json.Unmarshal(*v, &natGatewayPropertiesFormat) + if err != nil { + return err + } + ng.NatGatewayPropertiesFormat = &natGatewayPropertiesFormat + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + ng.Zones = &zones + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ng.Tags = tags + } + } + } + + return nil +} + +// NatGatewayListResult response for ListNatGateways API service call. +type NatGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of Nat Gateways that exists in a resource group. + Value *[]NatGateway `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// NatGatewayListResultIterator provides access to a complete listing of NatGateway values. +type NatGatewayListResultIterator struct { + i int + page NatGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NatGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NatGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NatGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NatGatewayListResultIterator) Response() NatGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NatGatewayListResultIterator) Value() NatGateway { + if !iter.page.NotDone() { + return NatGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NatGatewayListResultIterator type. +func NewNatGatewayListResultIterator(page NatGatewayListResultPage) NatGatewayListResultIterator { + return NatGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nglr NatGatewayListResult) IsEmpty() bool { + return nglr.Value == nil || len(*nglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nglr NatGatewayListResult) hasNextLink() bool { + return nglr.NextLink != nil && len(*nglr.NextLink) != 0 +} + +// natGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nglr NatGatewayListResult) natGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !nglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nglr.NextLink))) +} + +// NatGatewayListResultPage contains a page of NatGateway values. +type NatGatewayListResultPage struct { + fn func(context.Context, NatGatewayListResult) (NatGatewayListResult, error) + nglr NatGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NatGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nglr) + if err != nil { + return err + } + page.nglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NatGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NatGatewayListResultPage) NotDone() bool { + return !page.nglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NatGatewayListResultPage) Response() NatGatewayListResult { + return page.nglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NatGatewayListResultPage) Values() []NatGateway { + if page.nglr.IsEmpty() { + return nil + } + return *page.nglr.Value +} + +// Creates a new instance of the NatGatewayListResultPage type. +func NewNatGatewayListResultPage(cur NatGatewayListResult, getNextPage func(context.Context, NatGatewayListResult) (NatGatewayListResult, error)) NatGatewayListResultPage { + return NatGatewayListResultPage{ + fn: getNextPage, + nglr: cur, + } +} + +// NatGatewayPropertiesFormat nat Gateway properties. +type NatGatewayPropertiesFormat struct { + // IdleTimeoutInMinutes - The idle timeout of the nat gateway. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // PublicIPAddresses - An array of public ip addresses associated with the nat gateway resource. + PublicIPAddresses *[]SubResource `json:"publicIpAddresses,omitempty"` + // PublicIPPrefixes - An array of public ip prefixes associated with the nat gateway resource. + PublicIPPrefixes *[]SubResource `json:"publicIpPrefixes,omitempty"` + // Subnets - READ-ONLY; An array of references to the subnets using this nat gateway resource. + Subnets *[]SubResource `json:"subnets,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the NAT gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the NAT gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for NatGatewayPropertiesFormat. +func (ngpf NatGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ngpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = ngpf.IdleTimeoutInMinutes + } + if ngpf.PublicIPAddresses != nil { + objectMap["publicIpAddresses"] = ngpf.PublicIPAddresses + } + if ngpf.PublicIPPrefixes != nil { + objectMap["publicIpPrefixes"] = ngpf.PublicIPPrefixes + } + return json.Marshal(objectMap) +} + +// NatGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type NatGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatGatewaysClient) (NatGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatGatewaysCreateOrUpdateFuture.Result. +func (future *NatGatewaysCreateOrUpdateFuture) result(client NatGatewaysClient) (ng NatGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ng.Response.Response, err = future.GetResult(sender); err == nil && ng.Response.Response.StatusCode != http.StatusNoContent { + ng, err = client.CreateOrUpdateResponder(ng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysCreateOrUpdateFuture", "Result", ng.Response.Response, "Failure responding to request") + } + } + return +} + +// NatGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatGatewaysDeleteFuture.Result. +func (future *NatGatewaysDeleteFuture) result(client NatGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NatGatewaySku SKU of nat gateway. +type NatGatewaySku struct { + // Name - Name of Nat Gateway SKU. Possible values include: 'NatGatewaySkuNameStandard' + Name NatGatewaySkuName `json:"name,omitempty"` +} + +// NatRule rule of type nat. +type NatRule struct { + // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // TranslatedAddress - The translated address for this NAT rule. + TranslatedAddress *string `json:"translatedAddress,omitempty"` + // TranslatedPort - The translated port for this NAT rule. + TranslatedPort *string `json:"translatedPort,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // TranslatedFqdn - The translated FQDN for this NAT rule. + TranslatedFqdn *string `json:"translatedFqdn,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for NatRule. +func (nr NatRule) MarshalJSON() ([]byte, error) { + nr.RuleType = RuleTypeNatRule + objectMap := make(map[string]interface{}) + if nr.IPProtocols != nil { + objectMap["ipProtocols"] = nr.IPProtocols + } + if nr.SourceAddresses != nil { + objectMap["sourceAddresses"] = nr.SourceAddresses + } + if nr.DestinationAddresses != nil { + objectMap["destinationAddresses"] = nr.DestinationAddresses + } + if nr.DestinationPorts != nil { + objectMap["destinationPorts"] = nr.DestinationPorts + } + if nr.TranslatedAddress != nil { + objectMap["translatedAddress"] = nr.TranslatedAddress + } + if nr.TranslatedPort != nil { + objectMap["translatedPort"] = nr.TranslatedPort + } + if nr.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = nr.SourceIPGroups + } + if nr.TranslatedFqdn != nil { + objectMap["translatedFqdn"] = nr.TranslatedFqdn + } + if nr.Name != nil { + objectMap["name"] = nr.Name + } + if nr.Description != nil { + objectMap["description"] = nr.Description + } + if nr.RuleType != "" { + objectMap["ruleType"] = nr.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsNatRule() (*NatRule, bool) { + return &nr, true +} + +// AsRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsRule() (*Rule, bool) { + return nil, false +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for NatRule. +func (nr NatRule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &nr, true +} + +// NatRulePortMapping individual port mappings for inbound NAT rule created for backend pool. +type NatRulePortMapping struct { + // InboundNatRuleName - Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` + // FrontendPort - Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + // BackendPort - Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` +} + +// NatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatRulesClient) (VpnGatewayNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatRulesCreateOrUpdateFuture.Result. +func (future *NatRulesCreateOrUpdateFuture) result(client NatRulesClient) (vgnr VpnGatewayNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vgnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vgnr.Response.Response, err = future.GetResult(sender); err == nil && vgnr.Response.Response.StatusCode != http.StatusNoContent { + vgnr, err = client.CreateOrUpdateResponder(vgnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesCreateOrUpdateFuture", "Result", vgnr.Response.Response, "Failure responding to request") + } + } + return +} + +// NatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type NatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(NatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *NatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for NatRulesDeleteFuture.Result. +func (future *NatRulesDeleteFuture) result(client NatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.NatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// NextHopParameters parameters that define the source and destination endpoint. +type NextHopParameters struct { + // TargetResourceID - The resource identifier of the target resource against which the action is to be performed. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // SourceIPAddress - The source IP address. + SourceIPAddress *string `json:"sourceIPAddress,omitempty"` + // DestinationIPAddress - The destination IP address. + DestinationIPAddress *string `json:"destinationIPAddress,omitempty"` + // TargetNicResourceID - The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of the nics, then this parameter must be specified. Otherwise optional). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// NextHopResult the information about next hop from the specified VM. +type NextHopResult struct { + autorest.Response `json:"-"` + // NextHopType - Next hop type. Possible values include: 'NextHopTypeInternet', 'NextHopTypeVirtualAppliance', 'NextHopTypeVirtualNetworkGateway', 'NextHopTypeVnetLocal', 'NextHopTypeHyperNetGateway', 'NextHopTypeNone' + NextHopType NextHopType `json:"nextHopType,omitempty"` + // NextHopIPAddress - Next hop IP Address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + // RouteTableID - The resource identifier for the route table associated with the route being returned. If the route being returned does not correspond to any user created routes then this field will be the string 'System Route'. + RouteTableID *string `json:"routeTableId,omitempty"` +} + +// O365BreakOutCategoryPolicies office365 breakout categories. +type O365BreakOutCategoryPolicies struct { + // Allow - Flag to control allow category. + Allow *bool `json:"allow,omitempty"` + // Optimize - Flag to control optimize category. + Optimize *bool `json:"optimize,omitempty"` + // Default - Flag to control default category. + Default *bool `json:"default,omitempty"` +} + +// O365PolicyProperties the Office365 breakout policy. +type O365PolicyProperties struct { + // BreakOutCategories - Office365 breakout categories. + BreakOutCategories *O365BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Office365PolicyProperties network Virtual Appliance Sku Properties. +type Office365PolicyProperties struct { + // BreakOutCategories - Office 365 breakout categories. + BreakOutCategories *BreakOutCategoryPolicies `json:"breakOutCategories,omitempty"` +} + +// Operation network REST API operation definition. +type Operation struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation. + Origin *string `json:"origin,omitempty"` + // OperationPropertiesFormat - Operation properties format. + *OperationPropertiesFormat `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Name != nil { + objectMap["name"] = o.Name + } + if o.Display != nil { + objectMap["display"] = o.Display + } + if o.Origin != nil { + objectMap["origin"] = o.Origin + } + if o.OperationPropertiesFormat != nil { + objectMap["properties"] = o.OperationPropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Operation struct. +func (o *Operation) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "display": + if v != nil { + var display OperationDisplay + err = json.Unmarshal(*v, &display) + if err != nil { + return err + } + o.Display = &display + } + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationPropertiesFormat OperationPropertiesFormat + err = json.Unmarshal(*v, &operationPropertiesFormat) + if err != nil { + return err + } + o.OperationPropertiesFormat = &operationPropertiesFormat + } + } + } + + return nil +} + +// OperationDisplay display metadata associated with the operation. +type OperationDisplay struct { + // Provider - Service provider: Microsoft Network. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of the operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation. + Description *string `json:"description,omitempty"` +} + +// OperationListResult result of the request to list Network operations. It contains a list of operations +// and a URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - List of Network operations supported by the Network resource provider. + Value *[]Operation `json:"value,omitempty"` + // NextLink - URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// OperationPropertiesFormat description of operation properties format. +type OperationPropertiesFormat struct { + // ServiceSpecification - Specification of the service. + ServiceSpecification *OperationPropertiesFormatServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationPropertiesFormatServiceSpecification specification of the service. +type OperationPropertiesFormatServiceSpecification struct { + // MetricSpecifications - Operation service specification. + MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` + // LogSpecifications - Operation log specification. + LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` +} + +// OrderBy describes a column to sort +type OrderBy struct { + // Field - Describes the actual column name to sort by + Field *string `json:"field,omitempty"` + // Order - Describes if results should be in ascending/descending order. Possible values include: 'FirewallPolicyIDPSQuerySortOrderAscending', 'FirewallPolicyIDPSQuerySortOrderDescending' + Order FirewallPolicyIDPSQuerySortOrder `json:"order,omitempty"` +} + +// OutboundRule outbound rule of the load balancer. +type OutboundRule struct { + autorest.Response `json:"-"` + // OutboundRulePropertiesFormat - Properties of load balancer outbound rule. + *OutboundRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundRule. +func (or OutboundRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if or.OutboundRulePropertiesFormat != nil { + objectMap["properties"] = or.OutboundRulePropertiesFormat + } + if or.Name != nil { + objectMap["name"] = or.Name + } + if or.ID != nil { + objectMap["id"] = or.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OutboundRule struct. +func (or *OutboundRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var outboundRulePropertiesFormat OutboundRulePropertiesFormat + err = json.Unmarshal(*v, &outboundRulePropertiesFormat) + if err != nil { + return err + } + or.OutboundRulePropertiesFormat = &outboundRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + or.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + or.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + or.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + or.ID = &ID + } + } + } + + return nil +} + +// OutboundRulePropertiesFormat outbound rule of the load balancer. +type OutboundRulePropertiesFormat struct { + // AllocatedOutboundPorts - The number of outbound ports to be used for NAT. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // FrontendIPConfigurations - The Frontend IP addresses of the load balancer. + FrontendIPConfigurations *[]SubResource `json:"frontendIPConfigurations,omitempty"` + // BackendAddressPool - A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. + BackendAddressPool *SubResource `json:"backendAddressPool,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the outbound rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Protocol - The protocol for the outbound rule in load balancer. Possible values include: 'LoadBalancerOutboundRuleProtocolTCP', 'LoadBalancerOutboundRuleProtocolUDP', 'LoadBalancerOutboundRuleProtocolAll' + Protocol LoadBalancerOutboundRuleProtocol `json:"protocol,omitempty"` + // EnableTCPReset - Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. + EnableTCPReset *bool `json:"enableTcpReset,omitempty"` + // IdleTimeoutInMinutes - The timeout for the TCP idle connection. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundRulePropertiesFormat. +func (orpf OutboundRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if orpf.AllocatedOutboundPorts != nil { + objectMap["allocatedOutboundPorts"] = orpf.AllocatedOutboundPorts + } + if orpf.FrontendIPConfigurations != nil { + objectMap["frontendIPConfigurations"] = orpf.FrontendIPConfigurations + } + if orpf.BackendAddressPool != nil { + objectMap["backendAddressPool"] = orpf.BackendAddressPool + } + if orpf.Protocol != "" { + objectMap["protocol"] = orpf.Protocol + } + if orpf.EnableTCPReset != nil { + objectMap["enableTcpReset"] = orpf.EnableTCPReset + } + if orpf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = orpf.IdleTimeoutInMinutes + } + return json.Marshal(objectMap) +} + +// OwaspCrsExclusionEntry allow to exclude some variable satisfy the condition for the WAF check. +type OwaspCrsExclusionEntry struct { + // MatchVariable - The variable to be excluded. Possible values include: 'OwaspCrsExclusionEntryMatchVariableRequestHeaderNames', 'OwaspCrsExclusionEntryMatchVariableRequestCookieNames', 'OwaspCrsExclusionEntryMatchVariableRequestArgNames', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys', 'OwaspCrsExclusionEntryMatchVariableRequestHeaderValues', 'OwaspCrsExclusionEntryMatchVariableRequestCookieKeys', 'OwaspCrsExclusionEntryMatchVariableRequestCookieValues', 'OwaspCrsExclusionEntryMatchVariableRequestArgKeys', 'OwaspCrsExclusionEntryMatchVariableRequestArgValues' + MatchVariable OwaspCrsExclusionEntryMatchVariable `json:"matchVariable,omitempty"` + // SelectorMatchOperator - When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. Possible values include: 'OwaspCrsExclusionEntrySelectorMatchOperatorEquals', 'OwaspCrsExclusionEntrySelectorMatchOperatorContains', 'OwaspCrsExclusionEntrySelectorMatchOperatorStartsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEndsWith', 'OwaspCrsExclusionEntrySelectorMatchOperatorEqualsAny' + SelectorMatchOperator OwaspCrsExclusionEntrySelectorMatchOperator `json:"selectorMatchOperator,omitempty"` + // Selector - When matchVariable is a collection, operator used to specify which elements in the collection this exclusion applies to. + Selector *string `json:"selector,omitempty"` + // ExclusionManagedRuleSets - The managed rule sets that are associated with the exclusion. + ExclusionManagedRuleSets *[]ExclusionManagedRuleSet `json:"exclusionManagedRuleSets,omitempty"` +} + +// P2SConnectionConfiguration p2SConnectionConfiguration Resource. +type P2SConnectionConfiguration struct { + // P2SConnectionConfigurationProperties - Properties of the P2S connection configuration. + *P2SConnectionConfigurationProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SConnectionConfiguration. +func (pcc P2SConnectionConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcc.P2SConnectionConfigurationProperties != nil { + objectMap["properties"] = pcc.P2SConnectionConfigurationProperties + } + if pcc.Name != nil { + objectMap["name"] = pcc.Name + } + if pcc.ID != nil { + objectMap["id"] = pcc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for P2SConnectionConfiguration struct. +func (pcc *P2SConnectionConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var p2SConnectionConfigurationProperties P2SConnectionConfigurationProperties + err = json.Unmarshal(*v, &p2SConnectionConfigurationProperties) + if err != nil { + return err + } + pcc.P2SConnectionConfigurationProperties = &p2SConnectionConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pcc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pcc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pcc.ID = &ID + } + } + } + + return nil +} + +// P2SConnectionConfigurationProperties parameters for P2SConnectionConfiguration. +type P2SConnectionConfigurationProperties struct { + // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` + // EnableInternetSecurity - Flag indicating whether the enable internet security flag is turned on for the P2S Connections or not. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // ConfigurationPolicyGroupAssociations - READ-ONLY; List of Configuration Policy Groups that this P2SConnectionConfiguration is attached to. + ConfigurationPolicyGroupAssociations *[]SubResource `json:"configurationPolicyGroupAssociations,omitempty"` + // PreviousConfigurationPolicyGroupAssociations - READ-ONLY; List of previous Configuration Policy Groups that this P2SConnectionConfiguration was attached to. + PreviousConfigurationPolicyGroupAssociations *[]VpnServerConfigurationPolicyGroup `json:"previousConfigurationPolicyGroupAssociations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the P2SConnectionConfiguration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SConnectionConfigurationProperties. +func (pccp P2SConnectionConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pccp.VpnClientAddressPool != nil { + objectMap["vpnClientAddressPool"] = pccp.VpnClientAddressPool + } + if pccp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = pccp.RoutingConfiguration + } + if pccp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = pccp.EnableInternetSecurity + } + return json.Marshal(objectMap) +} + +// P2SVpnConnectionHealth p2S Vpn connection detailed health written to sas url. +type P2SVpnConnectionHealth struct { + autorest.Response `json:"-"` + // SasURL - Returned sas url of the blob to which the p2s vpn connection detailed health will be written. + SasURL *string `json:"sasUrl,omitempty"` +} + +// P2SVpnConnectionHealthRequest list of P2S Vpn connection health request. +type P2SVpnConnectionHealthRequest struct { + // VpnUserNamesFilter - The list of p2s vpn user names whose p2s vpn connection detailed health to retrieve for. + VpnUserNamesFilter *[]string `json:"vpnUserNamesFilter,omitempty"` + // OutputBlobSasURL - The sas-url to download the P2S Vpn connection health detail. + OutputBlobSasURL *string `json:"outputBlobSasUrl,omitempty"` +} + +// P2SVpnConnectionRequest list of p2s vpn connections to be disconnected. +type P2SVpnConnectionRequest struct { + // VpnConnectionIds - List of p2s vpn connection Ids. + VpnConnectionIds *[]string `json:"vpnConnectionIds,omitempty"` +} + +// P2SVpnGateway p2SVpnGateway Resource. +type P2SVpnGateway struct { + autorest.Response `json:"-"` + // P2SVpnGatewayProperties - Properties of the P2SVpnGateway. + *P2SVpnGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for P2SVpnGateway. +func (pvg P2SVpnGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pvg.P2SVpnGatewayProperties != nil { + objectMap["properties"] = pvg.P2SVpnGatewayProperties + } + if pvg.ID != nil { + objectMap["id"] = pvg.ID + } + if pvg.Location != nil { + objectMap["location"] = pvg.Location + } + if pvg.Tags != nil { + objectMap["tags"] = pvg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for P2SVpnGateway struct. +func (pvg *P2SVpnGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var p2SVpnGatewayProperties P2SVpnGatewayProperties + err = json.Unmarshal(*v, &p2SVpnGatewayProperties) + if err != nil { + return err + } + pvg.P2SVpnGatewayProperties = &p2SVpnGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pvg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pvg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pvg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pvg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pvg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pvg.Tags = tags + } + } + } + + return nil +} + +// P2SVpnGatewayProperties parameters for P2SVpnGateway. +type P2SVpnGatewayProperties struct { + // VirtualHub - The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // P2SConnectionConfigurations - List of all p2s connection configurations of the gateway. + P2SConnectionConfigurations *[]P2SConnectionConfiguration `json:"p2SConnectionConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the P2S VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnGatewayScaleUnit - The scale unit for this p2s vpn gateway. + VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + // VpnServerConfiguration - The VpnServerConfiguration to which the p2sVpnGateway is attached to. + VpnServerConfiguration *SubResource `json:"vpnServerConfiguration,omitempty"` + // VpnClientConnectionHealth - READ-ONLY; All P2S VPN clients' connection health status. + VpnClientConnectionHealth *VpnClientConnectionHealth `json:"vpnClientConnectionHealth,omitempty"` + // CustomDNSServers - List of all customer specified DNS servers IP addresses. + CustomDNSServers *[]string `json:"customDnsServers,omitempty"` + // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` +} + +// MarshalJSON is the custom marshaler for P2SVpnGatewayProperties. +func (pvgp P2SVpnGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pvgp.VirtualHub != nil { + objectMap["virtualHub"] = pvgp.VirtualHub + } + if pvgp.P2SConnectionConfigurations != nil { + objectMap["p2SConnectionConfigurations"] = pvgp.P2SConnectionConfigurations + } + if pvgp.VpnGatewayScaleUnit != nil { + objectMap["vpnGatewayScaleUnit"] = pvgp.VpnGatewayScaleUnit + } + if pvgp.VpnServerConfiguration != nil { + objectMap["vpnServerConfiguration"] = pvgp.VpnServerConfiguration + } + if pvgp.CustomDNSServers != nil { + objectMap["customDnsServers"] = pvgp.CustomDNSServers + } + if pvgp.IsRoutingPreferenceInternet != nil { + objectMap["isRoutingPreferenceInternet"] = pvgp.IsRoutingPreferenceInternet + } + return json.Marshal(objectMap) +} + +// P2sVpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysCreateOrUpdateFuture.Result. +func (future *P2sVpnGatewaysCreateOrUpdateFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.CreateOrUpdateResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysCreateOrUpdateFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type P2sVpnGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysDeleteFuture.Result. +func (future *P2sVpnGatewaysDeleteFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture.Result. +func (future *P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture) result(client P2sVpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture") + return + } + ar.Response = future.Response() + return +} + +// P2sVpnGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysGenerateVpnProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (VpnProfileResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGenerateVpnProfileFuture.Result. +func (future *P2sVpnGatewaysGenerateVpnProfileFuture) result(client P2sVpnGatewaysClient) (vpr VpnProfileResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vpr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGenerateVpnProfileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vpr.Response.Response, err = future.GetResult(sender); err == nil && vpr.Response.Response.StatusCode != http.StatusNoContent { + vpr, err = client.GenerateVpnProfileResponder(vpr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGenerateVpnProfileFuture", "Result", vpr.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnConnectionHealth, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture.Result. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture) result(client P2sVpnGatewaysClient) (pvch P2SVpnConnectionHealth, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvch.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvch.Response.Response, err = future.GetResult(sender); err == nil && pvch.Response.Response.StatusCode != http.StatusNoContent { + pvch, err = client.GetP2sVpnConnectionHealthDetailedResponder(pvch.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture", "Result", pvch.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysGetP2sVpnConnectionHealthFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type P2sVpnGatewaysGetP2sVpnConnectionHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysGetP2sVpnConnectionHealthFuture.Result. +func (future *P2sVpnGatewaysGetP2sVpnConnectionHealthFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.GetP2sVpnConnectionHealthResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2SVpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type P2SVpnGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2SVpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2SVpnGatewaysResetFuture.Result. +func (future *P2SVpnGatewaysResetFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2SVpnGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.ResetResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2SVpnGatewaysResetFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2sVpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type P2sVpnGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(P2sVpnGatewaysClient) (P2SVpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *P2sVpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for P2sVpnGatewaysUpdateTagsFuture.Result. +func (future *P2sVpnGatewaysUpdateTagsFuture) result(client P2sVpnGatewaysClient) (pvg P2SVpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pvg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.P2sVpnGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pvg.Response.Response, err = future.GetResult(sender); err == nil && pvg.Response.Response.StatusCode != http.StatusNoContent { + pvg, err = client.UpdateTagsResponder(pvg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysUpdateTagsFuture", "Result", pvg.Response.Response, "Failure responding to request") + } + } + return +} + +// P2SVpnProfileParameters vpn Client Parameters for package generation. +type P2SVpnProfileParameters struct { + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` +} + +// PacketCapture parameters that define the create packet capture operation. +type PacketCapture struct { + // PacketCaptureParameters - Properties of the packet capture. + *PacketCaptureParameters `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCapture. +func (pc PacketCapture) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pc.PacketCaptureParameters != nil { + objectMap["properties"] = pc.PacketCaptureParameters + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PacketCapture struct. +func (pc *PacketCapture) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var packetCaptureParameters PacketCaptureParameters + err = json.Unmarshal(*v, &packetCaptureParameters) + if err != nil { + return err + } + pc.PacketCaptureParameters = &packetCaptureParameters + } + } + } + + return nil +} + +// PacketCaptureFilter filter that is applied to packet capture request. Multiple filters can be applied. +type PacketCaptureFilter struct { + // Protocol - Protocol to be filtered on. Possible values include: 'PcProtocolTCP', 'PcProtocolUDP', 'PcProtocolAny' + Protocol PcProtocol `json:"protocol,omitempty"` + // LocalIPAddress - Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + // RemoteIPAddress - Local IP Address to be filtered on. Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for range. "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + // LocalPort - Local port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. + LocalPort *string `json:"localPort,omitempty"` + // RemotePort - Remote port to be filtered on. Notation: "80" for single port entry."80-85" for range. "80;443;" for multiple entries. Multiple ranges not currently supported. Mixing ranges with multiple entries not currently supported. Default = null. + RemotePort *string `json:"remotePort,omitempty"` +} + +// PacketCaptureListResult list of packet capture sessions. +type PacketCaptureListResult struct { + autorest.Response `json:"-"` + // Value - Information about packet capture sessions. + Value *[]PacketCaptureResult `json:"value,omitempty"` +} + +// PacketCaptureParameters parameters that define the create packet capture operation. +type PacketCaptureParameters struct { + // Target - The ID of the targeted resource, only VM is currently supported. + Target *string `json:"target,omitempty"` + // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + // TotalBytesPerSession - Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` + // TimeLimitInSeconds - Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + // StorageLocation - The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + // Filters - A list of packet capture filters. + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// PacketCaptureQueryStatusResult status of packet capture session. +type PacketCaptureQueryStatusResult struct { + autorest.Response `json:"-"` + // Name - The name of the packet capture resource. + Name *string `json:"name,omitempty"` + // ID - The ID of the packet capture resource. + ID *string `json:"id,omitempty"` + // CaptureStartTime - The start time of the packet capture session. + CaptureStartTime *date.Time `json:"captureStartTime,omitempty"` + // PacketCaptureStatus - The status of the packet capture session. Possible values include: 'PcStatusNotStarted', 'PcStatusRunning', 'PcStatusStopped', 'PcStatusError', 'PcStatusUnknown' + PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"` + // StopReason - The reason the current packet capture session was stopped. + StopReason *string `json:"stopReason,omitempty"` + // PacketCaptureError - List of errors of packet capture session. + PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"` +} + +// PacketCaptureResult information about packet capture session. +type PacketCaptureResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; Name of the packet capture session. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; ID of the packet capture operation. + ID *string `json:"id,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // PacketCaptureResultProperties - Properties of the packet capture result. + *PacketCaptureResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCaptureResult. +func (pcr PacketCaptureResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcr.PacketCaptureResultProperties != nil { + objectMap["properties"] = pcr.PacketCaptureResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PacketCaptureResult struct. +func (pcr *PacketCaptureResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pcr.Name = &name + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pcr.ID = &ID + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pcr.Etag = &etag + } + case "properties": + if v != nil { + var packetCaptureResultProperties PacketCaptureResultProperties + err = json.Unmarshal(*v, &packetCaptureResultProperties) + if err != nil { + return err + } + pcr.PacketCaptureResultProperties = &packetCaptureResultProperties + } + } + } + + return nil +} + +// PacketCaptureResultProperties the properties of a packet capture session. +type PacketCaptureResultProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the packet capture session. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Target - The ID of the targeted resource, only VM is currently supported. + Target *string `json:"target,omitempty"` + // BytesToCapturePerPacket - Number of bytes captured per packet, the remaining bytes are truncated. + BytesToCapturePerPacket *int64 `json:"bytesToCapturePerPacket,omitempty"` + // TotalBytesPerSession - Maximum size of the capture output. + TotalBytesPerSession *int64 `json:"totalBytesPerSession,omitempty"` + // TimeLimitInSeconds - Maximum duration of the capture session in seconds. + TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"` + // StorageLocation - The storage location for a packet capture session. + StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"` + // Filters - A list of packet capture filters. + Filters *[]PacketCaptureFilter `json:"filters,omitempty"` +} + +// MarshalJSON is the custom marshaler for PacketCaptureResultProperties. +func (pcrp PacketCaptureResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pcrp.Target != nil { + objectMap["target"] = pcrp.Target + } + if pcrp.BytesToCapturePerPacket != nil { + objectMap["bytesToCapturePerPacket"] = pcrp.BytesToCapturePerPacket + } + if pcrp.TotalBytesPerSession != nil { + objectMap["totalBytesPerSession"] = pcrp.TotalBytesPerSession + } + if pcrp.TimeLimitInSeconds != nil { + objectMap["timeLimitInSeconds"] = pcrp.TimeLimitInSeconds + } + if pcrp.StorageLocation != nil { + objectMap["storageLocation"] = pcrp.StorageLocation + } + if pcrp.Filters != nil { + objectMap["filters"] = pcrp.Filters + } + return json.Marshal(objectMap) +} + +// PacketCapturesCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (PacketCaptureResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesCreateFuture.Result. +func (future *PacketCapturesCreateFuture) result(client PacketCapturesClient) (pcr PacketCaptureResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcr.Response.Response, err = future.GetResult(sender); err == nil && pcr.Response.Response.StatusCode != http.StatusNoContent { + pcr, err = client.CreateResponder(pcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesCreateFuture", "Result", pcr.Response.Response, "Failure responding to request") + } + } + return +} + +// PacketCapturesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesDeleteFuture.Result. +func (future *PacketCapturesDeleteFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PacketCapturesGetStatusFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesGetStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (PacketCaptureQueryStatusResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesGetStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesGetStatusFuture.Result. +func (future *PacketCapturesGetStatusFuture) result(client PacketCapturesClient) (pcqsr PacketCaptureQueryStatusResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pcqsr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesGetStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pcqsr.Response.Response, err = future.GetResult(sender); err == nil && pcqsr.Response.Response.StatusCode != http.StatusNoContent { + pcqsr, err = client.GetStatusResponder(pcqsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesGetStatusFuture", "Result", pcqsr.Response.Response, "Failure responding to request") + } + } + return +} + +// PacketCapturesStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PacketCapturesStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PacketCapturesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PacketCapturesStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PacketCapturesStopFuture.Result. +func (future *PacketCapturesStopFuture) result(client PacketCapturesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PacketCapturesStopFuture") + return + } + ar.Response = future.Response() + return +} + +// PacketCaptureStorageLocation the storage location for a packet capture session. +type PacketCaptureStorageLocation struct { + // StorageID - The ID of the storage account to save the packet capture session. Required if no local file path is provided. + StorageID *string `json:"storageId,omitempty"` + // StoragePath - The URI of the storage path to save the packet capture. Must be a well-formed URI describing the location to save the packet capture. + StoragePath *string `json:"storagePath,omitempty"` + // FilePath - A valid local path on the targeting VM. Must include the name of the capture file (*.cap). For linux virtual machine it must start with /var/captures. Required if no storage ID is provided, otherwise optional. + FilePath *string `json:"filePath,omitempty"` +} + +// PatchRouteFilter route Filter Resource. +type PatchRouteFilter struct { + // RouteFilterPropertiesFormat - Properties of the route filter. + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchRouteFilter. +func (prf PatchRouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prf.RouteFilterPropertiesFormat != nil { + objectMap["properties"] = prf.RouteFilterPropertiesFormat + } + if prf.Tags != nil { + objectMap["tags"] = prf.Tags + } + if prf.ID != nil { + objectMap["id"] = prf.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchRouteFilter struct. +func (prf *PatchRouteFilter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterPropertiesFormat RouteFilterPropertiesFormat + err = json.Unmarshal(*v, &routeFilterPropertiesFormat) + if err != nil { + return err + } + prf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + prf.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + prf.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + prf.Type = &typeVar + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + prf.Tags = tags + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + prf.ID = &ID + } + } + } + + return nil +} + +// PatchRouteFilterRule route Filter Rule Resource. +type PatchRouteFilterRule struct { + // RouteFilterRulePropertiesFormat - Properties of the route filter rule. + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchRouteFilterRule. +func (prfr PatchRouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if prfr.RouteFilterRulePropertiesFormat != nil { + objectMap["properties"] = prfr.RouteFilterRulePropertiesFormat + } + if prfr.ID != nil { + objectMap["id"] = prfr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchRouteFilterRule struct. +func (prfr *PatchRouteFilterRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat + err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) + if err != nil { + return err + } + prfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + prfr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + prfr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + prfr.ID = &ID + } + } + } + + return nil +} + +// PeerExpressRouteCircuitConnection peer Express Route Circuit Connection in an ExpressRouteCircuitPeering +// resource. +type PeerExpressRouteCircuitConnection struct { + autorest.Response `json:"-"` + // PeerExpressRouteCircuitConnectionPropertiesFormat - Properties of the peer express route circuit connection. + *PeerExpressRouteCircuitConnectionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnection. +func (percc PeerExpressRouteCircuitConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if percc.PeerExpressRouteCircuitConnectionPropertiesFormat != nil { + objectMap["properties"] = percc.PeerExpressRouteCircuitConnectionPropertiesFormat + } + if percc.Name != nil { + objectMap["name"] = percc.Name + } + if percc.ID != nil { + objectMap["id"] = percc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PeerExpressRouteCircuitConnection struct. +func (percc *PeerExpressRouteCircuitConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var peerExpressRouteCircuitConnectionPropertiesFormat PeerExpressRouteCircuitConnectionPropertiesFormat + err = json.Unmarshal(*v, &peerExpressRouteCircuitConnectionPropertiesFormat) + if err != nil { + return err + } + percc.PeerExpressRouteCircuitConnectionPropertiesFormat = &peerExpressRouteCircuitConnectionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + percc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + percc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + percc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + percc.ID = &ID + } + } + } + + return nil +} + +// PeerExpressRouteCircuitConnectionListResult response for ListPeeredConnections API service call +// retrieves all global reach peer circuit connections that belongs to a Private Peering for an +// ExpressRouteCircuit. +type PeerExpressRouteCircuitConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The global reach peer circuit connection associated with Private Peering in an ExpressRoute Circuit. + Value *[]PeerExpressRouteCircuitConnection `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PeerExpressRouteCircuitConnectionListResultIterator provides access to a complete listing of +// PeerExpressRouteCircuitConnection values. +type PeerExpressRouteCircuitConnectionListResultIterator struct { + i int + page PeerExpressRouteCircuitConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PeerExpressRouteCircuitConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PeerExpressRouteCircuitConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) Response() PeerExpressRouteCircuitConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PeerExpressRouteCircuitConnectionListResultIterator) Value() PeerExpressRouteCircuitConnection { + if !iter.page.NotDone() { + return PeerExpressRouteCircuitConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultIterator type. +func NewPeerExpressRouteCircuitConnectionListResultIterator(page PeerExpressRouteCircuitConnectionListResultPage) PeerExpressRouteCircuitConnectionListResultIterator { + return PeerExpressRouteCircuitConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (percclr PeerExpressRouteCircuitConnectionListResult) IsEmpty() bool { + return percclr.Value == nil || len(*percclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (percclr PeerExpressRouteCircuitConnectionListResult) hasNextLink() bool { + return percclr.NextLink != nil && len(*percclr.NextLink) != 0 +} + +// peerExpressRouteCircuitConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (percclr PeerExpressRouteCircuitConnectionListResult) peerExpressRouteCircuitConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !percclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(percclr.NextLink))) +} + +// PeerExpressRouteCircuitConnectionListResultPage contains a page of PeerExpressRouteCircuitConnection +// values. +type PeerExpressRouteCircuitConnectionListResultPage struct { + fn func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error) + percclr PeerExpressRouteCircuitConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PeerExpressRouteCircuitConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.percclr) + if err != nil { + return err + } + page.percclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PeerExpressRouteCircuitConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PeerExpressRouteCircuitConnectionListResultPage) NotDone() bool { + return !page.percclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PeerExpressRouteCircuitConnectionListResultPage) Response() PeerExpressRouteCircuitConnectionListResult { + return page.percclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PeerExpressRouteCircuitConnectionListResultPage) Values() []PeerExpressRouteCircuitConnection { + if page.percclr.IsEmpty() { + return nil + } + return *page.percclr.Value +} + +// Creates a new instance of the PeerExpressRouteCircuitConnectionListResultPage type. +func NewPeerExpressRouteCircuitConnectionListResultPage(cur PeerExpressRouteCircuitConnectionListResult, getNextPage func(context.Context, PeerExpressRouteCircuitConnectionListResult) (PeerExpressRouteCircuitConnectionListResult, error)) PeerExpressRouteCircuitConnectionListResultPage { + return PeerExpressRouteCircuitConnectionListResultPage{ + fn: getNextPage, + percclr: cur, + } +} + +// PeerExpressRouteCircuitConnectionPropertiesFormat properties of the peer express route circuit +// connection. +type PeerExpressRouteCircuitConnectionPropertiesFormat struct { + // ExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the circuit. + ExpressRouteCircuitPeering *SubResource `json:"expressRouteCircuitPeering,omitempty"` + // PeerExpressRouteCircuitPeering - Reference to Express Route Circuit Private Peering Resource of the peered circuit. + PeerExpressRouteCircuitPeering *SubResource `json:"peerExpressRouteCircuitPeering,omitempty"` + // AddressPrefix - /29 IP address space to carve out Customer addresses for tunnels. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // CircuitConnectionStatus - Express Route Circuit connection state. Possible values include: 'CircuitConnectionStatusConnected', 'CircuitConnectionStatusConnecting', 'CircuitConnectionStatusDisconnected' + CircuitConnectionStatus CircuitConnectionStatus `json:"circuitConnectionStatus,omitempty"` + // ConnectionName - The name of the express route circuit connection resource. + ConnectionName *string `json:"connectionName,omitempty"` + // AuthResourceGUID - The resource guid of the authorization used for the express route circuit connection. + AuthResourceGUID *string `json:"authResourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the peer express route circuit connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerExpressRouteCircuitConnectionPropertiesFormat. +func (perccpf PeerExpressRouteCircuitConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if perccpf.ExpressRouteCircuitPeering != nil { + objectMap["expressRouteCircuitPeering"] = perccpf.ExpressRouteCircuitPeering + } + if perccpf.PeerExpressRouteCircuitPeering != nil { + objectMap["peerExpressRouteCircuitPeering"] = perccpf.PeerExpressRouteCircuitPeering + } + if perccpf.AddressPrefix != nil { + objectMap["addressPrefix"] = perccpf.AddressPrefix + } + if perccpf.CircuitConnectionStatus != "" { + objectMap["circuitConnectionStatus"] = perccpf.CircuitConnectionStatus + } + if perccpf.ConnectionName != nil { + objectMap["connectionName"] = perccpf.ConnectionName + } + if perccpf.AuthResourceGUID != nil { + objectMap["authResourceGuid"] = perccpf.AuthResourceGUID + } + return json.Marshal(objectMap) +} + +// PeerRoute peer routing details. +type PeerRoute struct { + // LocalAddress - READ-ONLY; The peer's local address. + LocalAddress *string `json:"localAddress,omitempty"` + // NetworkProperty - READ-ONLY; The route's network prefix. + NetworkProperty *string `json:"network,omitempty"` + // NextHop - READ-ONLY; The route's next hop. + NextHop *string `json:"nextHop,omitempty"` + // SourcePeer - READ-ONLY; The peer this route was learned from. + SourcePeer *string `json:"sourcePeer,omitempty"` + // Origin - READ-ONLY; The source this route was learned from. + Origin *string `json:"origin,omitempty"` + // AsPath - READ-ONLY; The route's AS path sequence. + AsPath *string `json:"asPath,omitempty"` + // Weight - READ-ONLY; The route's weight. + Weight *int32 `json:"weight,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeerRoute. +func (pr PeerRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PeerRouteList list of virtual router peer routes. +type PeerRouteList struct { + autorest.Response `json:"-"` + // Value - List of peer routes. + Value *[]PeerRoute `json:"value,omitempty"` +} + +// PolicySettings defines contents of a web application firewall global configuration. +type PolicySettings struct { + // State - The state of the policy. Possible values include: 'WebApplicationFirewallEnabledStateDisabled', 'WebApplicationFirewallEnabledStateEnabled' + State WebApplicationFirewallEnabledState `json:"state,omitempty"` + // Mode - The mode of the policy. Possible values include: 'WebApplicationFirewallModePrevention', 'WebApplicationFirewallModeDetection' + Mode WebApplicationFirewallMode `json:"mode,omitempty"` + // RequestBodyCheck - Whether to allow WAF to check request Body. + RequestBodyCheck *bool `json:"requestBodyCheck,omitempty"` + // MaxRequestBodySizeInKb - Maximum request body size in Kb for WAF. + MaxRequestBodySizeInKb *int32 `json:"maxRequestBodySizeInKb,omitempty"` + // FileUploadLimitInMb - Maximum file upload size in Mb for WAF. + FileUploadLimitInMb *int32 `json:"fileUploadLimitInMb,omitempty"` +} + +// PrepareNetworkPoliciesRequest details of PrepareNetworkPolicies for Subnet. +type PrepareNetworkPoliciesRequest struct { + // ServiceName - The name of the service for which subnet is being prepared for. + ServiceName *string `json:"serviceName,omitempty"` + // NetworkIntentPolicyConfigurations - A list of NetworkIntentPolicyConfiguration. + NetworkIntentPolicyConfigurations *[]IntentPolicyConfiguration `json:"networkIntentPolicyConfigurations,omitempty"` +} + +// PrivateDNSZoneConfig privateDnsZoneConfig resource. +type PrivateDNSZoneConfig struct { + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // PrivateDNSZonePropertiesFormat - Properties of the private dns zone configuration. + *PrivateDNSZonePropertiesFormat `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneConfig. +func (pdzc PrivateDNSZoneConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzc.Name != nil { + objectMap["name"] = pdzc.Name + } + if pdzc.PrivateDNSZonePropertiesFormat != nil { + objectMap["properties"] = pdzc.PrivateDNSZonePropertiesFormat + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneConfig struct. +func (pdzc *PrivateDNSZoneConfig) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pdzc.Name = &name + } + case "properties": + if v != nil { + var privateDNSZonePropertiesFormat PrivateDNSZonePropertiesFormat + err = json.Unmarshal(*v, &privateDNSZonePropertiesFormat) + if err != nil { + return err + } + pdzc.PrivateDNSZonePropertiesFormat = &privateDNSZonePropertiesFormat + } + } + } + + return nil +} + +// PrivateDNSZoneGroup private dns zone group resource. +type PrivateDNSZoneGroup struct { + autorest.Response `json:"-"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // PrivateDNSZoneGroupPropertiesFormat - Properties of the private dns zone group. + *PrivateDNSZoneGroupPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroup. +func (pdzg PrivateDNSZoneGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzg.Name != nil { + objectMap["name"] = pdzg.Name + } + if pdzg.PrivateDNSZoneGroupPropertiesFormat != nil { + objectMap["properties"] = pdzg.PrivateDNSZoneGroupPropertiesFormat + } + if pdzg.ID != nil { + objectMap["id"] = pdzg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateDNSZoneGroup struct. +func (pdzg *PrivateDNSZoneGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pdzg.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pdzg.Etag = &etag + } + case "properties": + if v != nil { + var privateDNSZoneGroupPropertiesFormat PrivateDNSZoneGroupPropertiesFormat + err = json.Unmarshal(*v, &privateDNSZoneGroupPropertiesFormat) + if err != nil { + return err + } + pdzg.PrivateDNSZoneGroupPropertiesFormat = &privateDNSZoneGroupPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pdzg.ID = &ID + } + } + } + + return nil +} + +// PrivateDNSZoneGroupListResult response for the ListPrivateDnsZoneGroups API service call. +type PrivateDNSZoneGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of private dns zone group resources in a private endpoint. + Value *[]PrivateDNSZoneGroup `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupListResult. +func (pdzglr PrivateDNSZoneGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzglr.Value != nil { + objectMap["value"] = pdzglr.Value + } + return json.Marshal(objectMap) +} + +// PrivateDNSZoneGroupListResultIterator provides access to a complete listing of PrivateDNSZoneGroup +// values. +type PrivateDNSZoneGroupListResultIterator struct { + i int + page PrivateDNSZoneGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateDNSZoneGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateDNSZoneGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateDNSZoneGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateDNSZoneGroupListResultIterator) Response() PrivateDNSZoneGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateDNSZoneGroupListResultIterator) Value() PrivateDNSZoneGroup { + if !iter.page.NotDone() { + return PrivateDNSZoneGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateDNSZoneGroupListResultIterator type. +func NewPrivateDNSZoneGroupListResultIterator(page PrivateDNSZoneGroupListResultPage) PrivateDNSZoneGroupListResultIterator { + return PrivateDNSZoneGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pdzglr PrivateDNSZoneGroupListResult) IsEmpty() bool { + return pdzglr.Value == nil || len(*pdzglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pdzglr PrivateDNSZoneGroupListResult) hasNextLink() bool { + return pdzglr.NextLink != nil && len(*pdzglr.NextLink) != 0 +} + +// privateDNSZoneGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pdzglr PrivateDNSZoneGroupListResult) privateDNSZoneGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pdzglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pdzglr.NextLink))) +} + +// PrivateDNSZoneGroupListResultPage contains a page of PrivateDNSZoneGroup values. +type PrivateDNSZoneGroupListResultPage struct { + fn func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error) + pdzglr PrivateDNSZoneGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateDNSZoneGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pdzglr) + if err != nil { + return err + } + page.pdzglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateDNSZoneGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateDNSZoneGroupListResultPage) NotDone() bool { + return !page.pdzglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateDNSZoneGroupListResultPage) Response() PrivateDNSZoneGroupListResult { + return page.pdzglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateDNSZoneGroupListResultPage) Values() []PrivateDNSZoneGroup { + if page.pdzglr.IsEmpty() { + return nil + } + return *page.pdzglr.Value +} + +// Creates a new instance of the PrivateDNSZoneGroupListResultPage type. +func NewPrivateDNSZoneGroupListResultPage(cur PrivateDNSZoneGroupListResult, getNextPage func(context.Context, PrivateDNSZoneGroupListResult) (PrivateDNSZoneGroupListResult, error)) PrivateDNSZoneGroupListResultPage { + return PrivateDNSZoneGroupListResultPage{ + fn: getNextPage, + pdzglr: cur, + } +} + +// PrivateDNSZoneGroupPropertiesFormat properties of the private dns zone group. +type PrivateDNSZoneGroupPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the private dns zone group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateDNSZoneConfigs - A collection of private dns zone configurations of the private dns zone group. + PrivateDNSZoneConfigs *[]PrivateDNSZoneConfig `json:"privateDnsZoneConfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZoneGroupPropertiesFormat. +func (pdzgpf PrivateDNSZoneGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzgpf.PrivateDNSZoneConfigs != nil { + objectMap["privateDnsZoneConfigs"] = pdzgpf.PrivateDNSZoneConfigs + } + return json.Marshal(objectMap) +} + +// PrivateDNSZoneGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateDNSZoneGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateDNSZoneGroupsClient) (PrivateDNSZoneGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateDNSZoneGroupsCreateOrUpdateFuture.Result. +func (future *PrivateDNSZoneGroupsCreateOrUpdateFuture) result(client PrivateDNSZoneGroupsClient) (pdzg PrivateDNSZoneGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pdzg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pdzg.Response.Response, err = future.GetResult(sender); err == nil && pdzg.Response.Response.StatusCode != http.StatusNoContent { + pdzg, err = client.CreateOrUpdateResponder(pdzg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsCreateOrUpdateFuture", "Result", pdzg.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateDNSZoneGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateDNSZoneGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateDNSZoneGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateDNSZoneGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateDNSZoneGroupsDeleteFuture.Result. +func (future *PrivateDNSZoneGroupsDeleteFuture) result(client PrivateDNSZoneGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateDNSZoneGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateDNSZonePropertiesFormat properties of the private dns zone configuration resource. +type PrivateDNSZonePropertiesFormat struct { + // PrivateDNSZoneID - The resource id of the private dns zone. + PrivateDNSZoneID *string `json:"privateDnsZoneId,omitempty"` + // RecordSets - READ-ONLY; A collection of information regarding a recordSet, holding information to identify private resources. + RecordSets *[]RecordSet `json:"recordSets,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateDNSZonePropertiesFormat. +func (pdzpf PrivateDNSZonePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdzpf.PrivateDNSZoneID != nil { + objectMap["privateDnsZoneId"] = pdzpf.PrivateDNSZoneID + } + return json.Marshal(objectMap) +} + +// PrivateEndpoint private endpoint resource. +type PrivateEndpoint struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // PrivateEndpointProperties - Properties of the private endpoint. + *PrivateEndpointProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.ExtendedLocation != nil { + objectMap["extendedLocation"] = peVar.ExtendedLocation + } + if peVar.PrivateEndpointProperties != nil { + objectMap["properties"] = peVar.PrivateEndpointProperties + } + if peVar.ID != nil { + objectMap["id"] = peVar.ID + } + if peVar.Location != nil { + objectMap["location"] = peVar.Location + } + if peVar.Tags != nil { + objectMap["tags"] = peVar.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpoint struct. +func (peVar *PrivateEndpoint) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + peVar.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var privateEndpointProperties PrivateEndpointProperties + err = json.Unmarshal(*v, &privateEndpointProperties) + if err != nil { + return err + } + peVar.PrivateEndpointProperties = &privateEndpointProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peVar.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + peVar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peVar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peVar.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + peVar.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + peVar.Tags = tags + } + } + } + + return nil +} + +// PrivateEndpointConnection privateEndpointConnection resource. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // PrivateEndpointConnectionProperties - Properties of the private end point connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + if pec.Name != nil { + objectMap["name"] = pec.Name + } + if pec.ID != nil { + objectMap["id"] = pec.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pec.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult response for the ListPrivateEndpointConnection API service call. +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of PrivateEndpointConnection resources for a specific private link service. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionListResult. +func (peclr PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peclr.Value != nil { + objectMap["value"] = peclr.Value + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionListResultIterator provides access to a complete listing of +// PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultIterator struct { + i int + page PrivateEndpointConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointConnectionListResultIterator) Response() PrivateEndpointConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointConnectionListResultIterator) Value() PrivateEndpointConnection { + if !iter.page.NotDone() { + return PrivateEndpointConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointConnectionListResultIterator type. +func NewPrivateEndpointConnectionListResultIterator(page PrivateEndpointConnectionListResultPage) PrivateEndpointConnectionListResultIterator { + return PrivateEndpointConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (peclr PrivateEndpointConnectionListResult) IsEmpty() bool { + return peclr.Value == nil || len(*peclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (peclr PrivateEndpointConnectionListResult) hasNextLink() bool { + return peclr.NextLink != nil && len(*peclr.NextLink) != 0 +} + +// privateEndpointConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (peclr PrivateEndpointConnectionListResult) privateEndpointConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !peclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(peclr.NextLink))) +} + +// PrivateEndpointConnectionListResultPage contains a page of PrivateEndpointConnection values. +type PrivateEndpointConnectionListResultPage struct { + fn func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error) + peclr PrivateEndpointConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.peclr) + if err != nil { + return err + } + page.peclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointConnectionListResultPage) NotDone() bool { + return !page.peclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointConnectionListResultPage) Response() PrivateEndpointConnectionListResult { + return page.peclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointConnectionListResultPage) Values() []PrivateEndpointConnection { + if page.peclr.IsEmpty() { + return nil + } + return *page.peclr.Value +} + +// Creates a new instance of the PrivateEndpointConnectionListResultPage type. +func NewPrivateEndpointConnectionListResultPage(cur PrivateEndpointConnectionListResult, getNextPage func(context.Context, PrivateEndpointConnectionListResult) (PrivateEndpointConnectionListResult, error)) PrivateEndpointConnectionListResultPage { + return PrivateEndpointConnectionListResultPage{ + fn: getNextPage, + peclr: cur, + } +} + +// PrivateEndpointConnectionProperties properties of the PrivateEndpointConnectProperties. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - READ-ONLY; The resource of private end point. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // LinkIdentifier - READ-ONLY; The consumer link id. + LinkIdentifier *string `json:"linkIdentifier,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointIPConfiguration an IP Configuration of the private endpoint. +type PrivateEndpointIPConfiguration struct { + // PrivateEndpointIPConfigurationProperties - Properties of private endpoint IP configurations. + *PrivateEndpointIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointIPConfiguration. +func (peic PrivateEndpointIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peic.PrivateEndpointIPConfigurationProperties != nil { + objectMap["properties"] = peic.PrivateEndpointIPConfigurationProperties + } + if peic.Name != nil { + objectMap["name"] = peic.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointIPConfiguration struct. +func (peic *PrivateEndpointIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateEndpointIPConfigurationProperties PrivateEndpointIPConfigurationProperties + err = json.Unmarshal(*v, &privateEndpointIPConfigurationProperties) + if err != nil { + return err + } + peic.PrivateEndpointIPConfigurationProperties = &privateEndpointIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + peic.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + peic.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + peic.Etag = &etag + } + } + } + + return nil +} + +// PrivateEndpointIPConfigurationProperties properties of an IP Configuration of the private endpoint. +type PrivateEndpointIPConfigurationProperties struct { + // GroupID - The ID of a group obtained from the remote resource that this private endpoint should connect to. + GroupID *string `json:"groupId,omitempty"` + // MemberName - The member name of a group obtained from the remote resource that this private endpoint should connect to. + MemberName *string `json:"memberName,omitempty"` + // PrivateIPAddress - A private ip address obtained from the private endpoint's subnet. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` +} + +// PrivateEndpointListResult response for the ListPrivateEndpoints API service call. +type PrivateEndpointListResult struct { + autorest.Response `json:"-"` + // Value - A list of private endpoint resources in a resource group. + Value *[]PrivateEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointListResult. +func (pelr PrivateEndpointListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pelr.Value != nil { + objectMap["value"] = pelr.Value + } + return json.Marshal(objectMap) +} + +// PrivateEndpointListResultIterator provides access to a complete listing of PrivateEndpoint values. +type PrivateEndpointListResultIterator struct { + i int + page PrivateEndpointListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateEndpointListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateEndpointListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateEndpointListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateEndpointListResultIterator) Response() PrivateEndpointListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateEndpointListResultIterator) Value() PrivateEndpoint { + if !iter.page.NotDone() { + return PrivateEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateEndpointListResultIterator type. +func NewPrivateEndpointListResultIterator(page PrivateEndpointListResultPage) PrivateEndpointListResultIterator { + return PrivateEndpointListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pelr PrivateEndpointListResult) IsEmpty() bool { + return pelr.Value == nil || len(*pelr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pelr PrivateEndpointListResult) hasNextLink() bool { + return pelr.NextLink != nil && len(*pelr.NextLink) != 0 +} + +// privateEndpointListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pelr PrivateEndpointListResult) privateEndpointListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pelr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pelr.NextLink))) +} + +// PrivateEndpointListResultPage contains a page of PrivateEndpoint values. +type PrivateEndpointListResultPage struct { + fn func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error) + pelr PrivateEndpointListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateEndpointListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pelr) + if err != nil { + return err + } + page.pelr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateEndpointListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateEndpointListResultPage) NotDone() bool { + return !page.pelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateEndpointListResultPage) Response() PrivateEndpointListResult { + return page.pelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateEndpointListResultPage) Values() []PrivateEndpoint { + if page.pelr.IsEmpty() { + return nil + } + return *page.pelr.Value +} + +// Creates a new instance of the PrivateEndpointListResultPage type. +func NewPrivateEndpointListResultPage(cur PrivateEndpointListResult, getNextPage func(context.Context, PrivateEndpointListResult) (PrivateEndpointListResult, error)) PrivateEndpointListResultPage { + return PrivateEndpointListResultPage{ + fn: getNextPage, + pelr: cur, + } +} + +// PrivateEndpointProperties properties of the private endpoint. +type PrivateEndpointProperties struct { + // Subnet - The ID of the subnet from which the private IP will be allocated. + Subnet *Subnet `json:"subnet,omitempty"` + // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private endpoint. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkServiceConnections - A grouping of information about the connection to the remote resource. + PrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"privateLinkServiceConnections,omitempty"` + // ManualPrivateLinkServiceConnections - A grouping of information about the connection to the remote resource. Used when the network admin does not have access to approve connections to the remote resource. + ManualPrivateLinkServiceConnections *[]PrivateLinkServiceConnection `json:"manualPrivateLinkServiceConnections,omitempty"` + // CustomDNSConfigs - An array of custom dns configurations. + CustomDNSConfigs *[]CustomDNSConfigPropertiesFormat `json:"customDnsConfigs,omitempty"` + // ApplicationSecurityGroups - Application security groups in which the private endpoint IP configuration is included. + ApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"applicationSecurityGroups,omitempty"` + // IPConfigurations - A list of IP configurations of the private endpoint. This will be used to map to the First Party Service's endpoints. + IPConfigurations *[]PrivateEndpointIPConfiguration `json:"ipConfigurations,omitempty"` + // CustomNetworkInterfaceName - The custom name of the network interface attached to the private endpoint. + CustomNetworkInterfaceName *string `json:"customNetworkInterfaceName,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointProperties. +func (pep PrivateEndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pep.Subnet != nil { + objectMap["subnet"] = pep.Subnet + } + if pep.PrivateLinkServiceConnections != nil { + objectMap["privateLinkServiceConnections"] = pep.PrivateLinkServiceConnections + } + if pep.ManualPrivateLinkServiceConnections != nil { + objectMap["manualPrivateLinkServiceConnections"] = pep.ManualPrivateLinkServiceConnections + } + if pep.CustomDNSConfigs != nil { + objectMap["customDnsConfigs"] = pep.CustomDNSConfigs + } + if pep.ApplicationSecurityGroups != nil { + objectMap["applicationSecurityGroups"] = pep.ApplicationSecurityGroups + } + if pep.IPConfigurations != nil { + objectMap["ipConfigurations"] = pep.IPConfigurations + } + if pep.CustomNetworkInterfaceName != nil { + objectMap["customNetworkInterfaceName"] = pep.CustomNetworkInterfaceName + } + return json.Marshal(objectMap) +} + +// PrivateEndpointsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointsClient) (PrivateEndpoint, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointsCreateOrUpdateFuture) result(client PrivateEndpointsClient) (peVar PrivateEndpoint, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + peVar.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if peVar.Response.Response, err = future.GetResult(sender); err == nil && peVar.Response.Response.StatusCode != http.StatusNoContent { + peVar, err = client.CreateOrUpdateResponder(peVar.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsCreateOrUpdateFuture", "Result", peVar.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PrivateEndpointsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointsDeleteFuture.Result. +func (future *PrivateEndpointsDeleteFuture) result(client PrivateEndpointsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateEndpointsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkService private link service resource. +type PrivateLinkService struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the load balancer. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // PrivateLinkServiceProperties - Properties of the private link service. + *PrivateLinkServiceProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkService. +func (pls PrivateLinkService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pls.ExtendedLocation != nil { + objectMap["extendedLocation"] = pls.ExtendedLocation + } + if pls.PrivateLinkServiceProperties != nil { + objectMap["properties"] = pls.PrivateLinkServiceProperties + } + if pls.ID != nil { + objectMap["id"] = pls.ID + } + if pls.Location != nil { + objectMap["location"] = pls.Location + } + if pls.Tags != nil { + objectMap["tags"] = pls.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkService struct. +func (pls *PrivateLinkService) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pls.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var privateLinkServiceProperties PrivateLinkServiceProperties + err = json.Unmarshal(*v, &privateLinkServiceProperties) + if err != nil { + return err + } + pls.PrivateLinkServiceProperties = &privateLinkServiceProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pls.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pls.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pls.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pls.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pls.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pls.Tags = tags + } + } + } + + return nil +} + +// PrivateLinkServiceConnection privateLinkServiceConnection resource. +type PrivateLinkServiceConnection struct { + // PrivateLinkServiceConnectionProperties - Properties of the private link service connection. + *PrivateLinkServiceConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnection. +func (plsc PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsc.PrivateLinkServiceConnectionProperties != nil { + objectMap["properties"] = plsc.PrivateLinkServiceConnectionProperties + } + if plsc.Name != nil { + objectMap["name"] = plsc.Name + } + if plsc.ID != nil { + objectMap["id"] = plsc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceConnection struct. +func (plsc *PrivateLinkServiceConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkServiceConnectionProperties PrivateLinkServiceConnectionProperties + err = json.Unmarshal(*v, &privateLinkServiceConnectionProperties) + if err != nil { + return err + } + plsc.PrivateLinkServiceConnectionProperties = &privateLinkServiceConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plsc.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plsc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plsc.ID = &ID + } + } + } + + return nil +} + +// PrivateLinkServiceConnectionProperties properties of the PrivateLinkServiceConnection. +type PrivateLinkServiceConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the private link service connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateLinkServiceID - The resource id of private link service. + PrivateLinkServiceID *string `json:"privateLinkServiceId,omitempty"` + // GroupIds - The ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to. + GroupIds *[]string `json:"groupIds,omitempty"` + // RequestMessage - A message passed to the owner of the remote resource with this connection request. Restricted to 140 chars. + RequestMessage *string `json:"requestMessage,omitempty"` + // PrivateLinkServiceConnectionState - A collection of read-only information about the state of the connection to the remote resource. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionProperties. +func (plscp PrivateLinkServiceConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscp.PrivateLinkServiceID != nil { + objectMap["privateLinkServiceId"] = plscp.PrivateLinkServiceID + } + if plscp.GroupIds != nil { + objectMap["groupIds"] = plscp.GroupIds + } + if plscp.RequestMessage != nil { + objectMap["requestMessage"] = plscp.RequestMessage + } + if plscp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = plscp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceConnectionState a collection of information about the state of the connection between +// service consumer and provider. +type PrivateLinkServiceConnectionState struct { + // Status - Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *string `json:"status,omitempty"` + // Description - The reason for approval/rejection of the connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// PrivateLinkServiceIPConfiguration the private link service ip configuration. +type PrivateLinkServiceIPConfiguration struct { + // PrivateLinkServiceIPConfigurationProperties - Properties of the private link service ip configuration. + *PrivateLinkServiceIPConfigurationProperties `json:"properties,omitempty"` + // Name - The name of private link service ip configuration. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfiguration. +func (plsic PrivateLinkServiceIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsic.PrivateLinkServiceIPConfigurationProperties != nil { + objectMap["properties"] = plsic.PrivateLinkServiceIPConfigurationProperties + } + if plsic.Name != nil { + objectMap["name"] = plsic.Name + } + if plsic.ID != nil { + objectMap["id"] = plsic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateLinkServiceIPConfiguration struct. +func (plsic *PrivateLinkServiceIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var privateLinkServiceIPConfigurationProperties PrivateLinkServiceIPConfigurationProperties + err = json.Unmarshal(*v, &privateLinkServiceIPConfigurationProperties) + if err != nil { + return err + } + plsic.PrivateLinkServiceIPConfigurationProperties = &privateLinkServiceIPConfigurationProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + plsic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + plsic.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + plsic.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + plsic.ID = &ID + } + } + } + + return nil +} + +// PrivateLinkServiceIPConfigurationProperties properties of private link service IP configuration. +type PrivateLinkServiceIPConfigurationProperties struct { + // PrivateIPAddress - The private IP address of the IP configuration. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *Subnet `json:"subnet,omitempty"` + // Primary - Whether the ip configuration is primary or not. + Primary *bool `json:"primary,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private link service IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateIPAddressVersion - Whether the specific IP configuration is IPv4 or IPv6. Default is IPv4. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PrivateIPAddressVersion IPVersion `json:"privateIPAddressVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceIPConfigurationProperties. +func (plsicp PrivateLinkServiceIPConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsicp.PrivateIPAddress != nil { + objectMap["privateIPAddress"] = plsicp.PrivateIPAddress + } + if plsicp.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = plsicp.PrivateIPAllocationMethod + } + if plsicp.Subnet != nil { + objectMap["subnet"] = plsicp.Subnet + } + if plsicp.Primary != nil { + objectMap["primary"] = plsicp.Primary + } + if plsicp.PrivateIPAddressVersion != "" { + objectMap["privateIPAddressVersion"] = plsicp.PrivateIPAddressVersion + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceListResult response for the ListPrivateLinkService API service call. +type PrivateLinkServiceListResult struct { + autorest.Response `json:"-"` + // Value - A list of PrivateLinkService resources in a resource group. + Value *[]PrivateLinkService `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceListResult. +func (plslr PrivateLinkServiceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plslr.Value != nil { + objectMap["value"] = plslr.Value + } + return json.Marshal(objectMap) +} + +// PrivateLinkServiceListResultIterator provides access to a complete listing of PrivateLinkService values. +type PrivateLinkServiceListResultIterator struct { + i int + page PrivateLinkServiceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PrivateLinkServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PrivateLinkServiceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PrivateLinkServiceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PrivateLinkServiceListResultIterator) Response() PrivateLinkServiceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PrivateLinkServiceListResultIterator) Value() PrivateLinkService { + if !iter.page.NotDone() { + return PrivateLinkService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PrivateLinkServiceListResultIterator type. +func NewPrivateLinkServiceListResultIterator(page PrivateLinkServiceListResultPage) PrivateLinkServiceListResultIterator { + return PrivateLinkServiceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plslr PrivateLinkServiceListResult) IsEmpty() bool { + return plslr.Value == nil || len(*plslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plslr PrivateLinkServiceListResult) hasNextLink() bool { + return plslr.NextLink != nil && len(*plslr.NextLink) != 0 +} + +// privateLinkServiceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plslr PrivateLinkServiceListResult) privateLinkServiceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plslr.NextLink))) +} + +// PrivateLinkServiceListResultPage contains a page of PrivateLinkService values. +type PrivateLinkServiceListResultPage struct { + fn func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error) + plslr PrivateLinkServiceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PrivateLinkServiceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServiceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plslr) + if err != nil { + return err + } + page.plslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PrivateLinkServiceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PrivateLinkServiceListResultPage) NotDone() bool { + return !page.plslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PrivateLinkServiceListResultPage) Response() PrivateLinkServiceListResult { + return page.plslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PrivateLinkServiceListResultPage) Values() []PrivateLinkService { + if page.plslr.IsEmpty() { + return nil + } + return *page.plslr.Value +} + +// Creates a new instance of the PrivateLinkServiceListResultPage type. +func NewPrivateLinkServiceListResultPage(cur PrivateLinkServiceListResult, getNextPage func(context.Context, PrivateLinkServiceListResult) (PrivateLinkServiceListResult, error)) PrivateLinkServiceListResultPage { + return PrivateLinkServiceListResultPage{ + fn: getNextPage, + plslr: cur, + } +} + +// PrivateLinkServiceProperties properties of the private link service. +type PrivateLinkServiceProperties struct { + // LoadBalancerFrontendIPConfigurations - An array of references to the load balancer IP configurations. + LoadBalancerFrontendIPConfigurations *[]FrontendIPConfiguration `json:"loadBalancerFrontendIpConfigurations,omitempty"` + // IPConfigurations - An array of private link service IP configurations. + IPConfigurations *[]PrivateLinkServiceIPConfiguration `json:"ipConfigurations,omitempty"` + // NetworkInterfaces - READ-ONLY; An array of references to the network interfaces created for this private link service. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the private link service resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpointConnections - READ-ONLY; An array of list about connections to the private endpoint. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // Visibility - The visibility list of the private link service. + Visibility *PrivateLinkServicePropertiesVisibility `json:"visibility,omitempty"` + // AutoApproval - The auto-approval list of the private link service. + AutoApproval *PrivateLinkServicePropertiesAutoApproval `json:"autoApproval,omitempty"` + // Fqdns - The list of Fqdn. + Fqdns *[]string `json:"fqdns,omitempty"` + // Alias - READ-ONLY; The alias of the private link service. + Alias *string `json:"alias,omitempty"` + // EnableProxyProtocol - Whether the private link service is enabled for proxy protocol or not. + EnableProxyProtocol *bool `json:"enableProxyProtocol,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceProperties. +func (plsp PrivateLinkServiceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plsp.LoadBalancerFrontendIPConfigurations != nil { + objectMap["loadBalancerFrontendIpConfigurations"] = plsp.LoadBalancerFrontendIPConfigurations + } + if plsp.IPConfigurations != nil { + objectMap["ipConfigurations"] = plsp.IPConfigurations + } + if plsp.Visibility != nil { + objectMap["visibility"] = plsp.Visibility + } + if plsp.AutoApproval != nil { + objectMap["autoApproval"] = plsp.AutoApproval + } + if plsp.Fqdns != nil { + objectMap["fqdns"] = plsp.Fqdns + } + if plsp.EnableProxyProtocol != nil { + objectMap["enableProxyProtocol"] = plsp.EnableProxyProtocol + } + return json.Marshal(objectMap) +} + +// PrivateLinkServicePropertiesAutoApproval the auto-approval list of the private link service. +type PrivateLinkServicePropertiesAutoApproval struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServicePropertiesVisibility the visibility list of the private link service. +type PrivateLinkServicePropertiesVisibility struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture an abstraction for monitoring +// and retrieving the results of a long-running operation. +type PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture.Result. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + plsv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { + plsv, err = client.CheckPrivateLinkServiceVisibilityByResourceGroupResponder(plsv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture", "Result", plsv.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkServiceVisibility, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture.Result. +func (future *PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture) result(client PrivateLinkServicesClient) (plsv PrivateLinkServiceVisibility, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + plsv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if plsv.Response.Response, err = future.GetResult(sender); err == nil && plsv.Response.Response.StatusCode != http.StatusNoContent { + plsv, err = client.CheckPrivateLinkServiceVisibilityResponder(plsv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture", "Result", plsv.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkServicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (PrivateLinkService, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesCreateOrUpdateFuture.Result. +func (future *PrivateLinkServicesCreateOrUpdateFuture) result(client PrivateLinkServicesClient) (pls PrivateLinkService, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pls.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pls.Response.Response, err = future.GetResult(sender); err == nil && pls.Response.Response.StatusCode != http.StatusNoContent { + pls, err = client.CreateOrUpdateResponder(pls.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesCreateOrUpdateFuture", "Result", pls.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateLinkServicesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateLinkServicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesDeleteFuture.Result. +func (future *PrivateLinkServicesDeleteFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkServicesDeletePrivateEndpointConnectionFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type PrivateLinkServicesDeletePrivateEndpointConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateLinkServicesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateLinkServicesDeletePrivateEndpointConnectionFuture.Result. +func (future *PrivateLinkServicesDeletePrivateEndpointConnectionFuture) result(client PrivateLinkServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkServiceVisibility response for the CheckPrivateLinkServiceVisibility API service call. +type PrivateLinkServiceVisibility struct { + autorest.Response `json:"-"` + // Visible - Private Link Service Visibility (True/False). + Visible *bool `json:"visible,omitempty"` +} + +// Probe a load balancer probe. +type Probe struct { + autorest.Response `json:"-"` + // ProbePropertiesFormat - Properties of load balancer probe. + *ProbePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Probe. +func (p Probe) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProbePropertiesFormat != nil { + objectMap["properties"] = p.ProbePropertiesFormat + } + if p.Name != nil { + objectMap["name"] = p.Name + } + if p.ID != nil { + objectMap["id"] = p.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Probe struct. +func (p *Probe) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var probePropertiesFormat ProbePropertiesFormat + err = json.Unmarshal(*v, &probePropertiesFormat) + if err != nil { + return err + } + p.ProbePropertiesFormat = &probePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + } + } + + return nil +} + +// ProbePropertiesFormat load balancer probe resource. +type ProbePropertiesFormat struct { + // LoadBalancingRules - READ-ONLY; The load balancer rules that use this probe. + LoadBalancingRules *[]SubResource `json:"loadBalancingRules,omitempty"` + // Protocol - The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful. Possible values include: 'ProbeProtocolHTTP', 'ProbeProtocolTCP', 'ProbeProtocolHTTPS' + Protocol ProbeProtocol `json:"protocol,omitempty"` + // Port - The port for communicating the probe. Possible values range from 1 to 65535, inclusive. + Port *int32 `json:"port,omitempty"` + // IntervalInSeconds - The interval, in seconds, for how frequently to probe the endpoint for health status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5. + IntervalInSeconds *int32 `json:"intervalInSeconds,omitempty"` + // NumberOfProbes - The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure. + NumberOfProbes *int32 `json:"numberOfProbes,omitempty"` + // RequestPath - The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value. + RequestPath *string `json:"requestPath,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the probe resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProbePropertiesFormat. +func (ppf ProbePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppf.Protocol != "" { + objectMap["protocol"] = ppf.Protocol + } + if ppf.Port != nil { + objectMap["port"] = ppf.Port + } + if ppf.IntervalInSeconds != nil { + objectMap["intervalInSeconds"] = ppf.IntervalInSeconds + } + if ppf.NumberOfProbes != nil { + objectMap["numberOfProbes"] = ppf.NumberOfProbes + } + if ppf.RequestPath != nil { + objectMap["requestPath"] = ppf.RequestPath + } + return json.Marshal(objectMap) +} + +// Profile network profile resource. +type Profile struct { + autorest.Response `json:"-"` + // ProfilePropertiesFormat - Network profile properties. + *ProfilePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Profile. +func (p Profile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ProfilePropertiesFormat != nil { + objectMap["properties"] = p.ProfilePropertiesFormat + } + if p.ID != nil { + objectMap["id"] = p.ID + } + if p.Location != nil { + objectMap["location"] = p.Location + } + if p.Tags != nil { + objectMap["tags"] = p.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Profile struct. +func (p *Profile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var profilePropertiesFormat ProfilePropertiesFormat + err = json.Unmarshal(*v, &profilePropertiesFormat) + if err != nil { + return err + } + p.ProfilePropertiesFormat = &profilePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + p.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + p.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + p.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + p.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + p.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + p.Tags = tags + } + } + } + + return nil +} + +// ProfileListResult response for ListNetworkProfiles API service call. +type ProfileListResult struct { + autorest.Response `json:"-"` + // Value - A list of network profiles that exist in a resource group. + Value *[]Profile `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProfileListResultIterator provides access to a complete listing of Profile values. +type ProfileListResultIterator struct { + i int + page ProfileListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProfileListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProfileListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProfileListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProfileListResultIterator) Response() ProfileListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProfileListResultIterator) Value() Profile { + if !iter.page.NotDone() { + return Profile{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProfileListResultIterator type. +func NewProfileListResultIterator(page ProfileListResultPage) ProfileListResultIterator { + return ProfileListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (plr ProfileListResult) IsEmpty() bool { + return plr.Value == nil || len(*plr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (plr ProfileListResult) hasNextLink() bool { + return plr.NextLink != nil && len(*plr.NextLink) != 0 +} + +// profileListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (plr ProfileListResult) profileListResultPreparer(ctx context.Context) (*http.Request, error) { + if !plr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(plr.NextLink))) +} + +// ProfileListResultPage contains a page of Profile values. +type ProfileListResultPage struct { + fn func(context.Context, ProfileListResult) (ProfileListResult, error) + plr ProfileListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProfileListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfileListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.plr) + if err != nil { + return err + } + page.plr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProfileListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProfileListResultPage) NotDone() bool { + return !page.plr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProfileListResultPage) Response() ProfileListResult { + return page.plr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProfileListResultPage) Values() []Profile { + if page.plr.IsEmpty() { + return nil + } + return *page.plr.Value +} + +// Creates a new instance of the ProfileListResultPage type. +func NewProfileListResultPage(cur ProfileListResult, getNextPage func(context.Context, ProfileListResult) (ProfileListResult, error)) ProfileListResultPage { + return ProfileListResultPage{ + fn: getNextPage, + plr: cur, + } +} + +// ProfilePropertiesFormat network profile properties. +type ProfilePropertiesFormat struct { + // ContainerNetworkInterfaces - READ-ONLY; List of child container network interfaces. + ContainerNetworkInterfaces *[]ContainerNetworkInterface `json:"containerNetworkInterfaces,omitempty"` + // ContainerNetworkInterfaceConfigurations - List of chid container network interface configurations. + ContainerNetworkInterfaceConfigurations *[]ContainerNetworkInterfaceConfiguration `json:"containerNetworkInterfaceConfigurations,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network profile resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network profile resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProfilePropertiesFormat. +func (ppf ProfilePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ppf.ContainerNetworkInterfaceConfigurations != nil { + objectMap["containerNetworkInterfaceConfigurations"] = ppf.ContainerNetworkInterfaceConfigurations + } + return json.Marshal(objectMap) +} + +// ProfilesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ProfilesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ProfilesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ProfilesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ProfilesDeleteFuture.Result. +func (future *ProfilesDeleteFuture) result(client ProfilesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ProfilesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PropagatedRouteTable the list of RouteTables to advertise the routes to. +type PropagatedRouteTable struct { + // Labels - The list of labels. + Labels *[]string `json:"labels,omitempty"` + // Ids - The list of resource ids of all the RouteTables. + Ids *[]SubResource `json:"ids,omitempty"` +} + +// ProtocolConfiguration configuration of the protocol. +type ProtocolConfiguration struct { + // HTTPConfiguration - HTTP configuration of the connectivity check. + HTTPConfiguration *HTTPConfiguration `json:"HTTPConfiguration,omitempty"` +} + +// ProtocolCustomSettingsFormat dDoS custom policy properties. +type ProtocolCustomSettingsFormat struct { + // Protocol - The protocol for which the DDoS protection policy is being customized. Possible values include: 'DdosCustomPolicyProtocolTCP', 'DdosCustomPolicyProtocolUDP', 'DdosCustomPolicyProtocolSyn' + Protocol DdosCustomPolicyProtocol `json:"protocol,omitempty"` + // TriggerRateOverride - The customized DDoS protection trigger rate. + TriggerRateOverride *string `json:"triggerRateOverride,omitempty"` + // SourceRateOverride - The customized DDoS protection source rate. + SourceRateOverride *string `json:"sourceRateOverride,omitempty"` + // TriggerSensitivityOverride - The customized DDoS protection trigger rate sensitivity degrees. High: Trigger rate set with most sensitivity w.r.t. normal traffic. Default: Trigger rate set with moderate sensitivity w.r.t. normal traffic. Low: Trigger rate set with less sensitivity w.r.t. normal traffic. Relaxed: Trigger rate set with least sensitivity w.r.t. normal traffic. Possible values include: 'DdosCustomPolicyTriggerSensitivityOverrideRelaxed', 'DdosCustomPolicyTriggerSensitivityOverrideLow', 'DdosCustomPolicyTriggerSensitivityOverrideDefault', 'DdosCustomPolicyTriggerSensitivityOverrideHigh' + TriggerSensitivityOverride DdosCustomPolicyTriggerSensitivityOverride `json:"triggerSensitivityOverride,omitempty"` +} + +// PublicIPAddress public IP address resource. +type PublicIPAddress struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The public IP address SKU. + Sku *PublicIPAddressSku `json:"sku,omitempty"` + // PublicIPAddressPropertiesFormat - Public IP address properties. + *PublicIPAddressPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PublicIPAddress. +func (pia PublicIPAddress) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pia.ExtendedLocation != nil { + objectMap["extendedLocation"] = pia.ExtendedLocation + } + if pia.Sku != nil { + objectMap["sku"] = pia.Sku + } + if pia.PublicIPAddressPropertiesFormat != nil { + objectMap["properties"] = pia.PublicIPAddressPropertiesFormat + } + if pia.Zones != nil { + objectMap["zones"] = pia.Zones + } + if pia.ID != nil { + objectMap["id"] = pia.ID + } + if pia.Location != nil { + objectMap["location"] = pia.Location + } + if pia.Tags != nil { + objectMap["tags"] = pia.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicIPAddress struct. +func (pia *PublicIPAddress) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pia.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku PublicIPAddressSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pia.Sku = &sku + } + case "properties": + if v != nil { + var publicIPAddressPropertiesFormat PublicIPAddressPropertiesFormat + err = json.Unmarshal(*v, &publicIPAddressPropertiesFormat) + if err != nil { + return err + } + pia.PublicIPAddressPropertiesFormat = &publicIPAddressPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pia.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + pia.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pia.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pia.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pia.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pia.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pia.Tags = tags + } + } + } + + return nil +} + +// PublicIPAddressDNSSettings contains FQDN of the DNS record associated with the public IP address. +type PublicIPAddressDNSSettings struct { + // DomainNameLabel - The domain name label. The concatenation of the domain name label and the regionalized DNS zone make up the fully qualified domain name associated with the public IP address. If a domain name label is specified, an A DNS record is created for the public IP in the Microsoft Azure DNS system. + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + // Fqdn - The Fully Qualified Domain Name of the A DNS record associated with the public IP. This is the concatenation of the domainNameLabel and the regionalized DNS zone. + Fqdn *string `json:"fqdn,omitempty"` + // ReverseFqdn - The reverse FQDN. A user-visible, fully qualified domain name that resolves to this public IP address. If the reverseFqdn is specified, then a PTR DNS record is created pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. + ReverseFqdn *string `json:"reverseFqdn,omitempty"` +} + +// PublicIPAddressesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PublicIPAddressesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPAddressesClient) (PublicIPAddress, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPAddressesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPAddressesCreateOrUpdateFuture.Result. +func (future *PublicIPAddressesCreateOrUpdateFuture) result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pia.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent { + pia, err = client.CreateOrUpdateResponder(pia.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesCreateOrUpdateFuture", "Result", pia.Response.Response, "Failure responding to request") + } + } + return +} + +// PublicIPAddressesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PublicIPAddressesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPAddressesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPAddressesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPAddressesDeleteFuture.Result. +func (future *PublicIPAddressesDeleteFuture) result(client PublicIPAddressesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPAddressesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PublicIPAddressListResult response for ListPublicIpAddresses API service call. +type PublicIPAddressListResult struct { + autorest.Response `json:"-"` + // Value - A list of public IP addresses that exists in a resource group. + Value *[]PublicIPAddress `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicIPAddressListResultIterator provides access to a complete listing of PublicIPAddress values. +type PublicIPAddressListResultIterator struct { + i int + page PublicIPAddressListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublicIPAddressListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublicIPAddressListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicIPAddressListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublicIPAddressListResultIterator) Response() PublicIPAddressListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublicIPAddressListResultIterator) Value() PublicIPAddress { + if !iter.page.NotDone() { + return PublicIPAddress{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicIPAddressListResultIterator type. +func NewPublicIPAddressListResultIterator(page PublicIPAddressListResultPage) PublicIPAddressListResultIterator { + return PublicIPAddressListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pialr PublicIPAddressListResult) IsEmpty() bool { + return pialr.Value == nil || len(*pialr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pialr PublicIPAddressListResult) hasNextLink() bool { + return pialr.NextLink != nil && len(*pialr.NextLink) != 0 +} + +// publicIPAddressListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pialr PublicIPAddressListResult) publicIPAddressListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pialr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pialr.NextLink))) +} + +// PublicIPAddressListResultPage contains a page of PublicIPAddress values. +type PublicIPAddressListResultPage struct { + fn func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error) + pialr PublicIPAddressListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublicIPAddressListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pialr) + if err != nil { + return err + } + page.pialr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublicIPAddressListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicIPAddressListResultPage) NotDone() bool { + return !page.pialr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicIPAddressListResultPage) Response() PublicIPAddressListResult { + return page.pialr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicIPAddressListResultPage) Values() []PublicIPAddress { + if page.pialr.IsEmpty() { + return nil + } + return *page.pialr.Value +} + +// Creates a new instance of the PublicIPAddressListResultPage type. +func NewPublicIPAddressListResultPage(cur PublicIPAddressListResult, getNextPage func(context.Context, PublicIPAddressListResult) (PublicIPAddressListResult, error)) PublicIPAddressListResultPage { + return PublicIPAddressListResultPage{ + fn: getNextPage, + pialr: cur, + } +} + +// PublicIPAddressPropertiesFormat public IP address properties. +type PublicIPAddressPropertiesFormat struct { + // PublicIPAllocationMethod - The public IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PublicIPAllocationMethod IPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + // IPConfiguration - READ-ONLY; The IP configuration associated with the public IP address. + IPConfiguration *IPConfiguration `json:"ipConfiguration,omitempty"` + // DNSSettings - The FQDN of the DNS record associated with the public IP address. + DNSSettings *PublicIPAddressDNSSettings `json:"dnsSettings,omitempty"` + // DdosSettings - The DDoS protection custom policy associated with the public IP address. + DdosSettings *DdosSettings `json:"ddosSettings,omitempty"` + // IPTags - The list of tags associated with the public IP address. + IPTags *[]IPTag `json:"ipTags,omitempty"` + // IPAddress - The IP address associated with the public IP address resource. + IPAddress *string `json:"ipAddress,omitempty"` + // PublicIPPrefix - The Public IP Prefix this Public IP Address should be allocated from. + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` + // IdleTimeoutInMinutes - The idle timeout of the public IP address. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the public IP address resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the public IP address resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ServicePublicIPAddress - The service public IP address of the public IP address resource. + ServicePublicIPAddress *PublicIPAddress `json:"servicePublicIPAddress,omitempty"` + // NatGateway - The NatGateway for the Public IP address. + NatGateway *NatGateway `json:"natGateway,omitempty"` + // MigrationPhase - Migration phase of Public IP Address. Possible values include: 'PublicIPAddressMigrationPhaseNone', 'PublicIPAddressMigrationPhasePrepare', 'PublicIPAddressMigrationPhaseCommit', 'PublicIPAddressMigrationPhaseAbort', 'PublicIPAddressMigrationPhaseCommitted' + MigrationPhase PublicIPAddressMigrationPhase `json:"migrationPhase,omitempty"` + // LinkedPublicIPAddress - The linked public IP address of the public IP address resource. + LinkedPublicIPAddress *PublicIPAddress `json:"linkedPublicIPAddress,omitempty"` + // DeleteOption - Specify what happens to the public IP address when the VM using it is deleted. Possible values include: 'DeleteOptionsDelete', 'DeleteOptionsDetach' + DeleteOption DeleteOptions `json:"deleteOption,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicIPAddressPropertiesFormat. +func (piapf PublicIPAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if piapf.PublicIPAllocationMethod != "" { + objectMap["publicIPAllocationMethod"] = piapf.PublicIPAllocationMethod + } + if piapf.PublicIPAddressVersion != "" { + objectMap["publicIPAddressVersion"] = piapf.PublicIPAddressVersion + } + if piapf.DNSSettings != nil { + objectMap["dnsSettings"] = piapf.DNSSettings + } + if piapf.DdosSettings != nil { + objectMap["ddosSettings"] = piapf.DdosSettings + } + if piapf.IPTags != nil { + objectMap["ipTags"] = piapf.IPTags + } + if piapf.IPAddress != nil { + objectMap["ipAddress"] = piapf.IPAddress + } + if piapf.PublicIPPrefix != nil { + objectMap["publicIPPrefix"] = piapf.PublicIPPrefix + } + if piapf.IdleTimeoutInMinutes != nil { + objectMap["idleTimeoutInMinutes"] = piapf.IdleTimeoutInMinutes + } + if piapf.ServicePublicIPAddress != nil { + objectMap["servicePublicIPAddress"] = piapf.ServicePublicIPAddress + } + if piapf.NatGateway != nil { + objectMap["natGateway"] = piapf.NatGateway + } + if piapf.MigrationPhase != "" { + objectMap["migrationPhase"] = piapf.MigrationPhase + } + if piapf.LinkedPublicIPAddress != nil { + objectMap["linkedPublicIPAddress"] = piapf.LinkedPublicIPAddress + } + if piapf.DeleteOption != "" { + objectMap["deleteOption"] = piapf.DeleteOption + } + return json.Marshal(objectMap) +} + +// PublicIPAddressSku SKU of a public IP address. +type PublicIPAddressSku struct { + // Name - Name of a public IP address SKU. Possible values include: 'PublicIPAddressSkuNameBasic', 'PublicIPAddressSkuNameStandard' + Name PublicIPAddressSkuName `json:"name,omitempty"` + // Tier - Tier of a public IP address SKU. Possible values include: 'PublicIPAddressSkuTierRegional', 'PublicIPAddressSkuTierGlobal' + Tier PublicIPAddressSkuTier `json:"tier,omitempty"` +} + +// PublicIPPrefix public IP prefix resource. +type PublicIPPrefix struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the public ip address. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Sku - The public IP prefix SKU. + Sku *PublicIPPrefixSku `json:"sku,omitempty"` + // PublicIPPrefixPropertiesFormat - Public IP prefix properties. + *PublicIPPrefixPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Zones - A list of availability zones denoting the IP allocated for the resource needs to come from. + Zones *[]string `json:"zones,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for PublicIPPrefix. +func (pip PublicIPPrefix) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pip.ExtendedLocation != nil { + objectMap["extendedLocation"] = pip.ExtendedLocation + } + if pip.Sku != nil { + objectMap["sku"] = pip.Sku + } + if pip.PublicIPPrefixPropertiesFormat != nil { + objectMap["properties"] = pip.PublicIPPrefixPropertiesFormat + } + if pip.Zones != nil { + objectMap["zones"] = pip.Zones + } + if pip.ID != nil { + objectMap["id"] = pip.ID + } + if pip.Location != nil { + objectMap["location"] = pip.Location + } + if pip.Tags != nil { + objectMap["tags"] = pip.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PublicIPPrefix struct. +func (pip *PublicIPPrefix) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + pip.ExtendedLocation = &extendedLocation + } + case "sku": + if v != nil { + var sku PublicIPPrefixSku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pip.Sku = &sku + } + case "properties": + if v != nil { + var publicIPPrefixPropertiesFormat PublicIPPrefixPropertiesFormat + err = json.Unmarshal(*v, &publicIPPrefixPropertiesFormat) + if err != nil { + return err + } + pip.PublicIPPrefixPropertiesFormat = &publicIPPrefixPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + pip.Etag = &etag + } + case "zones": + if v != nil { + var zones []string + err = json.Unmarshal(*v, &zones) + if err != nil { + return err + } + pip.Zones = &zones + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pip.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pip.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pip.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pip.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + pip.Tags = tags + } + } + } + + return nil +} + +// PublicIPPrefixesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PublicIPPrefixesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPPrefixesClient) (PublicIPPrefix, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPPrefixesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPPrefixesCreateOrUpdateFuture.Result. +func (future *PublicIPPrefixesCreateOrUpdateFuture) result(client PublicIPPrefixesClient) (pip PublicIPPrefix, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pip.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pip.Response.Response, err = future.GetResult(sender); err == nil && pip.Response.Response.StatusCode != http.StatusNoContent { + pip, err = client.CreateOrUpdateResponder(pip.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesCreateOrUpdateFuture", "Result", pip.Response.Response, "Failure responding to request") + } + } + return +} + +// PublicIPPrefixesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PublicIPPrefixesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PublicIPPrefixesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PublicIPPrefixesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PublicIPPrefixesDeleteFuture.Result. +func (future *PublicIPPrefixesDeleteFuture) result(client PublicIPPrefixesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PublicIPPrefixesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PublicIPPrefixListResult response for ListPublicIpPrefixes API service call. +type PublicIPPrefixListResult struct { + autorest.Response `json:"-"` + // Value - A list of public IP prefixes that exists in a resource group. + Value *[]PublicIPPrefix `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PublicIPPrefixListResultIterator provides access to a complete listing of PublicIPPrefix values. +type PublicIPPrefixListResultIterator struct { + i int + page PublicIPPrefixListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PublicIPPrefixListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PublicIPPrefixListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PublicIPPrefixListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PublicIPPrefixListResultIterator) Response() PublicIPPrefixListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PublicIPPrefixListResultIterator) Value() PublicIPPrefix { + if !iter.page.NotDone() { + return PublicIPPrefix{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PublicIPPrefixListResultIterator type. +func NewPublicIPPrefixListResultIterator(page PublicIPPrefixListResultPage) PublicIPPrefixListResultIterator { + return PublicIPPrefixListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (piplr PublicIPPrefixListResult) IsEmpty() bool { + return piplr.Value == nil || len(*piplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (piplr PublicIPPrefixListResult) hasNextLink() bool { + return piplr.NextLink != nil && len(*piplr.NextLink) != 0 +} + +// publicIPPrefixListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (piplr PublicIPPrefixListResult) publicIPPrefixListResultPreparer(ctx context.Context) (*http.Request, error) { + if !piplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(piplr.NextLink))) +} + +// PublicIPPrefixListResultPage contains a page of PublicIPPrefix values. +type PublicIPPrefixListResultPage struct { + fn func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error) + piplr PublicIPPrefixListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PublicIPPrefixListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.piplr) + if err != nil { + return err + } + page.piplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PublicIPPrefixListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PublicIPPrefixListResultPage) NotDone() bool { + return !page.piplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PublicIPPrefixListResultPage) Response() PublicIPPrefixListResult { + return page.piplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PublicIPPrefixListResultPage) Values() []PublicIPPrefix { + if page.piplr.IsEmpty() { + return nil + } + return *page.piplr.Value +} + +// Creates a new instance of the PublicIPPrefixListResultPage type. +func NewPublicIPPrefixListResultPage(cur PublicIPPrefixListResult, getNextPage func(context.Context, PublicIPPrefixListResult) (PublicIPPrefixListResult, error)) PublicIPPrefixListResultPage { + return PublicIPPrefixListResultPage{ + fn: getNextPage, + piplr: cur, + } +} + +// PublicIPPrefixPropertiesFormat public IP prefix properties. +type PublicIPPrefixPropertiesFormat struct { + // PublicIPAddressVersion - The public IP address version. Possible values include: 'IPVersionIPv4', 'IPVersionIPv6' + PublicIPAddressVersion IPVersion `json:"publicIPAddressVersion,omitempty"` + // IPTags - The list of tags associated with the public IP prefix. + IPTags *[]IPTag `json:"ipTags,omitempty"` + // PrefixLength - The Length of the Public IP Prefix. + PrefixLength *int32 `json:"prefixLength,omitempty"` + // IPPrefix - READ-ONLY; The allocated Prefix. + IPPrefix *string `json:"ipPrefix,omitempty"` + // PublicIPAddresses - READ-ONLY; The list of all referenced PublicIPAddresses. + PublicIPAddresses *[]ReferencedPublicIPAddress `json:"publicIPAddresses,omitempty"` + // LoadBalancerFrontendIPConfiguration - READ-ONLY; The reference to load balancer frontend IP configuration associated with the public IP prefix. + LoadBalancerFrontendIPConfiguration *SubResource `json:"loadBalancerFrontendIpConfiguration,omitempty"` + // CustomIPPrefix - The customIpPrefix that this prefix is associated with. + CustomIPPrefix *SubResource `json:"customIPPrefix,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the public IP prefix resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the public IP prefix resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // NatGateway - NatGateway of Public IP Prefix. + NatGateway *NatGateway `json:"natGateway,omitempty"` +} + +// MarshalJSON is the custom marshaler for PublicIPPrefixPropertiesFormat. +func (pippf PublicIPPrefixPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pippf.PublicIPAddressVersion != "" { + objectMap["publicIPAddressVersion"] = pippf.PublicIPAddressVersion + } + if pippf.IPTags != nil { + objectMap["ipTags"] = pippf.IPTags + } + if pippf.PrefixLength != nil { + objectMap["prefixLength"] = pippf.PrefixLength + } + if pippf.CustomIPPrefix != nil { + objectMap["customIPPrefix"] = pippf.CustomIPPrefix + } + if pippf.NatGateway != nil { + objectMap["natGateway"] = pippf.NatGateway + } + return json.Marshal(objectMap) +} + +// PublicIPPrefixSku SKU of a public IP prefix. +type PublicIPPrefixSku struct { + // Name - Name of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuNameStandard' + Name PublicIPPrefixSkuName `json:"name,omitempty"` + // Tier - Tier of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuTierRegional', 'PublicIPPrefixSkuTierGlobal' + Tier PublicIPPrefixSkuTier `json:"tier,omitempty"` +} + +// PutBastionShareableLinkAllFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PutBastionShareableLinkAllFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionShareableLinkListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PutBastionShareableLinkAllFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PutBastionShareableLinkAllFuture.Result. +func (future *PutBastionShareableLinkAllFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsllrp.bsllr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkAllFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { + bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkAllFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") + } + } + return +} + +// PutBastionShareableLinkFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PutBastionShareableLinkFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BaseClient) (BastionShareableLinkListResultPage, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PutBastionShareableLinkFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PutBastionShareableLinkFuture.Result. +func (future *PutBastionShareableLinkFuture) result(client BaseClient) (bsllrp BastionShareableLinkListResultPage, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bsllrp.bsllr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.PutBastionShareableLinkFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bsllrp.bsllr.Response.Response, err = future.GetResult(sender); err == nil && bsllrp.bsllr.Response.Response.StatusCode != http.StatusNoContent { + bsllrp, err = client.PutBastionShareableLinkResponder(bsllrp.bsllr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PutBastionShareableLinkFuture", "Result", bsllrp.bsllr.Response.Response, "Failure responding to request") + } + } + return +} + +// QosDefinition quality of Service defines the traffic configuration between endpoints. Mandatory to have +// one marking. +type QosDefinition struct { + // Markings - List of markings to be used in the configuration. + Markings *[]int32 `json:"markings,omitempty"` + // SourceIPRanges - Source IP ranges. + SourceIPRanges *[]QosIPRange `json:"sourceIpRanges,omitempty"` + // DestinationIPRanges - Destination IP ranges. + DestinationIPRanges *[]QosIPRange `json:"destinationIpRanges,omitempty"` + // SourcePortRanges - Sources port ranges. + SourcePortRanges *[]QosPortRange `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - Destination port ranges. + DestinationPortRanges *[]QosPortRange `json:"destinationPortRanges,omitempty"` + // Protocol - RNM supported protocol types. Possible values include: 'ProtocolTypeDoNotUse', 'ProtocolTypeIcmp', 'ProtocolTypeTCP', 'ProtocolTypeUDP', 'ProtocolTypeGre', 'ProtocolTypeEsp', 'ProtocolTypeAh', 'ProtocolTypeVxlan', 'ProtocolTypeAll' + Protocol ProtocolType `json:"protocol,omitempty"` +} + +// QosIPRange qos Traffic Profiler IP Range properties. +type QosIPRange struct { + // StartIP - Start IP Address. + StartIP *string `json:"startIP,omitempty"` + // EndIP - End IP Address. + EndIP *string `json:"endIP,omitempty"` +} + +// QosPortRange qos Traffic Profiler Port range properties. +type QosPortRange struct { + // Start - Qos Port Range start. + Start *int32 `json:"start,omitempty"` + // End - Qos Port Range end. + End *int32 `json:"end,omitempty"` +} + +// QueryInboundNatRulePortMappingRequest the request for a QueryInboundNatRulePortMapping API. Either +// IpConfiguration or IpAddress should be set +type QueryInboundNatRulePortMappingRequest struct { + // IPConfiguration - NetworkInterfaceIPConfiguration set in load balancer backend address. + IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` + // IPAddress - IP address set in load balancer backend address. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// QueryResults query result +type QueryResults struct { + autorest.Response `json:"-"` + // MatchingRecordsCount - Number of total records matching the query. + MatchingRecordsCount *int64 `json:"matchingRecordsCount,omitempty"` + // Signatures - Array containing the results of the query + Signatures *[]SingleQueryResult `json:"signatures,omitempty"` +} + +// QueryTroubleshootingParameters parameters that define the resource to query the troubleshooting result. +type QueryTroubleshootingParameters struct { + // TargetResourceID - The target resource ID to query the troubleshooting result. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// RadiusServer radius Server Settings. +type RadiusServer struct { + // RadiusServerAddress - The address of this radius server. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerScore - The initial score assigned to this radius server. + RadiusServerScore *int64 `json:"radiusServerScore,omitempty"` + // RadiusServerSecret - The secret used for this radius server. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` +} + +// RecordSet a collective group of information about the record set information. +type RecordSet struct { + // RecordType - Resource record type. + RecordType *string `json:"recordType,omitempty"` + // RecordSetName - Recordset name. + RecordSetName *string `json:"recordSetName,omitempty"` + // Fqdn - Fqdn that resolves to private endpoint ip address. + Fqdn *string `json:"fqdn,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the recordset. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // TTL - Recordset time to live. + TTL *int32 `json:"ttl,omitempty"` + // IPAddresses - The private ip address of the private endpoint. + IPAddresses *[]string `json:"ipAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for RecordSet. +func (rs RecordSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rs.RecordType != nil { + objectMap["recordType"] = rs.RecordType + } + if rs.RecordSetName != nil { + objectMap["recordSetName"] = rs.RecordSetName + } + if rs.Fqdn != nil { + objectMap["fqdn"] = rs.Fqdn + } + if rs.TTL != nil { + objectMap["ttl"] = rs.TTL + } + if rs.IPAddresses != nil { + objectMap["ipAddresses"] = rs.IPAddresses + } + return json.Marshal(objectMap) +} + +// ReferencedPublicIPAddress reference to a public IP address. +type ReferencedPublicIPAddress struct { + // ID - The PublicIPAddress Reference. + ID *string `json:"id,omitempty"` +} + +// Resource common resource representation. +type Resource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.ID != nil { + objectMap["id"] = r.ID + } + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceNavigationLink resourceNavigationLink resource. +type ResourceNavigationLink struct { + // ResourceNavigationLinkFormat - Resource navigation link properties format. + *ResourceNavigationLinkFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLink. +func (rnl ResourceNavigationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnl.ResourceNavigationLinkFormat != nil { + objectMap["properties"] = rnl.ResourceNavigationLinkFormat + } + if rnl.Name != nil { + objectMap["name"] = rnl.Name + } + if rnl.ID != nil { + objectMap["id"] = rnl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ResourceNavigationLink struct. +func (rnl *ResourceNavigationLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var resourceNavigationLinkFormat ResourceNavigationLinkFormat + err = json.Unmarshal(*v, &resourceNavigationLinkFormat) + if err != nil { + return err + } + rnl.ResourceNavigationLinkFormat = &resourceNavigationLinkFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rnl.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rnl.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rnl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rnl.ID = &ID + } + } + } + + return nil +} + +// ResourceNavigationLinkFormat properties of ResourceNavigationLink. +type ResourceNavigationLinkFormat struct { + // LinkedResourceType - Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + // Link - Link to the external resource. + Link *string `json:"link,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource navigation link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLinkFormat. +func (rnlf ResourceNavigationLinkFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnlf.LinkedResourceType != nil { + objectMap["linkedResourceType"] = rnlf.LinkedResourceType + } + if rnlf.Link != nil { + objectMap["link"] = rnlf.Link + } + return json.Marshal(objectMap) +} + +// ResourceNavigationLinksListResult response for ResourceNavigationLinks_List operation. +type ResourceNavigationLinksListResult struct { + autorest.Response `json:"-"` + // Value - The resource navigation links in a subnet. + Value *[]ResourceNavigationLink `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceNavigationLinksListResult. +func (rnllr ResourceNavigationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rnllr.Value != nil { + objectMap["value"] = rnllr.Value + } + return json.Marshal(objectMap) +} + +// ResourceSet the base resource set for visibility and auto-approval. +type ResourceSet struct { + // Subscriptions - The list of subscriptions. + Subscriptions *[]string `json:"subscriptions,omitempty"` +} + +// RetentionPolicyParameters parameters that define the retention policy for flow log. +type RetentionPolicyParameters struct { + // Days - Number of days to retain flow log records. + Days *int32 `json:"days,omitempty"` + // Enabled - Flag to enable/disable retention. + Enabled *bool `json:"enabled,omitempty"` +} + +// Route route resource. +type Route struct { + autorest.Response `json:"-"` + // RoutePropertiesFormat - Properties of the route. + *RoutePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Route. +func (r Route) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.RoutePropertiesFormat != nil { + objectMap["properties"] = r.RoutePropertiesFormat + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Type != nil { + objectMap["type"] = r.Type + } + if r.ID != nil { + objectMap["id"] = r.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Route struct. +func (r *Route) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routePropertiesFormat RoutePropertiesFormat + err = json.Unmarshal(*v, &routePropertiesFormat) + if err != nil { + return err + } + r.RoutePropertiesFormat = &routePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + r.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + r.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + r.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + r.ID = &ID + } + } + } + + return nil +} + +// RouteFilter route Filter Resource. +type RouteFilter struct { + autorest.Response `json:"-"` + // RouteFilterPropertiesFormat - Properties of the route filter. + *RouteFilterPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for RouteFilter. +func (rf RouteFilter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rf.RouteFilterPropertiesFormat != nil { + objectMap["properties"] = rf.RouteFilterPropertiesFormat + } + if rf.ID != nil { + objectMap["id"] = rf.ID + } + if rf.Location != nil { + objectMap["location"] = rf.Location + } + if rf.Tags != nil { + objectMap["tags"] = rf.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteFilter struct. +func (rf *RouteFilter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterPropertiesFormat RouteFilterPropertiesFormat + err = json.Unmarshal(*v, &routeFilterPropertiesFormat) + if err != nil { + return err + } + rf.RouteFilterPropertiesFormat = &routeFilterPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rf.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rf.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rf.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rf.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rf.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rf.Tags = tags + } + } + } + + return nil +} + +// RouteFilterListResult response for the ListRouteFilters API service call. +type RouteFilterListResult struct { + autorest.Response `json:"-"` + // Value - A list of route filters in a resource group. + Value *[]RouteFilter `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterListResultIterator provides access to a complete listing of RouteFilter values. +type RouteFilterListResultIterator struct { + i int + page RouteFilterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteFilterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteFilterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteFilterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteFilterListResultIterator) Response() RouteFilterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteFilterListResultIterator) Value() RouteFilter { + if !iter.page.NotDone() { + return RouteFilter{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteFilterListResultIterator type. +func NewRouteFilterListResultIterator(page RouteFilterListResultPage) RouteFilterListResultIterator { + return RouteFilterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rflr RouteFilterListResult) IsEmpty() bool { + return rflr.Value == nil || len(*rflr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rflr RouteFilterListResult) hasNextLink() bool { + return rflr.NextLink != nil && len(*rflr.NextLink) != 0 +} + +// routeFilterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rflr RouteFilterListResult) routeFilterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rflr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rflr.NextLink))) +} + +// RouteFilterListResultPage contains a page of RouteFilter values. +type RouteFilterListResultPage struct { + fn func(context.Context, RouteFilterListResult) (RouteFilterListResult, error) + rflr RouteFilterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteFilterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rflr) + if err != nil { + return err + } + page.rflr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteFilterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteFilterListResultPage) NotDone() bool { + return !page.rflr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteFilterListResultPage) Response() RouteFilterListResult { + return page.rflr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteFilterListResultPage) Values() []RouteFilter { + if page.rflr.IsEmpty() { + return nil + } + return *page.rflr.Value +} + +// Creates a new instance of the RouteFilterListResultPage type. +func NewRouteFilterListResultPage(cur RouteFilterListResult, getNextPage func(context.Context, RouteFilterListResult) (RouteFilterListResult, error)) RouteFilterListResultPage { + return RouteFilterListResultPage{ + fn: getNextPage, + rflr: cur, + } +} + +// RouteFilterPropertiesFormat route Filter Resource. +type RouteFilterPropertiesFormat struct { + // Rules - Collection of RouteFilterRules contained within a route filter. + Rules *[]RouteFilterRule `json:"rules,omitempty"` + // Peerings - READ-ONLY; A collection of references to express route circuit peerings. + Peerings *[]ExpressRouteCircuitPeering `json:"peerings,omitempty"` + // Ipv6Peerings - READ-ONLY; A collection of references to express route circuit ipv6 peerings. + Ipv6Peerings *[]ExpressRouteCircuitPeering `json:"ipv6Peerings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route filter resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterPropertiesFormat. +func (rfpf RouteFilterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfpf.Rules != nil { + objectMap["rules"] = rfpf.Rules + } + return json.Marshal(objectMap) +} + +// RouteFilterRule route Filter Rule Resource. +type RouteFilterRule struct { + autorest.Response `json:"-"` + // RouteFilterRulePropertiesFormat - Properties of the route filter rule. + *RouteFilterRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterRule. +func (rfr RouteFilterRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfr.RouteFilterRulePropertiesFormat != nil { + objectMap["properties"] = rfr.RouteFilterRulePropertiesFormat + } + if rfr.Name != nil { + objectMap["name"] = rfr.Name + } + if rfr.Location != nil { + objectMap["location"] = rfr.Location + } + if rfr.ID != nil { + objectMap["id"] = rfr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteFilterRule struct. +func (rfr *RouteFilterRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeFilterRulePropertiesFormat RouteFilterRulePropertiesFormat + err = json.Unmarshal(*v, &routeFilterRulePropertiesFormat) + if err != nil { + return err + } + rfr.RouteFilterRulePropertiesFormat = &routeFilterRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rfr.Name = &name + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rfr.Location = &location + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rfr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rfr.ID = &ID + } + } + } + + return nil +} + +// RouteFilterRuleListResult response for the ListRouteFilterRules API service call. +type RouteFilterRuleListResult struct { + autorest.Response `json:"-"` + // Value - A list of RouteFilterRules in a resource group. + Value *[]RouteFilterRule `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteFilterRuleListResultIterator provides access to a complete listing of RouteFilterRule values. +type RouteFilterRuleListResultIterator struct { + i int + page RouteFilterRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteFilterRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteFilterRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteFilterRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteFilterRuleListResultIterator) Response() RouteFilterRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteFilterRuleListResultIterator) Value() RouteFilterRule { + if !iter.page.NotDone() { + return RouteFilterRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteFilterRuleListResultIterator type. +func NewRouteFilterRuleListResultIterator(page RouteFilterRuleListResultPage) RouteFilterRuleListResultIterator { + return RouteFilterRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rfrlr RouteFilterRuleListResult) IsEmpty() bool { + return rfrlr.Value == nil || len(*rfrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rfrlr RouteFilterRuleListResult) hasNextLink() bool { + return rfrlr.NextLink != nil && len(*rfrlr.NextLink) != 0 +} + +// routeFilterRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rfrlr RouteFilterRuleListResult) routeFilterRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rfrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rfrlr.NextLink))) +} + +// RouteFilterRuleListResultPage contains a page of RouteFilterRule values. +type RouteFilterRuleListResultPage struct { + fn func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error) + rfrlr RouteFilterRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteFilterRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rfrlr) + if err != nil { + return err + } + page.rfrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteFilterRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteFilterRuleListResultPage) NotDone() bool { + return !page.rfrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteFilterRuleListResultPage) Response() RouteFilterRuleListResult { + return page.rfrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteFilterRuleListResultPage) Values() []RouteFilterRule { + if page.rfrlr.IsEmpty() { + return nil + } + return *page.rfrlr.Value +} + +// Creates a new instance of the RouteFilterRuleListResultPage type. +func NewRouteFilterRuleListResultPage(cur RouteFilterRuleListResult, getNextPage func(context.Context, RouteFilterRuleListResult) (RouteFilterRuleListResult, error)) RouteFilterRuleListResultPage { + return RouteFilterRuleListResultPage{ + fn: getNextPage, + rfrlr: cur, + } +} + +// RouteFilterRulePropertiesFormat route Filter Rule Resource. +type RouteFilterRulePropertiesFormat struct { + // Access - The access type of the rule. Possible values include: 'AccessAllow', 'AccessDeny' + Access Access `json:"access,omitempty"` + // RouteFilterRuleType - The rule type of the rule. + RouteFilterRuleType *string `json:"routeFilterRuleType,omitempty"` + // Communities - The collection for bgp community values to filter on. e.g. ['12076:5010','12076:5020']. + Communities *[]string `json:"communities,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route filter rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteFilterRulePropertiesFormat. +func (rfrpf RouteFilterRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rfrpf.Access != "" { + objectMap["access"] = rfrpf.Access + } + if rfrpf.RouteFilterRuleType != nil { + objectMap["routeFilterRuleType"] = rfrpf.RouteFilterRuleType + } + if rfrpf.Communities != nil { + objectMap["communities"] = rfrpf.Communities + } + return json.Marshal(objectMap) +} + +// RouteFilterRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteFilterRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFilterRulesClient) (RouteFilterRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFilterRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFilterRulesCreateOrUpdateFuture.Result. +func (future *RouteFilterRulesCreateOrUpdateFuture) result(client RouteFilterRulesClient) (rfr RouteFilterRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rfr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rfr.Response.Response, err = future.GetResult(sender); err == nil && rfr.Response.Response.StatusCode != http.StatusNoContent { + rfr, err = client.CreateOrUpdateResponder(rfr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesCreateOrUpdateFuture", "Result", rfr.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteFilterRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteFilterRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFilterRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFilterRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFilterRulesDeleteFuture.Result. +func (future *RouteFilterRulesDeleteFuture) result(client RouteFilterRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFilterRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RouteFiltersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteFiltersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFiltersClient) (RouteFilter, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFiltersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFiltersCreateOrUpdateFuture.Result. +func (future *RouteFiltersCreateOrUpdateFuture) result(client RouteFiltersClient) (rf RouteFilter, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rf.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rf.Response.Response, err = future.GetResult(sender); err == nil && rf.Response.Response.StatusCode != http.StatusNoContent { + rf, err = client.CreateOrUpdateResponder(rf.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersCreateOrUpdateFuture", "Result", rf.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteFiltersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteFiltersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteFiltersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteFiltersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteFiltersDeleteFuture.Result. +func (future *RouteFiltersDeleteFuture) result(client RouteFiltersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteFiltersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RouteListResult response for the ListRoute API service call. +type RouteListResult struct { + autorest.Response `json:"-"` + // Value - A list of routes in a resource group. + Value *[]Route `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteListResultIterator provides access to a complete listing of Route values. +type RouteListResultIterator struct { + i int + page RouteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteListResultIterator) Response() RouteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteListResultIterator) Value() Route { + if !iter.page.NotDone() { + return Route{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteListResultIterator type. +func NewRouteListResultIterator(page RouteListResultPage) RouteListResultIterator { + return RouteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rlr RouteListResult) IsEmpty() bool { + return rlr.Value == nil || len(*rlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rlr RouteListResult) hasNextLink() bool { + return rlr.NextLink != nil && len(*rlr.NextLink) != 0 +} + +// routeListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rlr RouteListResult) routeListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rlr.NextLink))) +} + +// RouteListResultPage contains a page of Route values. +type RouteListResultPage struct { + fn func(context.Context, RouteListResult) (RouteListResult, error) + rlr RouteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rlr) + if err != nil { + return err + } + page.rlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteListResultPage) NotDone() bool { + return !page.rlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteListResultPage) Response() RouteListResult { + return page.rlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteListResultPage) Values() []Route { + if page.rlr.IsEmpty() { + return nil + } + return *page.rlr.Value +} + +// Creates a new instance of the RouteListResultPage type. +func NewRouteListResultPage(cur RouteListResult, getNextPage func(context.Context, RouteListResult) (RouteListResult, error)) RouteListResultPage { + return RouteListResultPage{ + fn: getNextPage, + rlr: cur, + } +} + +// RoutePropertiesFormat route resource. +type RoutePropertiesFormat struct { + // AddressPrefix - The destination CIDR to which the route applies. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // NextHopType - The type of Azure hop the packet should be sent to. Possible values include: 'RouteNextHopTypeVirtualNetworkGateway', 'RouteNextHopTypeVnetLocal', 'RouteNextHopTypeInternet', 'RouteNextHopTypeVirtualAppliance', 'RouteNextHopTypeNone' + NextHopType RouteNextHopType `json:"nextHopType,omitempty"` + // NextHopIPAddress - The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // HasBgpOverride - A value indicating whether this route overrides overlapping BGP routes regardless of LPM. + HasBgpOverride *bool `json:"hasBgpOverride,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutePropertiesFormat. +func (rpf RoutePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpf.AddressPrefix != nil { + objectMap["addressPrefix"] = rpf.AddressPrefix + } + if rpf.NextHopType != "" { + objectMap["nextHopType"] = rpf.NextHopType + } + if rpf.NextHopIPAddress != nil { + objectMap["nextHopIpAddress"] = rpf.NextHopIPAddress + } + if rpf.HasBgpOverride != nil { + objectMap["hasBgpOverride"] = rpf.HasBgpOverride + } + return json.Marshal(objectMap) +} + +// RoutesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RoutesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (Route, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesCreateOrUpdateFuture.Result. +func (future *RoutesCreateOrUpdateFuture) result(client RoutesClient) (r Route, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateOrUpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RoutesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutesDeleteFuture.Result. +func (future *RoutesDeleteFuture) result(client RoutesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RouteTable route table resource. +type RouteTable struct { + autorest.Response `json:"-"` + // RouteTablePropertiesFormat - Properties of the route table. + *RouteTablePropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for RouteTable. +func (rt RouteTable) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rt.RouteTablePropertiesFormat != nil { + objectMap["properties"] = rt.RouteTablePropertiesFormat + } + if rt.ID != nil { + objectMap["id"] = rt.ID + } + if rt.Location != nil { + objectMap["location"] = rt.Location + } + if rt.Tags != nil { + objectMap["tags"] = rt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RouteTable struct. +func (rt *RouteTable) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routeTablePropertiesFormat RouteTablePropertiesFormat + err = json.Unmarshal(*v, &routeTablePropertiesFormat) + if err != nil { + return err + } + rt.RouteTablePropertiesFormat = &routeTablePropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rt.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + rt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + rt.Tags = tags + } + } + } + + return nil +} + +// RouteTableListResult response for the ListRouteTable API service call. +type RouteTableListResult struct { + autorest.Response `json:"-"` + // Value - A list of route tables in a resource group. + Value *[]RouteTable `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RouteTableListResultIterator provides access to a complete listing of RouteTable values. +type RouteTableListResultIterator struct { + i int + page RouteTableListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RouteTableListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RouteTableListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RouteTableListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RouteTableListResultIterator) Response() RouteTableListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RouteTableListResultIterator) Value() RouteTable { + if !iter.page.NotDone() { + return RouteTable{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RouteTableListResultIterator type. +func NewRouteTableListResultIterator(page RouteTableListResultPage) RouteTableListResultIterator { + return RouteTableListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rtlr RouteTableListResult) IsEmpty() bool { + return rtlr.Value == nil || len(*rtlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rtlr RouteTableListResult) hasNextLink() bool { + return rtlr.NextLink != nil && len(*rtlr.NextLink) != 0 +} + +// routeTableListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rtlr RouteTableListResult) routeTableListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rtlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rtlr.NextLink))) +} + +// RouteTableListResultPage contains a page of RouteTable values. +type RouteTableListResultPage struct { + fn func(context.Context, RouteTableListResult) (RouteTableListResult, error) + rtlr RouteTableListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RouteTableListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTableListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rtlr) + if err != nil { + return err + } + page.rtlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RouteTableListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RouteTableListResultPage) NotDone() bool { + return !page.rtlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RouteTableListResultPage) Response() RouteTableListResult { + return page.rtlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RouteTableListResultPage) Values() []RouteTable { + if page.rtlr.IsEmpty() { + return nil + } + return *page.rtlr.Value +} + +// Creates a new instance of the RouteTableListResultPage type. +func NewRouteTableListResultPage(cur RouteTableListResult, getNextPage func(context.Context, RouteTableListResult) (RouteTableListResult, error)) RouteTableListResultPage { + return RouteTableListResultPage{ + fn: getNextPage, + rtlr: cur, + } +} + +// RouteTablePropertiesFormat route Table resource. +type RouteTablePropertiesFormat struct { + // Routes - Collection of routes contained within a route table. + Routes *[]Route `json:"routes,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // DisableBgpRoutePropagation - Whether to disable the routes learned by BGP on that route table. True means disable. + DisableBgpRoutePropagation *bool `json:"disableBgpRoutePropagation,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the route table resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the route table. + ResourceGUID *string `json:"resourceGuid,omitempty"` +} + +// MarshalJSON is the custom marshaler for RouteTablePropertiesFormat. +func (rtpf RouteTablePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rtpf.Routes != nil { + objectMap["routes"] = rtpf.Routes + } + if rtpf.DisableBgpRoutePropagation != nil { + objectMap["disableBgpRoutePropagation"] = rtpf.DisableBgpRoutePropagation + } + return json.Marshal(objectMap) +} + +// RouteTablesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RouteTablesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteTablesClient) (RouteTable, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteTablesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteTablesCreateOrUpdateFuture.Result. +func (future *RouteTablesCreateOrUpdateFuture) result(client RouteTablesClient) (rt RouteTable, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteTablesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent { + rt, err = client.CreateOrUpdateResponder(rt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesCreateOrUpdateFuture", "Result", rt.Response.Response, "Failure responding to request") + } + } + return +} + +// RouteTablesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RouteTablesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RouteTablesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RouteTablesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RouteTablesDeleteFuture.Result. +func (future *RouteTablesDeleteFuture) result(client RouteTablesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RouteTablesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutingConfiguration routing Configuration indicating the associated and propagated route tables for +// this connection. +type RoutingConfiguration struct { + // AssociatedRouteTable - The resource id RouteTable associated with this RoutingConfiguration. + AssociatedRouteTable *SubResource `json:"associatedRouteTable,omitempty"` + // PropagatedRouteTables - The list of RouteTables to advertise the routes to. + PropagatedRouteTables *PropagatedRouteTable `json:"propagatedRouteTables,omitempty"` + // VnetRoutes - List of routes that control routing from VirtualHub into a virtual network connection. + VnetRoutes *VnetRoute `json:"vnetRoutes,omitempty"` +} + +// RoutingIntent the routing intent child resource of a Virtual hub. +type RoutingIntent struct { + autorest.Response `json:"-"` + // RoutingIntentProperties - Properties of the RoutingIntent resource. + *RoutingIntentProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingIntent. +func (ri RoutingIntent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.RoutingIntentProperties != nil { + objectMap["properties"] = ri.RoutingIntentProperties + } + if ri.Name != nil { + objectMap["name"] = ri.Name + } + if ri.ID != nil { + objectMap["id"] = ri.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoutingIntent struct. +func (ri *RoutingIntent) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var routingIntentProperties RoutingIntentProperties + err = json.Unmarshal(*v, &routingIntentProperties) + if err != nil { + return err + } + ri.RoutingIntentProperties = &routingIntentProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ri.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ri.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ri.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ri.ID = &ID + } + } + } + + return nil +} + +// RoutingIntentCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type RoutingIntentCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutingIntentClient) (RoutingIntent, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutingIntentCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutingIntentCreateOrUpdateFuture.Result. +func (future *RoutingIntentCreateOrUpdateFuture) result(client RoutingIntentClient) (ri RoutingIntent, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ri.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutingIntentCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ri.Response.Response, err = future.GetResult(sender); err == nil && ri.Response.Response.StatusCode != http.StatusNoContent { + ri, err = client.CreateOrUpdateResponder(ri.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentCreateOrUpdateFuture", "Result", ri.Response.Response, "Failure responding to request") + } + } + return +} + +// RoutingIntentDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RoutingIntentDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RoutingIntentClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *RoutingIntentDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for RoutingIntentDeleteFuture.Result. +func (future *RoutingIntentDeleteFuture) result(client RoutingIntentClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.RoutingIntentDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// RoutingIntentProperties the properties of a RoutingIntent resource. +type RoutingIntentProperties struct { + // RoutingPolicies - List of routing policies. + RoutingPolicies *[]RoutingPolicy `json:"routingPolicies,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the RoutingIntent resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoutingIntentProperties. +func (rip RoutingIntentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rip.RoutingPolicies != nil { + objectMap["routingPolicies"] = rip.RoutingPolicies + } + return json.Marshal(objectMap) +} + +// RoutingPolicy the routing policy object used in a RoutingIntent resource. +type RoutingPolicy struct { + // Name - The unique name for the routing policy. + Name *string `json:"name,omitempty"` + // Destinations - List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic). + Destinations *[]string `json:"destinations,omitempty"` + // NextHop - The next hop resource id on which this routing policy is applicable to. + NextHop *string `json:"nextHop,omitempty"` +} + +// Rule rule of type network. +type Rule struct { + // IPProtocols - Array of FirewallPolicyRuleNetworkProtocols. + IPProtocols *[]FirewallPolicyRuleNetworkProtocol `json:"ipProtocols,omitempty"` + // SourceAddresses - List of source IP addresses for this rule. + SourceAddresses *[]string `json:"sourceAddresses,omitempty"` + // DestinationAddresses - List of destination IP addresses or Service Tags. + DestinationAddresses *[]string `json:"destinationAddresses,omitempty"` + // DestinationPorts - List of destination ports. + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // SourceIPGroups - List of source IpGroups for this rule. + SourceIPGroups *[]string `json:"sourceIpGroups,omitempty"` + // DestinationIPGroups - List of destination IpGroups for this rule. + DestinationIPGroups *[]string `json:"destinationIpGroups,omitempty"` + // DestinationFqdns - List of destination FQDNs. + DestinationFqdns *[]string `json:"destinationFqdns,omitempty"` + // Name - Name of the rule. + Name *string `json:"name,omitempty"` + // Description - Description of the rule. + Description *string `json:"description,omitempty"` + // RuleType - Possible values include: 'RuleTypeFirewallPolicyRule', 'RuleTypeApplicationRule', 'RuleTypeNatRule', 'RuleTypeNetworkRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + r.RuleType = RuleTypeNetworkRule + objectMap := make(map[string]interface{}) + if r.IPProtocols != nil { + objectMap["ipProtocols"] = r.IPProtocols + } + if r.SourceAddresses != nil { + objectMap["sourceAddresses"] = r.SourceAddresses + } + if r.DestinationAddresses != nil { + objectMap["destinationAddresses"] = r.DestinationAddresses + } + if r.DestinationPorts != nil { + objectMap["destinationPorts"] = r.DestinationPorts + } + if r.SourceIPGroups != nil { + objectMap["sourceIpGroups"] = r.SourceIPGroups + } + if r.DestinationIPGroups != nil { + objectMap["destinationIpGroups"] = r.DestinationIPGroups + } + if r.DestinationFqdns != nil { + objectMap["destinationFqdns"] = r.DestinationFqdns + } + if r.Name != nil { + objectMap["name"] = r.Name + } + if r.Description != nil { + objectMap["description"] = r.Description + } + if r.RuleType != "" { + objectMap["ruleType"] = r.RuleType + } + return json.Marshal(objectMap) +} + +// AsApplicationRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsApplicationRule() (*ApplicationRule, bool) { + return nil, false +} + +// AsNatRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsNatRule() (*NatRule, bool) { + return nil, false +} + +// AsRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsRule() (*Rule, bool) { + return &r, true +} + +// AsFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsFirewallPolicyRule() (*FirewallPolicyRule, bool) { + return nil, false +} + +// AsBasicFirewallPolicyRule is the BasicFirewallPolicyRule implementation for Rule. +func (r Rule) AsBasicFirewallPolicyRule() (BasicFirewallPolicyRule, bool) { + return &r, true +} + +// SecurityGroup networkSecurityGroup resource. +type SecurityGroup struct { + autorest.Response `json:"-"` + // SecurityGroupPropertiesFormat - Properties of the network security group. + *SecurityGroupPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SecurityGroup. +func (sg SecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sg.SecurityGroupPropertiesFormat != nil { + objectMap["properties"] = sg.SecurityGroupPropertiesFormat + } + if sg.ID != nil { + objectMap["id"] = sg.ID + } + if sg.Location != nil { + objectMap["location"] = sg.Location + } + if sg.Tags != nil { + objectMap["tags"] = sg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityGroup struct. +func (sg *SecurityGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityGroupPropertiesFormat SecurityGroupPropertiesFormat + err = json.Unmarshal(*v, &securityGroupPropertiesFormat) + if err != nil { + return err + } + sg.SecurityGroupPropertiesFormat = &securityGroupPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sg.Tags = tags + } + } + } + + return nil +} + +// SecurityGroupListResult response for ListNetworkSecurityGroups API service call. +type SecurityGroupListResult struct { + autorest.Response `json:"-"` + // Value - A list of NetworkSecurityGroup resources. + Value *[]SecurityGroup `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityGroupListResultIterator provides access to a complete listing of SecurityGroup values. +type SecurityGroupListResultIterator struct { + i int + page SecurityGroupListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityGroupListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityGroupListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityGroupListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityGroupListResultIterator) Response() SecurityGroupListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityGroupListResultIterator) Value() SecurityGroup { + if !iter.page.NotDone() { + return SecurityGroup{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityGroupListResultIterator type. +func NewSecurityGroupListResultIterator(page SecurityGroupListResultPage) SecurityGroupListResultIterator { + return SecurityGroupListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sglr SecurityGroupListResult) IsEmpty() bool { + return sglr.Value == nil || len(*sglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sglr SecurityGroupListResult) hasNextLink() bool { + return sglr.NextLink != nil && len(*sglr.NextLink) != 0 +} + +// securityGroupListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sglr SecurityGroupListResult) securityGroupListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sglr.NextLink))) +} + +// SecurityGroupListResultPage contains a page of SecurityGroup values. +type SecurityGroupListResultPage struct { + fn func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error) + sglr SecurityGroupListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityGroupListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sglr) + if err != nil { + return err + } + page.sglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityGroupListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityGroupListResultPage) NotDone() bool { + return !page.sglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityGroupListResultPage) Response() SecurityGroupListResult { + return page.sglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityGroupListResultPage) Values() []SecurityGroup { + if page.sglr.IsEmpty() { + return nil + } + return *page.sglr.Value +} + +// Creates a new instance of the SecurityGroupListResultPage type. +func NewSecurityGroupListResultPage(cur SecurityGroupListResult, getNextPage func(context.Context, SecurityGroupListResult) (SecurityGroupListResult, error)) SecurityGroupListResultPage { + return SecurityGroupListResultPage{ + fn: getNextPage, + sglr: cur, + } +} + +// SecurityGroupNetworkInterface network interface and all its associated security rules. +type SecurityGroupNetworkInterface struct { + // ID - ID of the network interface. + ID *string `json:"id,omitempty"` + // SecurityRuleAssociations - All security rules associated with the network interface. + SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"` +} + +// SecurityGroupPropertiesFormat network Security Group resource. +type SecurityGroupPropertiesFormat struct { + // SecurityRules - A collection of security rules of the network security group. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` + // DefaultSecurityRules - READ-ONLY; The default security rules of network security group. + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + // NetworkInterfaces - READ-ONLY; A collection of references to network interfaces. + NetworkInterfaces *[]Interface `json:"networkInterfaces,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // FlowLogs - READ-ONLY; A collection of references to flow log resources. + FlowLogs *[]FlowLog `json:"flowLogs,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the network security group resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the network security group resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupPropertiesFormat. +func (sgpf SecurityGroupPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sgpf.SecurityRules != nil { + objectMap["securityRules"] = sgpf.SecurityRules + } + return json.Marshal(objectMap) +} + +// SecurityGroupResult network configuration diagnostic result corresponded provided traffic query. +type SecurityGroupResult struct { + // SecurityRuleAccessResult - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + SecurityRuleAccessResult SecurityRuleAccess `json:"securityRuleAccessResult,omitempty"` + // EvaluatedNetworkSecurityGroups - READ-ONLY; List of results network security groups diagnostic. + EvaluatedNetworkSecurityGroups *[]EvaluatedNetworkSecurityGroup `json:"evaluatedNetworkSecurityGroups,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityGroupResult. +func (sgr SecurityGroupResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sgr.SecurityRuleAccessResult != "" { + objectMap["securityRuleAccessResult"] = sgr.SecurityRuleAccessResult + } + return json.Marshal(objectMap) +} + +// SecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityGroupsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityGroupsClient) (SecurityGroup, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityGroupsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityGroupsCreateOrUpdateFuture.Result. +func (future *SecurityGroupsCreateOrUpdateFuture) result(client SecurityGroupsClient) (sg SecurityGroup, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sg.Response.Response, err = future.GetResult(sender); err == nil && sg.Response.Response.StatusCode != http.StatusNoContent { + sg, err = client.CreateOrUpdateResponder(sg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsCreateOrUpdateFuture", "Result", sg.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityGroupsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityGroupsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityGroupsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityGroupsDeleteFuture.Result. +func (future *SecurityGroupsDeleteFuture) result(client SecurityGroupsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityGroupsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityGroupViewParameters parameters that define the VM to check security groups for. +type SecurityGroupViewParameters struct { + // TargetResourceID - ID of the target VM. + TargetResourceID *string `json:"targetResourceId,omitempty"` +} + +// SecurityGroupViewResult the information about security rules applied to the specified VM. +type SecurityGroupViewResult struct { + autorest.Response `json:"-"` + // NetworkInterfaces - List of network interfaces on the specified VM. + NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"` +} + +// SecurityPartnerProvider security Partner Provider resource. +type SecurityPartnerProvider struct { + autorest.Response `json:"-"` + // SecurityPartnerProviderPropertiesFormat - Properties of the Security Partner Provider. + *SecurityPartnerProviderPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for SecurityPartnerProvider. +func (spp SecurityPartnerProvider) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spp.SecurityPartnerProviderPropertiesFormat != nil { + objectMap["properties"] = spp.SecurityPartnerProviderPropertiesFormat + } + if spp.ID != nil { + objectMap["id"] = spp.ID + } + if spp.Location != nil { + objectMap["location"] = spp.Location + } + if spp.Tags != nil { + objectMap["tags"] = spp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityPartnerProvider struct. +func (spp *SecurityPartnerProvider) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityPartnerProviderPropertiesFormat SecurityPartnerProviderPropertiesFormat + err = json.Unmarshal(*v, &securityPartnerProviderPropertiesFormat) + if err != nil { + return err + } + spp.SecurityPartnerProviderPropertiesFormat = &securityPartnerProviderPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + spp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + spp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + spp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + spp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + spp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + spp.Tags = tags + } + } + } + + return nil +} + +// SecurityPartnerProviderListResult response for ListSecurityPartnerProviders API service call. +type SecurityPartnerProviderListResult struct { + autorest.Response `json:"-"` + // Value - List of Security Partner Providers in a resource group. + Value *[]SecurityPartnerProvider `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityPartnerProviderListResultIterator provides access to a complete listing of +// SecurityPartnerProvider values. +type SecurityPartnerProviderListResultIterator struct { + i int + page SecurityPartnerProviderListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityPartnerProviderListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityPartnerProviderListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityPartnerProviderListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityPartnerProviderListResultIterator) Response() SecurityPartnerProviderListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityPartnerProviderListResultIterator) Value() SecurityPartnerProvider { + if !iter.page.NotDone() { + return SecurityPartnerProvider{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityPartnerProviderListResultIterator type. +func NewSecurityPartnerProviderListResultIterator(page SecurityPartnerProviderListResultPage) SecurityPartnerProviderListResultIterator { + return SecurityPartnerProviderListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (spplr SecurityPartnerProviderListResult) IsEmpty() bool { + return spplr.Value == nil || len(*spplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (spplr SecurityPartnerProviderListResult) hasNextLink() bool { + return spplr.NextLink != nil && len(*spplr.NextLink) != 0 +} + +// securityPartnerProviderListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (spplr SecurityPartnerProviderListResult) securityPartnerProviderListResultPreparer(ctx context.Context) (*http.Request, error) { + if !spplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(spplr.NextLink))) +} + +// SecurityPartnerProviderListResultPage contains a page of SecurityPartnerProvider values. +type SecurityPartnerProviderListResultPage struct { + fn func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error) + spplr SecurityPartnerProviderListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityPartnerProviderListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProviderListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.spplr) + if err != nil { + return err + } + page.spplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityPartnerProviderListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityPartnerProviderListResultPage) NotDone() bool { + return !page.spplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityPartnerProviderListResultPage) Response() SecurityPartnerProviderListResult { + return page.spplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityPartnerProviderListResultPage) Values() []SecurityPartnerProvider { + if page.spplr.IsEmpty() { + return nil + } + return *page.spplr.Value +} + +// Creates a new instance of the SecurityPartnerProviderListResultPage type. +func NewSecurityPartnerProviderListResultPage(cur SecurityPartnerProviderListResult, getNextPage func(context.Context, SecurityPartnerProviderListResult) (SecurityPartnerProviderListResult, error)) SecurityPartnerProviderListResultPage { + return SecurityPartnerProviderListResultPage{ + fn: getNextPage, + spplr: cur, + } +} + +// SecurityPartnerProviderPropertiesFormat properties of the Security Partner Provider. +type SecurityPartnerProviderPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the Security Partner Provider resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SecurityProviderName - The security provider name. Possible values include: 'SecurityProviderNameZScaler', 'SecurityProviderNameIBoss', 'SecurityProviderNameCheckpoint' + SecurityProviderName SecurityProviderName `json:"securityProviderName,omitempty"` + // ConnectionStatus - READ-ONLY; The connection status with the Security Partner Provider. Possible values include: 'SecurityPartnerProviderConnectionStatusUnknown', 'SecurityPartnerProviderConnectionStatusPartiallyConnected', 'SecurityPartnerProviderConnectionStatusConnected', 'SecurityPartnerProviderConnectionStatusNotConnected' + ConnectionStatus SecurityPartnerProviderConnectionStatus `json:"connectionStatus,omitempty"` + // VirtualHub - The virtualHub to which the Security Partner Provider belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityPartnerProviderPropertiesFormat. +func (spppf SecurityPartnerProviderPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spppf.SecurityProviderName != "" { + objectMap["securityProviderName"] = spppf.SecurityProviderName + } + if spppf.VirtualHub != nil { + objectMap["virtualHub"] = spppf.VirtualHub + } + return json.Marshal(objectMap) +} + +// SecurityPartnerProvidersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type SecurityPartnerProvidersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPartnerProvidersClient) (SecurityPartnerProvider, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPartnerProvidersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPartnerProvidersCreateOrUpdateFuture.Result. +func (future *SecurityPartnerProvidersCreateOrUpdateFuture) result(client SecurityPartnerProvidersClient) (spp SecurityPartnerProvider, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + spp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if spp.Response.Response, err = future.GetResult(sender); err == nil && spp.Response.Response.StatusCode != http.StatusNoContent { + spp, err = client.CreateOrUpdateResponder(spp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersCreateOrUpdateFuture", "Result", spp.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityPartnerProvidersDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityPartnerProvidersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityPartnerProvidersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityPartnerProvidersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityPartnerProvidersDeleteFuture.Result. +func (future *SecurityPartnerProvidersDeleteFuture) result(client SecurityPartnerProvidersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityPartnerProvidersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SecurityRule network security rule. +type SecurityRule struct { + autorest.Response `json:"-"` + // SecurityRulePropertiesFormat - Properties of the security rule. + *SecurityRulePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityRule. +func (sr SecurityRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.SecurityRulePropertiesFormat != nil { + objectMap["properties"] = sr.SecurityRulePropertiesFormat + } + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.Type != nil { + objectMap["type"] = sr.Type + } + if sr.ID != nil { + objectMap["id"] = sr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecurityRule struct. +func (sr *SecurityRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var securityRulePropertiesFormat SecurityRulePropertiesFormat + err = json.Unmarshal(*v, &securityRulePropertiesFormat) + if err != nil { + return err + } + sr.SecurityRulePropertiesFormat = &securityRulePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sr.ID = &ID + } + } + } + + return nil +} + +// SecurityRuleAssociations all security rules associated with the network interface. +type SecurityRuleAssociations struct { + // NetworkInterfaceAssociation - Network interface and it's custom security rules. + NetworkInterfaceAssociation *InterfaceAssociation `json:"networkInterfaceAssociation,omitempty"` + // SubnetAssociation - Subnet and it's custom security rules. + SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"` + // DefaultSecurityRules - Collection of default security rules of the network security group. + DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"` + // EffectiveSecurityRules - Collection of effective security rules. + EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"` +} + +// SecurityRuleListResult response for ListSecurityRule API service call. Retrieves all security rules that +// belongs to a network security group. +type SecurityRuleListResult struct { + autorest.Response `json:"-"` + // Value - The security rules in a network security group. + Value *[]SecurityRule `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SecurityRuleListResultIterator provides access to a complete listing of SecurityRule values. +type SecurityRuleListResultIterator struct { + i int + page SecurityRuleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SecurityRuleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SecurityRuleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SecurityRuleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SecurityRuleListResultIterator) Response() SecurityRuleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SecurityRuleListResultIterator) Value() SecurityRule { + if !iter.page.NotDone() { + return SecurityRule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SecurityRuleListResultIterator type. +func NewSecurityRuleListResultIterator(page SecurityRuleListResultPage) SecurityRuleListResultIterator { + return SecurityRuleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (srlr SecurityRuleListResult) IsEmpty() bool { + return srlr.Value == nil || len(*srlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (srlr SecurityRuleListResult) hasNextLink() bool { + return srlr.NextLink != nil && len(*srlr.NextLink) != 0 +} + +// securityRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (srlr SecurityRuleListResult) securityRuleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !srlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(srlr.NextLink))) +} + +// SecurityRuleListResultPage contains a page of SecurityRule values. +type SecurityRuleListResultPage struct { + fn func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error) + srlr SecurityRuleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SecurityRuleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRuleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.srlr) + if err != nil { + return err + } + page.srlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SecurityRuleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SecurityRuleListResultPage) NotDone() bool { + return !page.srlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SecurityRuleListResultPage) Response() SecurityRuleListResult { + return page.srlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SecurityRuleListResultPage) Values() []SecurityRule { + if page.srlr.IsEmpty() { + return nil + } + return *page.srlr.Value +} + +// Creates a new instance of the SecurityRuleListResultPage type. +func NewSecurityRuleListResultPage(cur SecurityRuleListResult, getNextPage func(context.Context, SecurityRuleListResult) (SecurityRuleListResult, error)) SecurityRuleListResultPage { + return SecurityRuleListResultPage{ + fn: getNextPage, + srlr: cur, + } +} + +// SecurityRulePropertiesFormat security rule resource. +type SecurityRulePropertiesFormat struct { + // Description - A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Protocol - Network protocol this rule applies to. Possible values include: 'SecurityRuleProtocolTCP', 'SecurityRuleProtocolUDP', 'SecurityRuleProtocolIcmp', 'SecurityRuleProtocolEsp', 'SecurityRuleProtocolAsterisk', 'SecurityRuleProtocolAh' + Protocol SecurityRuleProtocol `json:"protocol,omitempty"` + // SourcePortRange - The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + SourcePortRange *string `json:"sourcePortRange,omitempty"` + // DestinationPortRange - The destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + // SourceAddressPrefix - The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is an ingress rule, specifies where network traffic originates from. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + // SourceAddressPrefixes - The CIDR or source IP ranges. + SourceAddressPrefixes *[]string `json:"sourceAddressPrefixes,omitempty"` + // SourceApplicationSecurityGroups - The application security group specified as source. + SourceApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"sourceApplicationSecurityGroups,omitempty"` + // DestinationAddressPrefix - The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + // DestinationAddressPrefixes - The destination address prefixes. CIDR or destination IP ranges. + DestinationAddressPrefixes *[]string `json:"destinationAddressPrefixes,omitempty"` + // DestinationApplicationSecurityGroups - The application security group specified as destination. + DestinationApplicationSecurityGroups *[]ApplicationSecurityGroup `json:"destinationApplicationSecurityGroups,omitempty"` + // SourcePortRanges - The source port ranges. + SourcePortRanges *[]string `json:"sourcePortRanges,omitempty"` + // DestinationPortRanges - The destination port ranges. + DestinationPortRanges *[]string `json:"destinationPortRanges,omitempty"` + // Access - The network traffic is allowed or denied. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + Access SecurityRuleAccess `json:"access,omitempty"` + // Priority - The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The lower the priority number, the higher the priority of the rule. + Priority *int32 `json:"priority,omitempty"` + // Direction - The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. Possible values include: 'SecurityRuleDirectionInbound', 'SecurityRuleDirectionOutbound' + Direction SecurityRuleDirection `json:"direction,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the security rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecurityRulePropertiesFormat. +func (srpf SecurityRulePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if srpf.Description != nil { + objectMap["description"] = srpf.Description + } + if srpf.Protocol != "" { + objectMap["protocol"] = srpf.Protocol + } + if srpf.SourcePortRange != nil { + objectMap["sourcePortRange"] = srpf.SourcePortRange + } + if srpf.DestinationPortRange != nil { + objectMap["destinationPortRange"] = srpf.DestinationPortRange + } + if srpf.SourceAddressPrefix != nil { + objectMap["sourceAddressPrefix"] = srpf.SourceAddressPrefix + } + if srpf.SourceAddressPrefixes != nil { + objectMap["sourceAddressPrefixes"] = srpf.SourceAddressPrefixes + } + if srpf.SourceApplicationSecurityGroups != nil { + objectMap["sourceApplicationSecurityGroups"] = srpf.SourceApplicationSecurityGroups + } + if srpf.DestinationAddressPrefix != nil { + objectMap["destinationAddressPrefix"] = srpf.DestinationAddressPrefix + } + if srpf.DestinationAddressPrefixes != nil { + objectMap["destinationAddressPrefixes"] = srpf.DestinationAddressPrefixes + } + if srpf.DestinationApplicationSecurityGroups != nil { + objectMap["destinationApplicationSecurityGroups"] = srpf.DestinationApplicationSecurityGroups + } + if srpf.SourcePortRanges != nil { + objectMap["sourcePortRanges"] = srpf.SourcePortRanges + } + if srpf.DestinationPortRanges != nil { + objectMap["destinationPortRanges"] = srpf.DestinationPortRanges + } + if srpf.Access != "" { + objectMap["access"] = srpf.Access + } + if srpf.Priority != nil { + objectMap["priority"] = srpf.Priority + } + if srpf.Direction != "" { + objectMap["direction"] = srpf.Direction + } + return json.Marshal(objectMap) +} + +// SecurityRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SecurityRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityRulesClient) (SecurityRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityRulesCreateOrUpdateFuture.Result. +func (future *SecurityRulesCreateOrUpdateFuture) result(client SecurityRulesClient) (sr SecurityRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sr.Response.Response, err = future.GetResult(sender); err == nil && sr.Response.Response.StatusCode != http.StatusNoContent { + sr, err = client.CreateOrUpdateResponder(sr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesCreateOrUpdateFuture", "Result", sr.Response.Response, "Failure responding to request") + } + } + return +} + +// SecurityRulesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SecurityRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SecurityRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SecurityRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SecurityRulesDeleteFuture.Result. +func (future *SecurityRulesDeleteFuture) result(client SecurityRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SecurityRulesDeleteFuture") + return + } + ar.Response = future.Response() + 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"` +} + +// ServiceAssociationLink serviceAssociationLink resource. +type ServiceAssociationLink struct { + // ServiceAssociationLinkPropertiesFormat - Resource navigation link properties format. + *ServiceAssociationLinkPropertiesFormat `json:"properties,omitempty"` + // Name - Name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLink. +func (sal ServiceAssociationLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sal.ServiceAssociationLinkPropertiesFormat != nil { + objectMap["properties"] = sal.ServiceAssociationLinkPropertiesFormat + } + if sal.Name != nil { + objectMap["name"] = sal.Name + } + if sal.ID != nil { + objectMap["id"] = sal.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceAssociationLink struct. +func (sal *ServiceAssociationLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceAssociationLinkPropertiesFormat ServiceAssociationLinkPropertiesFormat + err = json.Unmarshal(*v, &serviceAssociationLinkPropertiesFormat) + if err != nil { + return err + } + sal.ServiceAssociationLinkPropertiesFormat = &serviceAssociationLinkPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sal.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sal.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sal.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sal.ID = &ID + } + } + } + + return nil +} + +// ServiceAssociationLinkPropertiesFormat properties of ServiceAssociationLink. +type ServiceAssociationLinkPropertiesFormat struct { + // LinkedResourceType - Resource type of the linked resource. + LinkedResourceType *string `json:"linkedResourceType,omitempty"` + // Link - Link to the external resource. + Link *string `json:"link,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service association link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // AllowDelete - If true, the resource can be deleted. + AllowDelete *bool `json:"allowDelete,omitempty"` + // Locations - A list of locations. + Locations *[]string `json:"locations,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLinkPropertiesFormat. +func (salpf ServiceAssociationLinkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if salpf.LinkedResourceType != nil { + objectMap["linkedResourceType"] = salpf.LinkedResourceType + } + if salpf.Link != nil { + objectMap["link"] = salpf.Link + } + if salpf.AllowDelete != nil { + objectMap["allowDelete"] = salpf.AllowDelete + } + if salpf.Locations != nil { + objectMap["locations"] = salpf.Locations + } + return json.Marshal(objectMap) +} + +// ServiceAssociationLinksListResult response for ServiceAssociationLinks_List operation. +type ServiceAssociationLinksListResult struct { + autorest.Response `json:"-"` + // Value - The service association links in a subnet. + Value *[]ServiceAssociationLink `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceAssociationLinksListResult. +func (sallr ServiceAssociationLinksListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sallr.Value != nil { + objectMap["value"] = sallr.Value + } + return json.Marshal(objectMap) +} + +// ServiceDelegationPropertiesFormat properties of a service delegation. +type ServiceDelegationPropertiesFormat struct { + // ServiceName - The name of the service to whom the subnet should be delegated (e.g. Microsoft.Sql/servers). + ServiceName *string `json:"serviceName,omitempty"` + // Actions - READ-ONLY; The actions permitted to the service upon delegation. + Actions *[]string `json:"actions,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service delegation resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceDelegationPropertiesFormat. +func (sdpf ServiceDelegationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sdpf.ServiceName != nil { + objectMap["serviceName"] = sdpf.ServiceName + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPoliciesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServiceEndpointPoliciesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPoliciesClient) (ServiceEndpointPolicy, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPoliciesCreateOrUpdateFuture.Result. +func (future *ServiceEndpointPoliciesCreateOrUpdateFuture) result(client ServiceEndpointPoliciesClient) (sep ServiceEndpointPolicy, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sep.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sep.Response.Response, err = future.GetResult(sender); err == nil && sep.Response.Response.StatusCode != http.StatusNoContent { + sep, err = client.CreateOrUpdateResponder(sep.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesCreateOrUpdateFuture", "Result", sep.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceEndpointPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ServiceEndpointPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPoliciesDeleteFuture.Result. +func (future *ServiceEndpointPoliciesDeleteFuture) result(client ServiceEndpointPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceEndpointPolicy service End point policy resource. +type ServiceEndpointPolicy struct { + autorest.Response `json:"-"` + // ServiceEndpointPolicyPropertiesFormat - Properties of the service end point policy. + *ServiceEndpointPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Kind - READ-ONLY; Kind of service endpoint policy. This is metadata used for the Azure portal experience. + Kind *string `json:"kind,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicy. +func (sep ServiceEndpointPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sep.ServiceEndpointPolicyPropertiesFormat != nil { + objectMap["properties"] = sep.ServiceEndpointPolicyPropertiesFormat + } + if sep.ID != nil { + objectMap["id"] = sep.ID + } + if sep.Location != nil { + objectMap["location"] = sep.Location + } + if sep.Tags != nil { + objectMap["tags"] = sep.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicy struct. +func (sep *ServiceEndpointPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceEndpointPolicyPropertiesFormat ServiceEndpointPolicyPropertiesFormat + err = json.Unmarshal(*v, &serviceEndpointPolicyPropertiesFormat) + if err != nil { + return err + } + sep.ServiceEndpointPolicyPropertiesFormat = &serviceEndpointPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sep.Etag = &etag + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + sep.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sep.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sep.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sep.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + sep.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + sep.Tags = tags + } + } + } + + return nil +} + +// ServiceEndpointPolicyDefinition service Endpoint policy definitions. +type ServiceEndpointPolicyDefinition struct { + autorest.Response `json:"-"` + // ServiceEndpointPolicyDefinitionPropertiesFormat - Properties of the service endpoint policy definition. + *ServiceEndpointPolicyDefinitionPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - The type of the resource. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinition. +func (sepd ServiceEndpointPolicyDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepd.ServiceEndpointPolicyDefinitionPropertiesFormat != nil { + objectMap["properties"] = sepd.ServiceEndpointPolicyDefinitionPropertiesFormat + } + if sepd.Name != nil { + objectMap["name"] = sepd.Name + } + if sepd.Type != nil { + objectMap["type"] = sepd.Type + } + if sepd.ID != nil { + objectMap["id"] = sepd.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServiceEndpointPolicyDefinition struct. +func (sepd *ServiceEndpointPolicyDefinition) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var serviceEndpointPolicyDefinitionPropertiesFormat ServiceEndpointPolicyDefinitionPropertiesFormat + err = json.Unmarshal(*v, &serviceEndpointPolicyDefinitionPropertiesFormat) + if err != nil { + return err + } + sepd.ServiceEndpointPolicyDefinitionPropertiesFormat = &serviceEndpointPolicyDefinitionPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sepd.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + sepd.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sepd.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sepd.ID = &ID + } + } + } + + return nil +} + +// ServiceEndpointPolicyDefinitionListResult response for ListServiceEndpointPolicyDefinition API service +// call. Retrieves all service endpoint policy definition that belongs to a service endpoint policy. +type ServiceEndpointPolicyDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - The service endpoint policy definition in a service endpoint policy. + Value *[]ServiceEndpointPolicyDefinition `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ServiceEndpointPolicyDefinitionListResultIterator provides access to a complete listing of +// ServiceEndpointPolicyDefinition values. +type ServiceEndpointPolicyDefinitionListResultIterator struct { + i int + page ServiceEndpointPolicyDefinitionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceEndpointPolicyDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceEndpointPolicyDefinitionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) Response() ServiceEndpointPolicyDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceEndpointPolicyDefinitionListResultIterator) Value() ServiceEndpointPolicyDefinition { + if !iter.page.NotDone() { + return ServiceEndpointPolicyDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultIterator type. +func NewServiceEndpointPolicyDefinitionListResultIterator(page ServiceEndpointPolicyDefinitionListResultPage) ServiceEndpointPolicyDefinitionListResultIterator { + return ServiceEndpointPolicyDefinitionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) IsEmpty() bool { + return sepdlr.Value == nil || len(*sepdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) hasNextLink() bool { + return sepdlr.NextLink != nil && len(*sepdlr.NextLink) != 0 +} + +// serviceEndpointPolicyDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sepdlr ServiceEndpointPolicyDefinitionListResult) serviceEndpointPolicyDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !sepdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sepdlr.NextLink))) +} + +// ServiceEndpointPolicyDefinitionListResultPage contains a page of ServiceEndpointPolicyDefinition values. +type ServiceEndpointPolicyDefinitionListResultPage struct { + fn func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error) + sepdlr ServiceEndpointPolicyDefinitionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceEndpointPolicyDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sepdlr) + if err != nil { + return err + } + page.sepdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceEndpointPolicyDefinitionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceEndpointPolicyDefinitionListResultPage) NotDone() bool { + return !page.sepdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceEndpointPolicyDefinitionListResultPage) Response() ServiceEndpointPolicyDefinitionListResult { + return page.sepdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceEndpointPolicyDefinitionListResultPage) Values() []ServiceEndpointPolicyDefinition { + if page.sepdlr.IsEmpty() { + return nil + } + return *page.sepdlr.Value +} + +// Creates a new instance of the ServiceEndpointPolicyDefinitionListResultPage type. +func NewServiceEndpointPolicyDefinitionListResultPage(cur ServiceEndpointPolicyDefinitionListResult, getNextPage func(context.Context, ServiceEndpointPolicyDefinitionListResult) (ServiceEndpointPolicyDefinitionListResult, error)) ServiceEndpointPolicyDefinitionListResultPage { + return ServiceEndpointPolicyDefinitionListResultPage{ + fn: getNextPage, + sepdlr: cur, + } +} + +// ServiceEndpointPolicyDefinitionPropertiesFormat service Endpoint policy definition resource. +type ServiceEndpointPolicyDefinitionPropertiesFormat struct { + // Description - A description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + // Service - Service endpoint name. + Service *string `json:"service,omitempty"` + // ServiceResources - A list of service resources. + ServiceResources *[]string `json:"serviceResources,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy definition resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyDefinitionPropertiesFormat. +func (sepdpf ServiceEndpointPolicyDefinitionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepdpf.Description != nil { + objectMap["description"] = sepdpf.Description + } + if sepdpf.Service != nil { + objectMap["service"] = sepdpf.Service + } + if sepdpf.ServiceResources != nil { + objectMap["serviceResources"] = sepdpf.ServiceResources + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPolicyDefinitionsClient) (ServiceEndpointPolicyDefinition, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture.Result. +func (future *ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture) result(client ServiceEndpointPolicyDefinitionsClient) (sepd ServiceEndpointPolicyDefinition, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sepd.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sepd.Response.Response, err = future.GetResult(sender); err == nil && sepd.Response.Response.StatusCode != http.StatusNoContent { + sepd, err = client.CreateOrUpdateResponder(sepd.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture", "Result", sepd.Response.Response, "Failure responding to request") + } + } + return +} + +// ServiceEndpointPolicyDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type ServiceEndpointPolicyDefinitionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ServiceEndpointPolicyDefinitionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ServiceEndpointPolicyDefinitionsDeleteFuture.Result. +func (future *ServiceEndpointPolicyDefinitionsDeleteFuture) result(client ServiceEndpointPolicyDefinitionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.ServiceEndpointPolicyDefinitionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ServiceEndpointPolicyListResult response for ListServiceEndpointPolicies API service call. +type ServiceEndpointPolicyListResult struct { + autorest.Response `json:"-"` + // Value - A list of ServiceEndpointPolicy resources. + Value *[]ServiceEndpointPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyListResult. +func (seplr ServiceEndpointPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if seplr.Value != nil { + objectMap["value"] = seplr.Value + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPolicyListResultIterator provides access to a complete listing of ServiceEndpointPolicy +// values. +type ServiceEndpointPolicyListResultIterator struct { + i int + page ServiceEndpointPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceEndpointPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceEndpointPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceEndpointPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceEndpointPolicyListResultIterator) Response() ServiceEndpointPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceEndpointPolicyListResultIterator) Value() ServiceEndpointPolicy { + if !iter.page.NotDone() { + return ServiceEndpointPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceEndpointPolicyListResultIterator type. +func NewServiceEndpointPolicyListResultIterator(page ServiceEndpointPolicyListResultPage) ServiceEndpointPolicyListResultIterator { + return ServiceEndpointPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (seplr ServiceEndpointPolicyListResult) IsEmpty() bool { + return seplr.Value == nil || len(*seplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (seplr ServiceEndpointPolicyListResult) hasNextLink() bool { + return seplr.NextLink != nil && len(*seplr.NextLink) != 0 +} + +// serviceEndpointPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (seplr ServiceEndpointPolicyListResult) serviceEndpointPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !seplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(seplr.NextLink))) +} + +// ServiceEndpointPolicyListResultPage contains a page of ServiceEndpointPolicy values. +type ServiceEndpointPolicyListResultPage struct { + fn func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error) + seplr ServiceEndpointPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceEndpointPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.seplr) + if err != nil { + return err + } + page.seplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceEndpointPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceEndpointPolicyListResultPage) NotDone() bool { + return !page.seplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceEndpointPolicyListResultPage) Response() ServiceEndpointPolicyListResult { + return page.seplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceEndpointPolicyListResultPage) Values() []ServiceEndpointPolicy { + if page.seplr.IsEmpty() { + return nil + } + return *page.seplr.Value +} + +// Creates a new instance of the ServiceEndpointPolicyListResultPage type. +func NewServiceEndpointPolicyListResultPage(cur ServiceEndpointPolicyListResult, getNextPage func(context.Context, ServiceEndpointPolicyListResult) (ServiceEndpointPolicyListResult, error)) ServiceEndpointPolicyListResultPage { + return ServiceEndpointPolicyListResultPage{ + fn: getNextPage, + seplr: cur, + } +} + +// ServiceEndpointPolicyPropertiesFormat service Endpoint Policy resource. +type ServiceEndpointPolicyPropertiesFormat struct { + // ServiceEndpointPolicyDefinitions - A collection of service endpoint policy definitions of the service endpoint policy. + ServiceEndpointPolicyDefinitions *[]ServiceEndpointPolicyDefinition `json:"serviceEndpointPolicyDefinitions,omitempty"` + // Subnets - READ-ONLY; A collection of references to subnets. + Subnets *[]Subnet `json:"subnets,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the service endpoint policy resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ServiceAlias - The alias indicating if the policy belongs to a service + ServiceAlias *string `json:"serviceAlias,omitempty"` + // ContextualServiceEndpointPolicies - A collection of contextual service endpoint policy. + ContextualServiceEndpointPolicies *[]string `json:"contextualServiceEndpointPolicies,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPolicyPropertiesFormat. +func (seppf ServiceEndpointPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if seppf.ServiceEndpointPolicyDefinitions != nil { + objectMap["serviceEndpointPolicyDefinitions"] = seppf.ServiceEndpointPolicyDefinitions + } + if seppf.ServiceAlias != nil { + objectMap["serviceAlias"] = seppf.ServiceAlias + } + if seppf.ContextualServiceEndpointPolicies != nil { + objectMap["contextualServiceEndpointPolicies"] = seppf.ContextualServiceEndpointPolicies + } + return json.Marshal(objectMap) +} + +// ServiceEndpointPropertiesFormat the service endpoint properties. +type ServiceEndpointPropertiesFormat struct { + // Service - The type of the endpoint service. + Service *string `json:"service,omitempty"` + // Locations - A list of locations. + Locations *[]string `json:"locations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the service endpoint resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceEndpointPropertiesFormat. +func (sepf ServiceEndpointPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sepf.Service != nil { + objectMap["service"] = sepf.Service + } + if sepf.Locations != nil { + objectMap["locations"] = sepf.Locations + } + return json.Marshal(objectMap) +} + +// ServiceTagInformation the service tag information. +type ServiceTagInformation struct { + // Properties - READ-ONLY; Properties of the service tag information. + Properties *ServiceTagInformationPropertiesFormat `json:"properties,omitempty"` + // Name - READ-ONLY; The name of service tag. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The ID of service tag. + ID *string `json:"id,omitempty"` + // ServiceTagChangeNumber - READ-ONLY; The iteration number of service tag object for region. + ServiceTagChangeNumber *string `json:"serviceTagChangeNumber,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformation. +func (sti ServiceTagInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceTagInformationListResult response for Get ServiceTagInformation API service call. Retrieves the +// list of service tag information resources. +type ServiceTagInformationListResult struct { + autorest.Response `json:"-"` + // Value - The list of service tag information resources. + Value *[]ServiceTagInformation `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformationListResult. +func (stilr ServiceTagInformationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if stilr.Value != nil { + objectMap["value"] = stilr.Value + } + return json.Marshal(objectMap) +} + +// ServiceTagInformationListResultIterator provides access to a complete listing of ServiceTagInformation +// values. +type ServiceTagInformationListResultIterator struct { + i int + page ServiceTagInformationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ServiceTagInformationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ServiceTagInformationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ServiceTagInformationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ServiceTagInformationListResultIterator) Response() ServiceTagInformationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ServiceTagInformationListResultIterator) Value() ServiceTagInformation { + if !iter.page.NotDone() { + return ServiceTagInformation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ServiceTagInformationListResultIterator type. +func NewServiceTagInformationListResultIterator(page ServiceTagInformationListResultPage) ServiceTagInformationListResultIterator { + return ServiceTagInformationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (stilr ServiceTagInformationListResult) IsEmpty() bool { + return stilr.Value == nil || len(*stilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (stilr ServiceTagInformationListResult) hasNextLink() bool { + return stilr.NextLink != nil && len(*stilr.NextLink) != 0 +} + +// serviceTagInformationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (stilr ServiceTagInformationListResult) serviceTagInformationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !stilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(stilr.NextLink))) +} + +// ServiceTagInformationListResultPage contains a page of ServiceTagInformation values. +type ServiceTagInformationListResultPage struct { + fn func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error) + stilr ServiceTagInformationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ServiceTagInformationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.stilr) + if err != nil { + return err + } + page.stilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ServiceTagInformationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ServiceTagInformationListResultPage) NotDone() bool { + return !page.stilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ServiceTagInformationListResultPage) Response() ServiceTagInformationListResult { + return page.stilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ServiceTagInformationListResultPage) Values() []ServiceTagInformation { + if page.stilr.IsEmpty() { + return nil + } + return *page.stilr.Value +} + +// Creates a new instance of the ServiceTagInformationListResultPage type. +func NewServiceTagInformationListResultPage(cur ServiceTagInformationListResult, getNextPage func(context.Context, ServiceTagInformationListResult) (ServiceTagInformationListResult, error)) ServiceTagInformationListResultPage { + return ServiceTagInformationListResultPage{ + fn: getNextPage, + stilr: cur, + } +} + +// ServiceTagInformationPropertiesFormat properties of the service tag information. +type ServiceTagInformationPropertiesFormat struct { + // ChangeNumber - READ-ONLY; The iteration number of service tag. + ChangeNumber *string `json:"changeNumber,omitempty"` + // Region - READ-ONLY; The region of service tag. + Region *string `json:"region,omitempty"` + // SystemService - READ-ONLY; The name of system service. + SystemService *string `json:"systemService,omitempty"` + // AddressPrefixes - READ-ONLY; The list of IP address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // State - READ-ONLY; The state of the service tag. + State *string `json:"state,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagInformationPropertiesFormat. +func (stipf ServiceTagInformationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ServiceTagsListResult response for the ListServiceTags API service call. +type ServiceTagsListResult struct { + autorest.Response `json:"-"` + // Name - READ-ONLY; The name of the cloud. + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The ID of the cloud. + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; The azure resource type. + Type *string `json:"type,omitempty"` + // ChangeNumber - READ-ONLY; The iteration number. + ChangeNumber *string `json:"changeNumber,omitempty"` + // Cloud - READ-ONLY; The name of the cloud. + Cloud *string `json:"cloud,omitempty"` + // Values - READ-ONLY; The list of service tag information resources. + Values *[]ServiceTagInformation `json:"values,omitempty"` + // NextLink - READ-ONLY; The URL to get next page of service tag information resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceTagsListResult. +func (stlr ServiceTagsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SessionIds list of session IDs. +type SessionIds struct { + // SessionIds - List of session IDs. + SessionIds *[]string `json:"sessionIds,omitempty"` +} + +// SignatureOverridesFilterValuesQuery describes the filter values possibles for a given column +type SignatureOverridesFilterValuesQuery struct { + // FilterName - Describes the name of the column which values will be returned + FilterName *string `json:"filterName,omitempty"` +} + +// SignatureOverridesFilterValuesResponse describes the list of all possible values for a specific filter +// value +type SignatureOverridesFilterValuesResponse struct { + autorest.Response `json:"-"` + // FilterValues - Describes the possible values + FilterValues *[]string `json:"filterValues,omitempty"` +} + +// SignaturesOverrides contains all specific policy signatures overrides for the IDPS +type SignaturesOverrides struct { + autorest.Response `json:"-"` + // Name - Contains the name of the resource (default) + Name *string `json:"name,omitempty"` + // ID - Will contain the resource id of the signature override resource + ID *string `json:"id,omitempty"` + // Type - Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides + Type *string `json:"type,omitempty"` + // Properties - Will contain the properties of the resource (the actual signature overrides) + Properties *SignaturesOverridesProperties `json:"properties,omitempty"` +} + +// SignaturesOverridesList describes an object containing an array with a single item +type SignaturesOverridesList struct { + autorest.Response `json:"-"` + // Value - Describes a list consisting exactly one item describing the policy's signature override status + Value *[]SignaturesOverrides `json:"value,omitempty"` +} + +// SignaturesOverridesProperties will contain the properties of the resource (the actual signature +// overrides) +type SignaturesOverridesProperties struct { + Signatures map[string]*string `json:"signatures"` +} + +// MarshalJSON is the custom marshaler for SignaturesOverridesProperties. +func (so SignaturesOverridesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if so.Signatures != nil { + objectMap["signatures"] = so.Signatures + } + return json.Marshal(objectMap) +} + +// SingleQueryResult ... +type SingleQueryResult struct { + // SignatureID - The ID of the signature + SignatureID *int32 `json:"signatureId,omitempty"` + // Mode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny + Mode *int32 `json:"mode,omitempty"` + // Severity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High + Severity *int32 `json:"severity,omitempty"` + // Direction - Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional + Direction *int32 `json:"direction,omitempty"` + // Group - Describes the groups the signature belongs to + Group *string `json:"group,omitempty"` + // Description - Describes what is the signature enforces + Description *string `json:"description,omitempty"` + // Protocol - Describes the protocol the signatures is being enforced in + Protocol *string `json:"protocol,omitempty"` + // SourcePorts - Describes the list of source ports related to this signature + SourcePorts *[]string `json:"sourcePorts,omitempty"` + // DestinationPorts - Describes the list of destination ports related to this signature + DestinationPorts *[]string `json:"destinationPorts,omitempty"` + // LastUpdated - Describes the last updated time of the signature (provided from 3rd party vendor) + LastUpdated *string `json:"lastUpdated,omitempty"` + // InheritedFromParentPolicy - Describes if this override is inherited from base policy or not + InheritedFromParentPolicy *bool `json:"inheritedFromParentPolicy,omitempty"` +} + +// Sku the sku of this Bastion Host. +type Sku struct { + // Name - The name of this Bastion Host. Possible values include: 'BastionHostSkuNameBasic', 'BastionHostSkuNameStandard' + Name BastionHostSkuName `json:"name,omitempty"` +} + +// StaticRoute list of all Static Routes. +type StaticRoute struct { + // Name - The name of the StaticRoute that is unique within a VnetRoute. + Name *string `json:"name,omitempty"` + // AddressPrefixes - List of all address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHopIPAddress - The ip address of the next hop. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// String ... +type String struct { + autorest.Response `json:"-"` + Value *string `json:"value,omitempty"` +} + +// Subnet subnet in a virtual network resource. +type Subnet struct { + autorest.Response `json:"-"` + // SubnetPropertiesFormat - Properties of the subnet. + *SubnetPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for Subnet. +func (s Subnet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SubnetPropertiesFormat != nil { + objectMap["properties"] = s.SubnetPropertiesFormat + } + if s.Name != nil { + objectMap["name"] = s.Name + } + if s.Type != nil { + objectMap["type"] = s.Type + } + if s.ID != nil { + objectMap["id"] = s.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Subnet struct. +func (s *Subnet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var subnetPropertiesFormat SubnetPropertiesFormat + err = json.Unmarshal(*v, &subnetPropertiesFormat) + if err != nil { + return err + } + s.SubnetPropertiesFormat = &subnetPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + s.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + } + } + + return nil +} + +// SubnetAssociation subnet and it's custom security rules. +type SubnetAssociation struct { + // ID - READ-ONLY; Subnet ID. + ID *string `json:"id,omitempty"` + // SecurityRules - Collection of custom security rules. + SecurityRules *[]SecurityRule `json:"securityRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubnetAssociation. +func (sa SubnetAssociation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SecurityRules != nil { + objectMap["securityRules"] = sa.SecurityRules + } + return json.Marshal(objectMap) +} + +// SubnetListResult response for ListSubnets API service callRetrieves all subnet that belongs to a virtual +// network. +type SubnetListResult struct { + autorest.Response `json:"-"` + // Value - The subnets in a virtual network. + Value *[]Subnet `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// SubnetListResultIterator provides access to a complete listing of Subnet values. +type SubnetListResultIterator struct { + i int + page SubnetListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SubnetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SubnetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SubnetListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SubnetListResultIterator) Response() SubnetListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SubnetListResultIterator) Value() Subnet { + if !iter.page.NotDone() { + return Subnet{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SubnetListResultIterator type. +func NewSubnetListResultIterator(page SubnetListResultPage) SubnetListResultIterator { + return SubnetListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SubnetListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SubnetListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// subnetListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SubnetListResult) subnetListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SubnetListResultPage contains a page of Subnet values. +type SubnetListResultPage struct { + fn func(context.Context, SubnetListResult) (SubnetListResult, error) + slr SubnetListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SubnetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SubnetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SubnetListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SubnetListResultPage) Response() SubnetListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SubnetListResultPage) Values() []Subnet { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SubnetListResultPage type. +func NewSubnetListResultPage(cur SubnetListResult, getNextPage func(context.Context, SubnetListResult) (SubnetListResult, error)) SubnetListResultPage { + return SubnetListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SubnetPropertiesFormat properties of the subnet. +type SubnetPropertiesFormat struct { + // AddressPrefix - The address prefix for the subnet. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // AddressPrefixes - List of address prefixes for the subnet. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NetworkSecurityGroup - The reference to the NetworkSecurityGroup resource. + NetworkSecurityGroup *SecurityGroup `json:"networkSecurityGroup,omitempty"` + // RouteTable - The reference to the RouteTable resource. + RouteTable *RouteTable `json:"routeTable,omitempty"` + // NatGateway - Nat gateway associated with this subnet. + NatGateway *SubResource `json:"natGateway,omitempty"` + // ServiceEndpoints - An array of service endpoints. + ServiceEndpoints *[]ServiceEndpointPropertiesFormat `json:"serviceEndpoints,omitempty"` + // ServiceEndpointPolicies - An array of service endpoint policies. + ServiceEndpointPolicies *[]ServiceEndpointPolicy `json:"serviceEndpointPolicies,omitempty"` + // PrivateEndpoints - READ-ONLY; An array of references to private endpoints. + PrivateEndpoints *[]PrivateEndpoint `json:"privateEndpoints,omitempty"` + // IPConfigurations - READ-ONLY; An array of references to the network interface IP configurations using subnet. + IPConfigurations *[]IPConfiguration `json:"ipConfigurations,omitempty"` + // IPConfigurationProfiles - READ-ONLY; Array of IP configuration profiles which reference this subnet. + IPConfigurationProfiles *[]IPConfigurationProfile `json:"ipConfigurationProfiles,omitempty"` + // IPAllocations - Array of IpAllocation which reference this subnet. + IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` + // ResourceNavigationLinks - READ-ONLY; An array of references to the external resources using subnet. + ResourceNavigationLinks *[]ResourceNavigationLink `json:"resourceNavigationLinks,omitempty"` + // ServiceAssociationLinks - READ-ONLY; An array of references to services injecting into this subnet. + ServiceAssociationLinks *[]ServiceAssociationLink `json:"serviceAssociationLinks,omitempty"` + // Delegations - An array of references to the delegations on the subnet. + Delegations *[]Delegation `json:"delegations,omitempty"` + // Purpose - READ-ONLY; A read-only string identifying the intention of use for this subnet based on delegations and other user-defined properties. + Purpose *string `json:"purpose,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the subnet resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpointNetworkPolicies - Enable or Disable apply network policies on private end point in the subnet. Possible values include: 'VirtualNetworkPrivateEndpointNetworkPoliciesEnabled', 'VirtualNetworkPrivateEndpointNetworkPoliciesDisabled' + PrivateEndpointNetworkPolicies VirtualNetworkPrivateEndpointNetworkPolicies `json:"privateEndpointNetworkPolicies,omitempty"` + // PrivateLinkServiceNetworkPolicies - Enable or Disable apply network policies on private link service in the subnet. Possible values include: 'VirtualNetworkPrivateLinkServiceNetworkPoliciesEnabled', 'VirtualNetworkPrivateLinkServiceNetworkPoliciesDisabled' + PrivateLinkServiceNetworkPolicies VirtualNetworkPrivateLinkServiceNetworkPolicies `json:"privateLinkServiceNetworkPolicies,omitempty"` + // ApplicationGatewayIPConfigurations - Application gateway IP configurations of virtual network resource. + ApplicationGatewayIPConfigurations *[]ApplicationGatewayIPConfiguration `json:"applicationGatewayIpConfigurations,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubnetPropertiesFormat. +func (spf SubnetPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if spf.AddressPrefix != nil { + objectMap["addressPrefix"] = spf.AddressPrefix + } + if spf.AddressPrefixes != nil { + objectMap["addressPrefixes"] = spf.AddressPrefixes + } + if spf.NetworkSecurityGroup != nil { + objectMap["networkSecurityGroup"] = spf.NetworkSecurityGroup + } + if spf.RouteTable != nil { + objectMap["routeTable"] = spf.RouteTable + } + if spf.NatGateway != nil { + objectMap["natGateway"] = spf.NatGateway + } + if spf.ServiceEndpoints != nil { + objectMap["serviceEndpoints"] = spf.ServiceEndpoints + } + if spf.ServiceEndpointPolicies != nil { + objectMap["serviceEndpointPolicies"] = spf.ServiceEndpointPolicies + } + if spf.IPAllocations != nil { + objectMap["ipAllocations"] = spf.IPAllocations + } + if spf.Delegations != nil { + objectMap["delegations"] = spf.Delegations + } + if spf.PrivateEndpointNetworkPolicies != "" { + objectMap["privateEndpointNetworkPolicies"] = spf.PrivateEndpointNetworkPolicies + } + if spf.PrivateLinkServiceNetworkPolicies != "" { + objectMap["privateLinkServiceNetworkPolicies"] = spf.PrivateLinkServiceNetworkPolicies + } + if spf.ApplicationGatewayIPConfigurations != nil { + objectMap["applicationGatewayIpConfigurations"] = spf.ApplicationGatewayIPConfigurations + } + return json.Marshal(objectMap) +} + +// SubnetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubnetsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (Subnet, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsCreateOrUpdateFuture.Result. +func (future *SubnetsCreateOrUpdateFuture) result(client SubnetsClient) (s Subnet, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// SubnetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubnetsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsDeleteFuture.Result. +func (future *SubnetsDeleteFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SubnetsPrepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubnetsPrepareNetworkPoliciesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsPrepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsPrepareNetworkPoliciesFuture.Result. +func (future *SubnetsPrepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsPrepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsPrepareNetworkPoliciesFuture") + return + } + ar.Response = future.Response() + return +} + +// SubnetsUnprepareNetworkPoliciesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubnetsUnprepareNetworkPoliciesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubnetsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubnetsUnprepareNetworkPoliciesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SubnetsUnprepareNetworkPoliciesFuture.Result. +func (future *SubnetsUnprepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsUnprepareNetworkPoliciesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.SubnetsUnprepareNetworkPoliciesFuture") + return + } + ar.Response = future.Response() + return +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// Topology topology of the specified resource group. +type Topology struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; GUID representing the operation id. + ID *string `json:"id,omitempty"` + // CreatedDateTime - READ-ONLY; The datetime when the topology was initially created for the resource group. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // LastModified - READ-ONLY; The datetime when the topology was last modified. + LastModified *date.Time `json:"lastModified,omitempty"` + // Resources - A list of topology resources. + Resources *[]TopologyResource `json:"resources,omitempty"` +} + +// MarshalJSON is the custom marshaler for Topology. +func (t Topology) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if t.Resources != nil { + objectMap["resources"] = t.Resources + } + return json.Marshal(objectMap) +} + +// TopologyAssociation resources that have an association with the parent resource. +type TopologyAssociation struct { + // Name - The name of the resource that is associated with the parent resource. + Name *string `json:"name,omitempty"` + // ResourceID - The ID of the resource that is associated with the parent resource. + ResourceID *string `json:"resourceId,omitempty"` + // AssociationType - The association type of the child resource to the parent resource. Possible values include: 'AssociationTypeAssociated', 'AssociationTypeContains' + AssociationType AssociationType `json:"associationType,omitempty"` +} + +// TopologyParameters parameters that define the representation of topology. +type TopologyParameters struct { + // TargetResourceGroupName - The name of the target resource group to perform topology on. + TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"` + // TargetVirtualNetwork - The reference to the Virtual Network resource. + TargetVirtualNetwork *SubResource `json:"targetVirtualNetwork,omitempty"` + // TargetSubnet - The reference to the Subnet resource. + TargetSubnet *SubResource `json:"targetSubnet,omitempty"` +} + +// TopologyResource the network resource topology information for the given resource group. +type TopologyResource struct { + // Name - Name of the resource. + Name *string `json:"name,omitempty"` + // ID - ID of the resource. + ID *string `json:"id,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Associations - Holds the associations the resource has with other resources in the resource group. + Associations *[]TopologyAssociation `json:"associations,omitempty"` +} + +// TrafficAnalyticsConfigurationProperties parameters that define the configuration of traffic analytics. +type TrafficAnalyticsConfigurationProperties struct { + // Enabled - Flag to enable/disable traffic analytics. + Enabled *bool `json:"enabled,omitempty"` + // WorkspaceID - The resource guid of the attached workspace. + WorkspaceID *string `json:"workspaceId,omitempty"` + // WorkspaceRegion - The location of the attached workspace. + WorkspaceRegion *string `json:"workspaceRegion,omitempty"` + // WorkspaceResourceID - Resource Id of the attached workspace. + WorkspaceResourceID *string `json:"workspaceResourceId,omitempty"` + // TrafficAnalyticsInterval - The interval in minutes which would decide how frequently TA service should do flow analytics. + TrafficAnalyticsInterval *int32 `json:"trafficAnalyticsInterval,omitempty"` +} + +// TrafficAnalyticsProperties parameters that define the configuration of traffic analytics. +type TrafficAnalyticsProperties struct { + // NetworkWatcherFlowAnalyticsConfiguration - Parameters that define the configuration of traffic analytics. + NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` +} + +// TrafficSelectorPolicy an traffic selector policy for a virtual network gateway connection. +type TrafficSelectorPolicy struct { + // LocalAddressRanges - A collection of local address spaces in CIDR format. + LocalAddressRanges *[]string `json:"localAddressRanges,omitempty"` + // RemoteAddressRanges - A collection of remote address spaces in CIDR format. + RemoteAddressRanges *[]string `json:"remoteAddressRanges,omitempty"` +} + +// TroubleshootingDetails information gained from troubleshooting of specified resource. +type TroubleshootingDetails struct { + // ID - The id of the get troubleshoot operation. + ID *string `json:"id,omitempty"` + // ReasonType - Reason type of failure. + ReasonType *string `json:"reasonType,omitempty"` + // Summary - A summary of troubleshooting. + Summary *string `json:"summary,omitempty"` + // Detail - Details on troubleshooting results. + Detail *string `json:"detail,omitempty"` + // RecommendedActions - List of recommended actions. + RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"` +} + +// TroubleshootingParameters parameters that define the resource to troubleshoot. +type TroubleshootingParameters struct { + // TargetResourceID - The target resource to troubleshoot. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // TroubleshootingProperties - Properties of the troubleshooting resource. + *TroubleshootingProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for TroubleshootingParameters. +func (tp TroubleshootingParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tp.TargetResourceID != nil { + objectMap["targetResourceId"] = tp.TargetResourceID + } + if tp.TroubleshootingProperties != nil { + objectMap["properties"] = tp.TroubleshootingProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TroubleshootingParameters struct. +func (tp *TroubleshootingParameters) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "targetResourceId": + if v != nil { + var targetResourceID string + err = json.Unmarshal(*v, &targetResourceID) + if err != nil { + return err + } + tp.TargetResourceID = &targetResourceID + } + case "properties": + if v != nil { + var troubleshootingProperties TroubleshootingProperties + err = json.Unmarshal(*v, &troubleshootingProperties) + if err != nil { + return err + } + tp.TroubleshootingProperties = &troubleshootingProperties + } + } + } + + return nil +} + +// TroubleshootingProperties storage location provided for troubleshoot. +type TroubleshootingProperties struct { + // StorageID - The ID for the storage account to save the troubleshoot result. + StorageID *string `json:"storageId,omitempty"` + // StoragePath - The path to the blob to save the troubleshoot result in. + StoragePath *string `json:"storagePath,omitempty"` +} + +// TroubleshootingRecommendedActions recommended actions based on discovered issues. +type TroubleshootingRecommendedActions struct { + // ActionID - ID of the recommended action. + ActionID *string `json:"actionId,omitempty"` + // ActionText - Description of recommended actions. + ActionText *string `json:"actionText,omitempty"` + // ActionURI - The uri linking to a documentation for the recommended troubleshooting actions. + ActionURI *string `json:"actionUri,omitempty"` + // ActionURIText - The information from the URI for the recommended troubleshooting actions. + ActionURIText *string `json:"actionUriText,omitempty"` +} + +// TroubleshootingResult troubleshooting information gained from specified resource. +type TroubleshootingResult struct { + autorest.Response `json:"-"` + // StartTime - The start time of the troubleshooting. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - The end time of the troubleshooting. + EndTime *date.Time `json:"endTime,omitempty"` + // Code - The result code of the troubleshooting. + Code *string `json:"code,omitempty"` + // Results - Information from troubleshooting. + Results *[]TroubleshootingDetails `json:"results,omitempty"` +} + +// TunnelConnectionHealth virtualNetworkGatewayConnection properties. +type TunnelConnectionHealth struct { + // Tunnel - READ-ONLY; Tunnel name. + Tunnel *string `json:"tunnel,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // IngressBytesTransferred - READ-ONLY; The Ingress Bytes Transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; The Egress Bytes Transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // LastConnectionEstablishedUtcTime - READ-ONLY; The time at which connection was established in Utc format. + LastConnectionEstablishedUtcTime *string `json:"lastConnectionEstablishedUtcTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for TunnelConnectionHealth. +func (tch TunnelConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnprepareNetworkPoliciesRequest details of UnprepareNetworkPolicies for Subnet. +type UnprepareNetworkPoliciesRequest struct { + // ServiceName - The name of the service for which subnet is being unprepared for. + ServiceName *string `json:"serviceName,omitempty"` +} + +// Usage the network resource usage. +type Usage struct { + // ID - READ-ONLY; Resource identifier. + ID *string `json:"id,omitempty"` + // Unit - An enum describing the unit of measurement. + Unit *string `json:"unit,omitempty"` + // CurrentValue - The current value of the usage. + CurrentValue *int64 `json:"currentValue,omitempty"` + // Limit - The limit of usage. + Limit *int64 `json:"limit,omitempty"` + // Name - The name of the type of usage. + Name *UsageName `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for Usage. +func (u Usage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.Unit != nil { + objectMap["unit"] = u.Unit + } + if u.CurrentValue != nil { + objectMap["currentValue"] = u.CurrentValue + } + if u.Limit != nil { + objectMap["limit"] = u.Limit + } + if u.Name != nil { + objectMap["name"] = u.Name + } + return json.Marshal(objectMap) +} + +// UsageName the usage names. +type UsageName struct { + // Value - A string describing the resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - A localized string describing the resource name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// UsagesListResult the list usages operation response. +type UsagesListResult struct { + autorest.Response `json:"-"` + // Value - The list network resource usages. + Value *[]Usage `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UsagesListResultIterator provides access to a complete listing of Usage values. +type UsagesListResultIterator struct { + i int + page UsagesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UsagesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UsagesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UsagesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UsagesListResultIterator) Response() UsagesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UsagesListResultIterator) Value() Usage { + if !iter.page.NotDone() { + return Usage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UsagesListResultIterator type. +func NewUsagesListResultIterator(page UsagesListResultPage) UsagesListResultIterator { + return UsagesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ulr UsagesListResult) IsEmpty() bool { + return ulr.Value == nil || len(*ulr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ulr UsagesListResult) hasNextLink() bool { + return ulr.NextLink != nil && len(*ulr.NextLink) != 0 +} + +// usagesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ulr UsagesListResult) usagesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ulr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ulr.NextLink))) +} + +// UsagesListResultPage contains a page of Usage values. +type UsagesListResultPage struct { + fn func(context.Context, UsagesListResult) (UsagesListResult, error) + ulr UsagesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UsagesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ulr) + if err != nil { + return err + } + page.ulr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UsagesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UsagesListResultPage) NotDone() bool { + return !page.ulr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UsagesListResultPage) Response() UsagesListResult { + return page.ulr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UsagesListResultPage) Values() []Usage { + if page.ulr.IsEmpty() { + return nil + } + return *page.ulr.Value +} + +// Creates a new instance of the UsagesListResultPage type. +func NewUsagesListResultPage(cur UsagesListResult, getNextPage func(context.Context, UsagesListResult) (UsagesListResult, error)) UsagesListResultPage { + return UsagesListResultPage{ + fn: getNextPage, + ulr: cur, + } +} + +// VerificationIPFlowParameters parameters that define the IP flow to be verified. +type VerificationIPFlowParameters struct { + // TargetResourceID - The ID of the target resource to perform next-hop on. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // Direction - The direction of the packet represented as a 5-tuple. Possible values include: 'DirectionInbound', 'DirectionOutbound' + Direction Direction `json:"direction,omitempty"` + // Protocol - Protocol to be verified on. Possible values include: 'IPFlowProtocolTCP', 'IPFlowProtocolUDP' + Protocol IPFlowProtocol `json:"protocol,omitempty"` + // LocalPort - The local port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction. + LocalPort *string `json:"localPort,omitempty"` + // RemotePort - The remote port. Acceptable values are a single integer in the range (0-65535). Support for * for the source port, which depends on the direction. + RemotePort *string `json:"remotePort,omitempty"` + // LocalIPAddress - The local IP address. Acceptable values are valid IPv4 addresses. + LocalIPAddress *string `json:"localIPAddress,omitempty"` + // RemoteIPAddress - The remote IP address. Acceptable values are valid IPv4 addresses. + RemoteIPAddress *string `json:"remoteIPAddress,omitempty"` + // TargetNicResourceID - The NIC ID. (If VM has multiple NICs and IP forwarding is enabled on any of them, then this parameter must be specified. Otherwise optional). + TargetNicResourceID *string `json:"targetNicResourceId,omitempty"` +} + +// VerificationIPFlowResult results of IP flow verification on the target resource. +type VerificationIPFlowResult struct { + autorest.Response `json:"-"` + // Access - Indicates whether the traffic is allowed or denied. Possible values include: 'AccessAllow', 'AccessDeny' + Access Access `json:"access,omitempty"` + // RuleName - Name of the rule. If input is not matched against any security rule, it is not displayed. + RuleName *string `json:"ruleName,omitempty"` +} + +// VirtualAppliance networkVirtualAppliance Resource. +type VirtualAppliance struct { + autorest.Response `json:"-"` + // VirtualAppliancePropertiesFormat - Properties of the Network Virtual Appliance. + *VirtualAppliancePropertiesFormat `json:"properties,omitempty"` + // Identity - The service principal that has read access to cloud-init and config blob. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualAppliance. +func (va VirtualAppliance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if va.VirtualAppliancePropertiesFormat != nil { + objectMap["properties"] = va.VirtualAppliancePropertiesFormat + } + if va.Identity != nil { + objectMap["identity"] = va.Identity + } + if va.ID != nil { + objectMap["id"] = va.ID + } + if va.Location != nil { + objectMap["location"] = va.Location + } + if va.Tags != nil { + objectMap["tags"] = va.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualAppliance struct. +func (va *VirtualAppliance) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualAppliancePropertiesFormat VirtualAppliancePropertiesFormat + err = json.Unmarshal(*v, &virtualAppliancePropertiesFormat) + if err != nil { + return err + } + va.VirtualAppliancePropertiesFormat = &virtualAppliancePropertiesFormat + } + case "identity": + if v != nil { + var identity ManagedServiceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + va.Identity = &identity + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + va.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + va.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + va.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + va.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + va.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + va.Tags = tags + } + } + } + + return nil +} + +// VirtualApplianceListResult response for ListNetworkVirtualAppliances API service call. +type VirtualApplianceListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliances. + Value *[]VirtualAppliance `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceListResultIterator provides access to a complete listing of VirtualAppliance values. +type VirtualApplianceListResultIterator struct { + i int + page VirtualApplianceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceListResultIterator) Response() VirtualApplianceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceListResultIterator) Value() VirtualAppliance { + if !iter.page.NotDone() { + return VirtualAppliance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceListResultIterator type. +func NewVirtualApplianceListResultIterator(page VirtualApplianceListResultPage) VirtualApplianceListResultIterator { + return VirtualApplianceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (valr VirtualApplianceListResult) IsEmpty() bool { + return valr.Value == nil || len(*valr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (valr VirtualApplianceListResult) hasNextLink() bool { + return valr.NextLink != nil && len(*valr.NextLink) != 0 +} + +// virtualApplianceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (valr VirtualApplianceListResult) virtualApplianceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !valr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(valr.NextLink))) +} + +// VirtualApplianceListResultPage contains a page of VirtualAppliance values. +type VirtualApplianceListResultPage struct { + fn func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error) + valr VirtualApplianceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.valr) + if err != nil { + return err + } + page.valr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceListResultPage) NotDone() bool { + return !page.valr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceListResultPage) Response() VirtualApplianceListResult { + return page.valr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceListResultPage) Values() []VirtualAppliance { + if page.valr.IsEmpty() { + return nil + } + return *page.valr.Value +} + +// Creates a new instance of the VirtualApplianceListResultPage type. +func NewVirtualApplianceListResultPage(cur VirtualApplianceListResult, getNextPage func(context.Context, VirtualApplianceListResult) (VirtualApplianceListResult, error)) VirtualApplianceListResultPage { + return VirtualApplianceListResultPage{ + fn: getNextPage, + valr: cur, + } +} + +// VirtualApplianceNicProperties network Virtual Appliance NIC properties. +type VirtualApplianceNicProperties struct { + // Name - READ-ONLY; NIC name. + Name *string `json:"name,omitempty"` + // PublicIPAddress - READ-ONLY; Public IP address. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP address. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceNicProperties. +func (vanp VirtualApplianceNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualAppliancePropertiesFormat network Virtual Appliance definition. +type VirtualAppliancePropertiesFormat struct { + // NvaSku - Network Virtual Appliance SKU. + NvaSku *VirtualApplianceSkuProperties `json:"nvaSku,omitempty"` + // AddressPrefix - READ-ONLY; Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // BootStrapConfigurationBlobs - BootStrapConfigurationBlobs storage URLs. + BootStrapConfigurationBlobs *[]string `json:"bootStrapConfigurationBlobs,omitempty"` + // VirtualHub - The Virtual Hub where Network Virtual Appliance is being deployed. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // CloudInitConfigurationBlobs - CloudInitConfigurationBlob storage URLs. + CloudInitConfigurationBlobs *[]string `json:"cloudInitConfigurationBlobs,omitempty"` + // CloudInitConfiguration - CloudInitConfiguration string in plain text. + CloudInitConfiguration *string `json:"cloudInitConfiguration,omitempty"` + // VirtualApplianceAsn - VirtualAppliance ASN. + VirtualApplianceAsn *int64 `json:"virtualApplianceAsn,omitempty"` + // SSHPublicKey - Public key for SSH login. + SSHPublicKey *string `json:"sshPublicKey,omitempty"` + // VirtualApplianceNics - READ-ONLY; List of Virtual Appliance Network Interfaces. + VirtualApplianceNics *[]VirtualApplianceNicProperties `json:"virtualApplianceNics,omitempty"` + // VirtualApplianceSites - READ-ONLY; List of references to VirtualApplianceSite. + VirtualApplianceSites *[]SubResource `json:"virtualApplianceSites,omitempty"` + // InboundSecurityRules - READ-ONLY; List of references to InboundSecurityRules. + InboundSecurityRules *[]SubResource `json:"inboundSecurityRules,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualAppliancePropertiesFormat. +func (vapf VirtualAppliancePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vapf.NvaSku != nil { + objectMap["nvaSku"] = vapf.NvaSku + } + if vapf.BootStrapConfigurationBlobs != nil { + objectMap["bootStrapConfigurationBlobs"] = vapf.BootStrapConfigurationBlobs + } + if vapf.VirtualHub != nil { + objectMap["virtualHub"] = vapf.VirtualHub + } + if vapf.CloudInitConfigurationBlobs != nil { + objectMap["cloudInitConfigurationBlobs"] = vapf.CloudInitConfigurationBlobs + } + if vapf.CloudInitConfiguration != nil { + objectMap["cloudInitConfiguration"] = vapf.CloudInitConfiguration + } + if vapf.VirtualApplianceAsn != nil { + objectMap["virtualApplianceAsn"] = vapf.VirtualApplianceAsn + } + if vapf.SSHPublicKey != nil { + objectMap["sshPublicKey"] = vapf.SSHPublicKey + } + return json.Marshal(objectMap) +} + +// VirtualAppliancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualAppliancesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualAppliancesClient) (VirtualAppliance, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualAppliancesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualAppliancesCreateOrUpdateFuture.Result. +func (future *VirtualAppliancesCreateOrUpdateFuture) result(client VirtualAppliancesClient) (va VirtualAppliance, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + va.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if va.Response.Response, err = future.GetResult(sender); err == nil && va.Response.Response.StatusCode != http.StatusNoContent { + va, err = client.CreateOrUpdateResponder(va.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesCreateOrUpdateFuture", "Result", va.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualAppliancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualAppliancesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualAppliancesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualAppliancesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualAppliancesDeleteFuture.Result. +func (future *VirtualAppliancesDeleteFuture) result(client VirtualAppliancesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualAppliancesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualApplianceSite virtual Appliance Site resource. +type VirtualApplianceSite struct { + autorest.Response `json:"-"` + // VirtualApplianceSiteProperties - The properties of the Virtual Appliance Sites. + *VirtualApplianceSiteProperties `json:"properties,omitempty"` + // Name - Name of the virtual appliance site. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Site type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSite. +func (vas VirtualApplianceSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vas.VirtualApplianceSiteProperties != nil { + objectMap["properties"] = vas.VirtualApplianceSiteProperties + } + if vas.Name != nil { + objectMap["name"] = vas.Name + } + if vas.ID != nil { + objectMap["id"] = vas.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSite struct. +func (vas *VirtualApplianceSite) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualApplianceSiteProperties VirtualApplianceSiteProperties + err = json.Unmarshal(*v, &virtualApplianceSiteProperties) + if err != nil { + return err + } + vas.VirtualApplianceSiteProperties = &virtualApplianceSiteProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vas.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vas.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vas.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vas.ID = &ID + } + } + } + + return nil +} + +// VirtualApplianceSiteListResult response for ListNetworkVirtualApplianceSites API service call. +type VirtualApplianceSiteListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliance sites. + Value *[]VirtualApplianceSite `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceSiteListResultIterator provides access to a complete listing of VirtualApplianceSite +// values. +type VirtualApplianceSiteListResultIterator struct { + i int + page VirtualApplianceSiteListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceSiteListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceSiteListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceSiteListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceSiteListResultIterator) Response() VirtualApplianceSiteListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceSiteListResultIterator) Value() VirtualApplianceSite { + if !iter.page.NotDone() { + return VirtualApplianceSite{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceSiteListResultIterator type. +func NewVirtualApplianceSiteListResultIterator(page VirtualApplianceSiteListResultPage) VirtualApplianceSiteListResultIterator { + return VirtualApplianceSiteListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vaslr VirtualApplianceSiteListResult) IsEmpty() bool { + return vaslr.Value == nil || len(*vaslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vaslr VirtualApplianceSiteListResult) hasNextLink() bool { + return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 +} + +// virtualApplianceSiteListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vaslr VirtualApplianceSiteListResult) virtualApplianceSiteListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vaslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vaslr.NextLink))) +} + +// VirtualApplianceSiteListResultPage contains a page of VirtualApplianceSite values. +type VirtualApplianceSiteListResultPage struct { + fn func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error) + vaslr VirtualApplianceSiteListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceSiteListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSiteListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vaslr) + if err != nil { + return err + } + page.vaslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceSiteListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceSiteListResultPage) NotDone() bool { + return !page.vaslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceSiteListResultPage) Response() VirtualApplianceSiteListResult { + return page.vaslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceSiteListResultPage) Values() []VirtualApplianceSite { + if page.vaslr.IsEmpty() { + return nil + } + return *page.vaslr.Value +} + +// Creates a new instance of the VirtualApplianceSiteListResultPage type. +func NewVirtualApplianceSiteListResultPage(cur VirtualApplianceSiteListResult, getNextPage func(context.Context, VirtualApplianceSiteListResult) (VirtualApplianceSiteListResult, error)) VirtualApplianceSiteListResultPage { + return VirtualApplianceSiteListResultPage{ + fn: getNextPage, + vaslr: cur, + } +} + +// VirtualApplianceSiteProperties properties of the rule group. +type VirtualApplianceSiteProperties struct { + // AddressPrefix - Address Prefix. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // O365Policy - Office 365 Policy. + O365Policy *Office365PolicyProperties `json:"o365Policy,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSiteProperties. +func (vasp VirtualApplianceSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vasp.AddressPrefix != nil { + objectMap["addressPrefix"] = vasp.AddressPrefix + } + if vasp.O365Policy != nil { + objectMap["o365Policy"] = vasp.O365Policy + } + return json.Marshal(objectMap) +} + +// VirtualApplianceSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualApplianceSitesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualApplianceSitesClient) (VirtualApplianceSite, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualApplianceSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualApplianceSitesCreateOrUpdateFuture.Result. +func (future *VirtualApplianceSitesCreateOrUpdateFuture) result(client VirtualApplianceSitesClient) (vas VirtualApplianceSite, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vas.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vas.Response.Response, err = future.GetResult(sender); err == nil && vas.Response.Response.StatusCode != http.StatusNoContent { + vas, err = client.CreateOrUpdateResponder(vas.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesCreateOrUpdateFuture", "Result", vas.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualApplianceSitesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualApplianceSitesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualApplianceSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualApplianceSitesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualApplianceSitesDeleteFuture.Result. +func (future *VirtualApplianceSitesDeleteFuture) result(client VirtualApplianceSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualApplianceSitesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualApplianceSku definition of the NetworkVirtualApplianceSkus resource. +type VirtualApplianceSku struct { + autorest.Response `json:"-"` + // VirtualApplianceSkuPropertiesFormat - NetworkVirtualApplianceSku properties. + *VirtualApplianceSkuPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSku. +func (vas VirtualApplianceSku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vas.VirtualApplianceSkuPropertiesFormat != nil { + objectMap["properties"] = vas.VirtualApplianceSkuPropertiesFormat + } + if vas.ID != nil { + objectMap["id"] = vas.ID + } + if vas.Location != nil { + objectMap["location"] = vas.Location + } + if vas.Tags != nil { + objectMap["tags"] = vas.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualApplianceSku struct. +func (vas *VirtualApplianceSku) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualApplianceSkuPropertiesFormat VirtualApplianceSkuPropertiesFormat + err = json.Unmarshal(*v, &virtualApplianceSkuPropertiesFormat) + if err != nil { + return err + } + vas.VirtualApplianceSkuPropertiesFormat = &virtualApplianceSkuPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vas.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vas.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vas.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vas.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vas.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vas.Tags = tags + } + } + } + + return nil +} + +// VirtualApplianceSkuInstances list of available Sku and instances. +type VirtualApplianceSkuInstances struct { + // ScaleUnit - READ-ONLY; Scale Unit. + ScaleUnit *string `json:"scaleUnit,omitempty"` + // InstanceCount - READ-ONLY; Instance Count. + InstanceCount *int32 `json:"instanceCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSkuInstances. +func (vasi VirtualApplianceSkuInstances) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualApplianceSkuListResult response for ListNetworkVirtualApplianceSkus API service call. +type VirtualApplianceSkuListResult struct { + autorest.Response `json:"-"` + // Value - List of Network Virtual Appliance Skus that are available. + Value *[]VirtualApplianceSku `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualApplianceSkuListResultIterator provides access to a complete listing of VirtualApplianceSku +// values. +type VirtualApplianceSkuListResultIterator struct { + i int + page VirtualApplianceSkuListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualApplianceSkuListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualApplianceSkuListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualApplianceSkuListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualApplianceSkuListResultIterator) Response() VirtualApplianceSkuListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualApplianceSkuListResultIterator) Value() VirtualApplianceSku { + if !iter.page.NotDone() { + return VirtualApplianceSku{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualApplianceSkuListResultIterator type. +func NewVirtualApplianceSkuListResultIterator(page VirtualApplianceSkuListResultPage) VirtualApplianceSkuListResultIterator { + return VirtualApplianceSkuListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vaslr VirtualApplianceSkuListResult) IsEmpty() bool { + return vaslr.Value == nil || len(*vaslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vaslr VirtualApplianceSkuListResult) hasNextLink() bool { + return vaslr.NextLink != nil && len(*vaslr.NextLink) != 0 +} + +// virtualApplianceSkuListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vaslr VirtualApplianceSkuListResult) virtualApplianceSkuListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vaslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vaslr.NextLink))) +} + +// VirtualApplianceSkuListResultPage contains a page of VirtualApplianceSku values. +type VirtualApplianceSkuListResultPage struct { + fn func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error) + vaslr VirtualApplianceSkuListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualApplianceSkuListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkuListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vaslr) + if err != nil { + return err + } + page.vaslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualApplianceSkuListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualApplianceSkuListResultPage) NotDone() bool { + return !page.vaslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualApplianceSkuListResultPage) Response() VirtualApplianceSkuListResult { + return page.vaslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualApplianceSkuListResultPage) Values() []VirtualApplianceSku { + if page.vaslr.IsEmpty() { + return nil + } + return *page.vaslr.Value +} + +// Creates a new instance of the VirtualApplianceSkuListResultPage type. +func NewVirtualApplianceSkuListResultPage(cur VirtualApplianceSkuListResult, getNextPage func(context.Context, VirtualApplianceSkuListResult) (VirtualApplianceSkuListResult, error)) VirtualApplianceSkuListResultPage { + return VirtualApplianceSkuListResultPage{ + fn: getNextPage, + vaslr: cur, + } +} + +// VirtualApplianceSkuProperties network Virtual Appliance Sku Properties. +type VirtualApplianceSkuProperties struct { + // Vendor - Virtual Appliance Vendor. + Vendor *string `json:"vendor,omitempty"` + // BundledScaleUnit - Virtual Appliance Scale Unit. + BundledScaleUnit *string `json:"bundledScaleUnit,omitempty"` + // MarketPlaceVersion - Virtual Appliance Version. + MarketPlaceVersion *string `json:"marketPlaceVersion,omitempty"` +} + +// VirtualApplianceSkuPropertiesFormat properties specific to NetworkVirtualApplianceSkus. +type VirtualApplianceSkuPropertiesFormat struct { + // Vendor - READ-ONLY; Network Virtual Appliance Sku vendor. + Vendor *string `json:"vendor,omitempty"` + // AvailableVersions - READ-ONLY; Available Network Virtual Appliance versions. + AvailableVersions *[]string `json:"availableVersions,omitempty"` + // AvailableScaleUnits - The list of scale units available. + AvailableScaleUnits *[]VirtualApplianceSkuInstances `json:"availableScaleUnits,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualApplianceSkuPropertiesFormat. +func (vaspf VirtualApplianceSkuPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vaspf.AvailableScaleUnits != nil { + objectMap["availableScaleUnits"] = vaspf.AvailableScaleUnits + } + return json.Marshal(objectMap) +} + +// VirtualHub virtualHub Resource. +type VirtualHub struct { + autorest.Response `json:"-"` + // VirtualHubProperties - Properties of the virtual hub. + *VirtualHubProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Kind - READ-ONLY; Kind of service virtual hub. This is metadata used for the Azure portal experience for Route Server. + Kind *string `json:"kind,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualHub. +func (vh VirtualHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vh.VirtualHubProperties != nil { + objectMap["properties"] = vh.VirtualHubProperties + } + if vh.ID != nil { + objectMap["id"] = vh.ID + } + if vh.Location != nil { + objectMap["location"] = vh.Location + } + if vh.Tags != nil { + objectMap["tags"] = vh.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualHub struct. +func (vh *VirtualHub) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualHubProperties VirtualHubProperties + err = json.Unmarshal(*v, &virtualHubProperties) + if err != nil { + return err + } + vh.VirtualHubProperties = &virtualHubProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vh.Etag = &etag + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + vh.Kind = &kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vh.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vh.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vh.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vh.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vh.Tags = tags + } + } + } + + return nil +} + +// VirtualHubBgpConnectionCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualHubBgpConnectionCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionClient) (BgpConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionCreateOrUpdateFuture.Result. +func (future *VirtualHubBgpConnectionCreateOrUpdateFuture) result(client VirtualHubBgpConnectionClient) (bc BgpConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bc.Response.Response, err = future.GetResult(sender); err == nil && bc.Response.Response.StatusCode != http.StatusNoContent { + bc, err = client.CreateOrUpdateResponder(bc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionCreateOrUpdateFuture", "Result", bc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubBgpConnectionDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubBgpConnectionDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionDeleteFuture.Result. +func (future *VirtualHubBgpConnectionDeleteFuture) result(client VirtualHubBgpConnectionClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubBgpConnectionsListAdvertisedRoutesFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualHubBgpConnectionsListAdvertisedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionsListAdvertisedRoutesFuture.Result. +func (future *VirtualHubBgpConnectionsListAdvertisedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + prl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { + prl, err = client.ListAdvertisedRoutesResponder(prl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubBgpConnectionsListLearnedRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubBgpConnectionsListLearnedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubBgpConnectionsClient) (PeerRouteList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubBgpConnectionsListLearnedRoutesFuture.Result. +func (future *VirtualHubBgpConnectionsListLearnedRoutesFuture) result(client VirtualHubBgpConnectionsClient) (prl PeerRouteList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + prl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubBgpConnectionsListLearnedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if prl.Response.Response, err = future.GetResult(sender); err == nil && prl.Response.Response.StatusCode != http.StatusNoContent { + prl, err = client.ListLearnedRoutesResponder(prl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsListLearnedRoutesFuture", "Result", prl.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubEffectiveRoute the effective route configured on the virtual hub or specified resource. +type VirtualHubEffectiveRoute struct { + // AddressPrefixes - The list of address prefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHops - The list of next hops. + NextHops *[]string `json:"nextHops,omitempty"` + // NextHopType - The type of the next hop. + NextHopType *string `json:"nextHopType,omitempty"` + // AsPath - The ASPath of this route. + AsPath *string `json:"asPath,omitempty"` + // RouteOrigin - The origin of this route. + RouteOrigin *string `json:"routeOrigin,omitempty"` +} + +// VirtualHubEffectiveRouteList effectiveRoutes List. +type VirtualHubEffectiveRouteList struct { + // Value - The list of effective routes configured on the virtual hub or the specified resource. + Value *[]VirtualHubEffectiveRoute `json:"value,omitempty"` +} + +// VirtualHubID virtual Hub identifier. +type VirtualHubID struct { + // ID - The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same subscription. + ID *string `json:"id,omitempty"` +} + +// VirtualHubIPConfigurationCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubIPConfigurationCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubIPConfigurationClient) (HubIPConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubIPConfigurationCreateOrUpdateFuture.Result. +func (future *VirtualHubIPConfigurationCreateOrUpdateFuture) result(client VirtualHubIPConfigurationClient) (hic HubIPConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + hic.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if hic.Response.Response, err = future.GetResult(sender); err == nil && hic.Response.Response.StatusCode != http.StatusNoContent { + hic, err = client.CreateOrUpdateResponder(hic.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationCreateOrUpdateFuture", "Result", hic.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubIPConfigurationDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubIPConfigurationDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubIPConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubIPConfigurationDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubIPConfigurationDeleteFuture.Result. +func (future *VirtualHubIPConfigurationDeleteFuture) result(client VirtualHubIPConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubIPConfigurationDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubProperties parameters for VirtualHub. +type VirtualHubProperties struct { + // VirtualWan - The VirtualWAN to which the VirtualHub belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + // VpnGateway - The VpnGateway associated with this VirtualHub. + VpnGateway *SubResource `json:"vpnGateway,omitempty"` + // P2SVpnGateway - The P2SVpnGateway associated with this VirtualHub. + P2SVpnGateway *SubResource `json:"p2SVpnGateway,omitempty"` + // ExpressRouteGateway - The expressRouteGateway associated with this VirtualHub. + ExpressRouteGateway *SubResource `json:"expressRouteGateway,omitempty"` + // AzureFirewall - The azureFirewall associated with this VirtualHub. + AzureFirewall *SubResource `json:"azureFirewall,omitempty"` + // SecurityPartnerProvider - The securityPartnerProvider associated with this VirtualHub. + SecurityPartnerProvider *SubResource `json:"securityPartnerProvider,omitempty"` + // AddressPrefix - Address-prefix for this VirtualHub. + AddressPrefix *string `json:"addressPrefix,omitempty"` + // RouteTable - The routeTable associated with this virtual hub. + RouteTable *VirtualHubRouteTable `json:"routeTable,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // SecurityProviderName - The Security Provider name. + SecurityProviderName *string `json:"securityProviderName,omitempty"` + // VirtualHubRouteTableV2s - List of all virtual hub route table v2s associated with this VirtualHub. + VirtualHubRouteTableV2s *[]VirtualHubRouteTableV2 `json:"virtualHubRouteTableV2s,omitempty"` + // Sku - The sku of this VirtualHub. + Sku *string `json:"sku,omitempty"` + // RoutingState - The routing state. Possible values include: 'RoutingStateNone', 'RoutingStateProvisioned', 'RoutingStateProvisioning', 'RoutingStateFailed' + RoutingState RoutingState `json:"routingState,omitempty"` + // BgpConnections - READ-ONLY; List of references to Bgp Connections. + BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` + // IPConfigurations - READ-ONLY; List of references to IpConfigurations. + IPConfigurations *[]SubResource `json:"ipConfigurations,omitempty"` + // VirtualRouterAsn - VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + // VirtualRouterIps - VirtualRouter IPs. + VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` + // AllowBranchToBranchTraffic - Flag to control transit for VirtualRouter hub. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + // PreferredRoutingGateway - The preferred gateway to route on-prem traffic. Possible values include: 'PreferredRoutingGatewayExpressRoute', 'PreferredRoutingGatewayVpnGateway', 'PreferredRoutingGatewayNone' + PreferredRoutingGateway PreferredRoutingGateway `json:"preferredRoutingGateway,omitempty"` + // HubRoutingPreference - The hubRoutingPreference of this VirtualHub. Possible values include: 'HubRoutingPreferenceExpressRoute', 'HubRoutingPreferenceVpnGateway', 'HubRoutingPreferenceASPath' + HubRoutingPreference HubRoutingPreference `json:"hubRoutingPreference,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubProperties. +func (vhp VirtualHubProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhp.VirtualWan != nil { + objectMap["virtualWan"] = vhp.VirtualWan + } + if vhp.VpnGateway != nil { + objectMap["vpnGateway"] = vhp.VpnGateway + } + if vhp.P2SVpnGateway != nil { + objectMap["p2SVpnGateway"] = vhp.P2SVpnGateway + } + if vhp.ExpressRouteGateway != nil { + objectMap["expressRouteGateway"] = vhp.ExpressRouteGateway + } + if vhp.AzureFirewall != nil { + objectMap["azureFirewall"] = vhp.AzureFirewall + } + if vhp.SecurityPartnerProvider != nil { + objectMap["securityPartnerProvider"] = vhp.SecurityPartnerProvider + } + if vhp.AddressPrefix != nil { + objectMap["addressPrefix"] = vhp.AddressPrefix + } + if vhp.RouteTable != nil { + objectMap["routeTable"] = vhp.RouteTable + } + if vhp.SecurityProviderName != nil { + objectMap["securityProviderName"] = vhp.SecurityProviderName + } + if vhp.VirtualHubRouteTableV2s != nil { + objectMap["virtualHubRouteTableV2s"] = vhp.VirtualHubRouteTableV2s + } + if vhp.Sku != nil { + objectMap["sku"] = vhp.Sku + } + if vhp.RoutingState != "" { + objectMap["routingState"] = vhp.RoutingState + } + if vhp.VirtualRouterAsn != nil { + objectMap["virtualRouterAsn"] = vhp.VirtualRouterAsn + } + if vhp.VirtualRouterIps != nil { + objectMap["virtualRouterIps"] = vhp.VirtualRouterIps + } + if vhp.AllowBranchToBranchTraffic != nil { + objectMap["allowBranchToBranchTraffic"] = vhp.AllowBranchToBranchTraffic + } + if vhp.PreferredRoutingGateway != "" { + objectMap["preferredRoutingGateway"] = vhp.PreferredRoutingGateway + } + if vhp.HubRoutingPreference != "" { + objectMap["hubRoutingPreference"] = vhp.HubRoutingPreference + } + return json.Marshal(objectMap) +} + +// VirtualHubRoute virtualHub route. +type VirtualHubRoute struct { + // AddressPrefixes - List of all addressPrefixes. + AddressPrefixes *[]string `json:"addressPrefixes,omitempty"` + // NextHopIPAddress - NextHop ip address. + NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"` +} + +// VirtualHubRouteTable virtualHub route table. +type VirtualHubRouteTable struct { + // Routes - List of all routes. + Routes *[]VirtualHubRoute `json:"routes,omitempty"` +} + +// VirtualHubRouteTableV2 virtualHubRouteTableV2 Resource. +type VirtualHubRouteTableV2 struct { + autorest.Response `json:"-"` + // VirtualHubRouteTableV2Properties - Properties of the virtual hub route table v2. + *VirtualHubRouteTableV2Properties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2. +func (vhrtv VirtualHubRouteTableV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhrtv.VirtualHubRouteTableV2Properties != nil { + objectMap["properties"] = vhrtv.VirtualHubRouteTableV2Properties + } + if vhrtv.Name != nil { + objectMap["name"] = vhrtv.Name + } + if vhrtv.ID != nil { + objectMap["id"] = vhrtv.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualHubRouteTableV2 struct. +func (vhrtv *VirtualHubRouteTableV2) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualHubRouteTableV2Properties VirtualHubRouteTableV2Properties + err = json.Unmarshal(*v, &virtualHubRouteTableV2Properties) + if err != nil { + return err + } + vhrtv.VirtualHubRouteTableV2Properties = &virtualHubRouteTableV2Properties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vhrtv.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vhrtv.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vhrtv.ID = &ID + } + } + } + + return nil +} + +// VirtualHubRouteTableV2Properties parameters for VirtualHubRouteTableV2. +type VirtualHubRouteTableV2Properties struct { + // Routes - List of all routes. + Routes *[]VirtualHubRouteV2 `json:"routes,omitempty"` + // AttachedConnections - List of all connections attached to this route table v2. + AttachedConnections *[]string `json:"attachedConnections,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual hub route table v2 resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualHubRouteTableV2Properties. +func (vhrtvp VirtualHubRouteTableV2Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vhrtvp.Routes != nil { + objectMap["routes"] = vhrtvp.Routes + } + if vhrtvp.AttachedConnections != nil { + objectMap["attachedConnections"] = vhrtvp.AttachedConnections + } + return json.Marshal(objectMap) +} + +// VirtualHubRouteTableV2sCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualHubRouteTableV2sCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubRouteTableV2sClient) (VirtualHubRouteTableV2, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubRouteTableV2sCreateOrUpdateFuture.Result. +func (future *VirtualHubRouteTableV2sCreateOrUpdateFuture) result(client VirtualHubRouteTableV2sClient) (vhrtv VirtualHubRouteTableV2, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vhrtv.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vhrtv.Response.Response, err = future.GetResult(sender); err == nil && vhrtv.Response.Response.StatusCode != http.StatusNoContent { + vhrtv, err = client.CreateOrUpdateResponder(vhrtv.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sCreateOrUpdateFuture", "Result", vhrtv.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubRouteTableV2sDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubRouteTableV2sDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubRouteTableV2sClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubRouteTableV2sDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubRouteTableV2sDeleteFuture.Result. +func (future *VirtualHubRouteTableV2sDeleteFuture) result(client VirtualHubRouteTableV2sClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubRouteTableV2sDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubRouteV2 virtualHubRouteTableV2 route. +type VirtualHubRouteV2 struct { + // DestinationType - The type of destinations. + DestinationType *string `json:"destinationType,omitempty"` + // Destinations - List of all destinations. + Destinations *[]string `json:"destinations,omitempty"` + // NextHopType - The type of next hops. + NextHopType *string `json:"nextHopType,omitempty"` + // NextHops - NextHops ip address. + NextHops *[]string `json:"nextHops,omitempty"` +} + +// VirtualHubsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualHubsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (VirtualHub, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsCreateOrUpdateFuture.Result. +func (future *VirtualHubsCreateOrUpdateFuture) result(client VirtualHubsClient) (vh VirtualHub, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vh.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vh.Response.Response, err = future.GetResult(sender); err == nil && vh.Response.Response.StatusCode != http.StatusNoContent { + vh, err = client.CreateOrUpdateResponder(vh.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsCreateOrUpdateFuture", "Result", vh.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualHubsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualHubsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsDeleteFuture.Result. +func (future *VirtualHubsDeleteFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualHubsGetEffectiveVirtualHubRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualHubsGetEffectiveVirtualHubRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualHubsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualHubsGetEffectiveVirtualHubRoutesFuture.Result. +func (future *VirtualHubsGetEffectiveVirtualHubRoutesFuture) result(client VirtualHubsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsGetEffectiveVirtualHubRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualHubsGetEffectiveVirtualHubRoutesFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetwork virtual Network resource. +type VirtualNetwork struct { + autorest.Response `json:"-"` + // ExtendedLocation - The extended location of the virtual network. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // VirtualNetworkPropertiesFormat - Properties of the virtual network. + *VirtualNetworkPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetwork. +func (vn VirtualNetwork) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vn.ExtendedLocation != nil { + objectMap["extendedLocation"] = vn.ExtendedLocation + } + if vn.VirtualNetworkPropertiesFormat != nil { + objectMap["properties"] = vn.VirtualNetworkPropertiesFormat + } + if vn.ID != nil { + objectMap["id"] = vn.ID + } + if vn.Location != nil { + objectMap["location"] = vn.Location + } + if vn.Tags != nil { + objectMap["tags"] = vn.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetwork struct. +func (vn *VirtualNetwork) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + vn.ExtendedLocation = &extendedLocation + } + case "properties": + if v != nil { + var virtualNetworkPropertiesFormat VirtualNetworkPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPropertiesFormat) + if err != nil { + return err + } + vn.VirtualNetworkPropertiesFormat = &virtualNetworkPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vn.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vn.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vn.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vn.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vn.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vn.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkBgpCommunities bgp Communities sent over ExpressRoute with each route corresponding to a +// prefix in this VNET. +type VirtualNetworkBgpCommunities struct { + // VirtualNetworkCommunity - The BGP community associated with the virtual network. + VirtualNetworkCommunity *string `json:"virtualNetworkCommunity,omitempty"` + // RegionalCommunity - READ-ONLY; The BGP community associated with the region of the virtual network. + RegionalCommunity *string `json:"regionalCommunity,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkBgpCommunities. +func (vnbc VirtualNetworkBgpCommunities) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnbc.VirtualNetworkCommunity != nil { + objectMap["virtualNetworkCommunity"] = vnbc.VirtualNetworkCommunity + } + return json.Marshal(objectMap) +} + +// VirtualNetworkConnectionGatewayReference a reference to VirtualNetworkGateway or LocalNetworkGateway +// resource. +type VirtualNetworkConnectionGatewayReference struct { + // ID - The ID of VirtualNetworkGateway or LocalNetworkGateway resource. + ID *string `json:"id,omitempty"` +} + +// VirtualNetworkEncryption indicates if encryption is enabled on virtual network and if VM without +// encryption is allowed in encrypted VNet. +type VirtualNetworkEncryption struct { + // Enabled - Indicates if encryption is enabled on the virtual network. + Enabled *bool `json:"enabled,omitempty"` + // Enforcement - If the encrypted VNet allows VM that does not support encryption. Possible values include: 'VirtualNetworkEncryptionEnforcementDropUnencrypted', 'VirtualNetworkEncryptionEnforcementAllowUnencrypted' + Enforcement VirtualNetworkEncryptionEnforcement `json:"enforcement,omitempty"` +} + +// VirtualNetworkGateway a common class for general resource information. +type VirtualNetworkGateway struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayPropertiesFormat - Properties of the virtual network gateway. + *VirtualNetworkGatewayPropertiesFormat `json:"properties,omitempty"` + // ExtendedLocation - The extended location of type local virtual network gateway. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGateway. +func (vng VirtualNetworkGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vng.VirtualNetworkGatewayPropertiesFormat != nil { + objectMap["properties"] = vng.VirtualNetworkGatewayPropertiesFormat + } + if vng.ExtendedLocation != nil { + objectMap["extendedLocation"] = vng.ExtendedLocation + } + if vng.ID != nil { + objectMap["id"] = vng.ID + } + if vng.Location != nil { + objectMap["location"] = vng.Location + } + if vng.Tags != nil { + objectMap["tags"] = vng.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGateway struct. +func (vng *VirtualNetworkGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayPropertiesFormat VirtualNetworkGatewayPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayPropertiesFormat) + if err != nil { + return err + } + vng.VirtualNetworkGatewayPropertiesFormat = &virtualNetworkGatewayPropertiesFormat + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + vng.ExtendedLocation = &extendedLocation + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vng.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vng.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vng.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vng.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vng.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vng.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnection a common class for general resource information. +type VirtualNetworkGatewayConnection struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayConnectionPropertiesFormat - Properties of the virtual network gateway connection. + *VirtualNetworkGatewayConnectionPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnection. +func (vngc VirtualNetworkGatewayConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngc.VirtualNetworkGatewayConnectionPropertiesFormat != nil { + objectMap["properties"] = vngc.VirtualNetworkGatewayConnectionPropertiesFormat + } + if vngc.ID != nil { + objectMap["id"] = vngc.ID + } + if vngc.Location != nil { + objectMap["location"] = vngc.Location + } + if vngc.Tags != nil { + objectMap["tags"] = vngc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnection struct. +func (vngc *VirtualNetworkGatewayConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayConnectionPropertiesFormat VirtualNetworkGatewayConnectionPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionPropertiesFormat) + if err != nil { + return err + } + vngc.VirtualNetworkGatewayConnectionPropertiesFormat = &virtualNetworkGatewayConnectionPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vngc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vngc.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnectionListEntity a common class for general resource information. +type VirtualNetworkGatewayConnectionListEntity struct { + // VirtualNetworkGatewayConnectionListEntityPropertiesFormat - Properties of the virtual network gateway connection. + *VirtualNetworkGatewayConnectionListEntityPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntity. +func (vngcle VirtualNetworkGatewayConnectionListEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat != nil { + objectMap["properties"] = vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat + } + if vngcle.ID != nil { + objectMap["id"] = vngcle.ID + } + if vngcle.Location != nil { + objectMap["location"] = vngcle.Location + } + if vngcle.Tags != nil { + objectMap["tags"] = vngcle.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayConnectionListEntity struct. +func (vngcle *VirtualNetworkGatewayConnectionListEntity) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayConnectionListEntityPropertiesFormat VirtualNetworkGatewayConnectionListEntityPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayConnectionListEntityPropertiesFormat) + if err != nil { + return err + } + vngcle.VirtualNetworkGatewayConnectionListEntityPropertiesFormat = &virtualNetworkGatewayConnectionListEntityPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngcle.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngcle.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngcle.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngcle.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vngcle.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vngcle.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkGatewayConnectionListEntityPropertiesFormat virtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionListEntityPropertiesFormat struct { + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // VirtualNetworkGateway1 - The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway1,omitempty"` + // VirtualNetworkGateway2 - The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"virtualNetworkGateway2,omitempty"` + // LocalNetworkGateway2 - The reference to local network gateway resource. + LocalNetworkGateway2 *VirtualNetworkConnectionGatewayReference `json:"localNetworkGateway2,omitempty"` + // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' + ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + // RoutingWeight - The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' + ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + // SharedKey - The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // Peer - The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListEntityPropertiesFormat. +func (vngclepf VirtualNetworkGatewayConnectionListEntityPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngclepf.AuthorizationKey != nil { + objectMap["authorizationKey"] = vngclepf.AuthorizationKey + } + if vngclepf.VirtualNetworkGateway1 != nil { + objectMap["virtualNetworkGateway1"] = vngclepf.VirtualNetworkGateway1 + } + if vngclepf.VirtualNetworkGateway2 != nil { + objectMap["virtualNetworkGateway2"] = vngclepf.VirtualNetworkGateway2 + } + if vngclepf.LocalNetworkGateway2 != nil { + objectMap["localNetworkGateway2"] = vngclepf.LocalNetworkGateway2 + } + if vngclepf.ConnectionType != "" { + objectMap["connectionType"] = vngclepf.ConnectionType + } + if vngclepf.ConnectionProtocol != "" { + objectMap["connectionProtocol"] = vngclepf.ConnectionProtocol + } + if vngclepf.RoutingWeight != nil { + objectMap["routingWeight"] = vngclepf.RoutingWeight + } + if vngclepf.ConnectionMode != "" { + objectMap["connectionMode"] = vngclepf.ConnectionMode + } + if vngclepf.SharedKey != nil { + objectMap["sharedKey"] = vngclepf.SharedKey + } + if vngclepf.Peer != nil { + objectMap["peer"] = vngclepf.Peer + } + if vngclepf.EnableBgp != nil { + objectMap["enableBgp"] = vngclepf.EnableBgp + } + if vngclepf.GatewayCustomBgpIPAddresses != nil { + objectMap["gatewayCustomBgpIpAddresses"] = vngclepf.GatewayCustomBgpIPAddresses + } + if vngclepf.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vngclepf.UsePolicyBasedTrafficSelectors + } + if vngclepf.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vngclepf.IpsecPolicies + } + if vngclepf.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vngclepf.TrafficSelectorPolicies + } + if vngclepf.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = vngclepf.ExpressRouteGatewayBypass + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionListResult response for the ListVirtualNetworkGatewayConnections API +// service call. +type VirtualNetworkGatewayConnectionListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value *[]VirtualNetworkGatewayConnection `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionListResult. +func (vngclr VirtualNetworkGatewayConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngclr.Value != nil { + objectMap["value"] = vngclr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionListResultIterator provides access to a complete listing of +// VirtualNetworkGatewayConnection values. +type VirtualNetworkGatewayConnectionListResultIterator struct { + i int + page VirtualNetworkGatewayConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayConnectionListResultIterator) Response() VirtualNetworkGatewayConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayConnectionListResultIterator) Value() VirtualNetworkGatewayConnection { + if !iter.page.NotDone() { + return VirtualNetworkGatewayConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayConnectionListResultIterator type. +func NewVirtualNetworkGatewayConnectionListResultIterator(page VirtualNetworkGatewayConnectionListResultPage) VirtualNetworkGatewayConnectionListResultIterator { + return VirtualNetworkGatewayConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vngclr VirtualNetworkGatewayConnectionListResult) IsEmpty() bool { + return vngclr.Value == nil || len(*vngclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vngclr VirtualNetworkGatewayConnectionListResult) hasNextLink() bool { + return vngclr.NextLink != nil && len(*vngclr.NextLink) != 0 +} + +// virtualNetworkGatewayConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vngclr VirtualNetworkGatewayConnectionListResult) virtualNetworkGatewayConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vngclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vngclr.NextLink))) +} + +// VirtualNetworkGatewayConnectionListResultPage contains a page of VirtualNetworkGatewayConnection values. +type VirtualNetworkGatewayConnectionListResultPage struct { + fn func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error) + vngclr VirtualNetworkGatewayConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vngclr) + if err != nil { + return err + } + page.vngclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayConnectionListResultPage) NotDone() bool { + return !page.vngclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayConnectionListResultPage) Response() VirtualNetworkGatewayConnectionListResult { + return page.vngclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayConnectionListResultPage) Values() []VirtualNetworkGatewayConnection { + if page.vngclr.IsEmpty() { + return nil + } + return *page.vngclr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayConnectionListResultPage type. +func NewVirtualNetworkGatewayConnectionListResultPage(cur VirtualNetworkGatewayConnectionListResult, getNextPage func(context.Context, VirtualNetworkGatewayConnectionListResult) (VirtualNetworkGatewayConnectionListResult, error)) VirtualNetworkGatewayConnectionListResultPage { + return VirtualNetworkGatewayConnectionListResultPage{ + fn: getNextPage, + vngclr: cur, + } +} + +// VirtualNetworkGatewayConnectionPropertiesFormat virtualNetworkGatewayConnection properties. +type VirtualNetworkGatewayConnectionPropertiesFormat struct { + // AuthorizationKey - The authorizationKey. + AuthorizationKey *string `json:"authorizationKey,omitempty"` + // VirtualNetworkGateway1 - The reference to virtual network gateway resource. + VirtualNetworkGateway1 *VirtualNetworkGateway `json:"virtualNetworkGateway1,omitempty"` + // VirtualNetworkGateway2 - The reference to virtual network gateway resource. + VirtualNetworkGateway2 *VirtualNetworkGateway `json:"virtualNetworkGateway2,omitempty"` + // LocalNetworkGateway2 - The reference to local network gateway resource. + LocalNetworkGateway2 *LocalNetworkGateway `json:"localNetworkGateway2,omitempty"` + // IngressNatRules - List of ingress NatRules. + IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` + // EgressNatRules - List of egress NatRules. + EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` + // ConnectionType - Gateway connection type. Possible values include: 'VirtualNetworkGatewayConnectionTypeIPsec', 'VirtualNetworkGatewayConnectionTypeVnet2Vnet', 'VirtualNetworkGatewayConnectionTypeExpressRoute', 'VirtualNetworkGatewayConnectionTypeVPNClient' + ConnectionType VirtualNetworkGatewayConnectionType `json:"connectionType,omitempty"` + // ConnectionProtocol - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + ConnectionProtocol VirtualNetworkGatewayConnectionProtocol `json:"connectionProtocol,omitempty"` + // RoutingWeight - The routing weight. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // DpdTimeoutSeconds - The dead peer detection timeout of this connection in seconds. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + // ConnectionMode - The connection mode for this connection. Possible values include: 'VirtualNetworkGatewayConnectionModeDefault', 'VirtualNetworkGatewayConnectionModeResponderOnly', 'VirtualNetworkGatewayConnectionModeInitiatorOnly' + ConnectionMode VirtualNetworkGatewayConnectionMode `json:"connectionMode,omitempty"` + // SharedKey - The IPSec shared key. + SharedKey *string `json:"sharedKey,omitempty"` + // ConnectionStatus - READ-ONLY; Virtual Network Gateway connection status. Possible values include: 'VirtualNetworkGatewayConnectionStatusUnknown', 'VirtualNetworkGatewayConnectionStatusConnecting', 'VirtualNetworkGatewayConnectionStatusConnected', 'VirtualNetworkGatewayConnectionStatusNotConnected' + ConnectionStatus VirtualNetworkGatewayConnectionStatus `json:"connectionStatus,omitempty"` + // TunnelConnectionStatus - READ-ONLY; Collection of all tunnels' connection health status. + TunnelConnectionStatus *[]TunnelConnectionHealth `json:"tunnelConnectionStatus,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes transferred in this connection. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes transferred in this connection. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // Peer - The reference to peerings resource. + Peer *SubResource `json:"peer,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // GatewayCustomBgpIPAddresses - GatewayCustomBgpIpAddresses to be used for virtual network gateway Connection. + GatewayCustomBgpIPAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"gatewayCustomBgpIpAddresses,omitempty"` + // UseLocalAzureIPAddress - Use private local Azure IP for the connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway connection resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ExpressRouteGatewayBypass - Bypass ExpressRoute Gateway for data forwarding. + ExpressRouteGatewayBypass *bool `json:"expressRouteGatewayBypass,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayConnectionPropertiesFormat. +func (vngcpf VirtualNetworkGatewayConnectionPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngcpf.AuthorizationKey != nil { + objectMap["authorizationKey"] = vngcpf.AuthorizationKey + } + if vngcpf.VirtualNetworkGateway1 != nil { + objectMap["virtualNetworkGateway1"] = vngcpf.VirtualNetworkGateway1 + } + if vngcpf.VirtualNetworkGateway2 != nil { + objectMap["virtualNetworkGateway2"] = vngcpf.VirtualNetworkGateway2 + } + if vngcpf.LocalNetworkGateway2 != nil { + objectMap["localNetworkGateway2"] = vngcpf.LocalNetworkGateway2 + } + if vngcpf.IngressNatRules != nil { + objectMap["ingressNatRules"] = vngcpf.IngressNatRules + } + if vngcpf.EgressNatRules != nil { + objectMap["egressNatRules"] = vngcpf.EgressNatRules + } + if vngcpf.ConnectionType != "" { + objectMap["connectionType"] = vngcpf.ConnectionType + } + if vngcpf.ConnectionProtocol != "" { + objectMap["connectionProtocol"] = vngcpf.ConnectionProtocol + } + if vngcpf.RoutingWeight != nil { + objectMap["routingWeight"] = vngcpf.RoutingWeight + } + if vngcpf.DpdTimeoutSeconds != nil { + objectMap["dpdTimeoutSeconds"] = vngcpf.DpdTimeoutSeconds + } + if vngcpf.ConnectionMode != "" { + objectMap["connectionMode"] = vngcpf.ConnectionMode + } + if vngcpf.SharedKey != nil { + objectMap["sharedKey"] = vngcpf.SharedKey + } + if vngcpf.Peer != nil { + objectMap["peer"] = vngcpf.Peer + } + if vngcpf.EnableBgp != nil { + objectMap["enableBgp"] = vngcpf.EnableBgp + } + if vngcpf.GatewayCustomBgpIPAddresses != nil { + objectMap["gatewayCustomBgpIpAddresses"] = vngcpf.GatewayCustomBgpIPAddresses + } + if vngcpf.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vngcpf.UseLocalAzureIPAddress + } + if vngcpf.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vngcpf.UsePolicyBasedTrafficSelectors + } + if vngcpf.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vngcpf.IpsecPolicies + } + if vngcpf.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vngcpf.TrafficSelectorPolicies + } + if vngcpf.ExpressRouteGatewayBypass != nil { + objectMap["expressRouteGatewayBypass"] = vngcpf.ExpressRouteGatewayBypass + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { + vngc, err = client.CreateOrUpdateResponder(vngc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture", "Result", vngc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewayConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsDeleteFuture.Result. +func (future *VirtualNetworkGatewayConnectionsDeleteFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewayConnectionsGetIkeSasFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsGetIkeSasFuture.Result. +func (future *VirtualNetworkGatewayConnectionsGetIkeSasFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsGetIkeSasFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetIkeSasResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsResetConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsResetConnectionFuture.Result. +func (future *VirtualNetworkGatewayConnectionsResetConnectionFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayConnectionsResetSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsResetSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionResetSharedKey, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsResetSharedKeyFuture.Result. +func (future *VirtualNetworkGatewayConnectionsResetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (crsk ConnectionResetSharedKey, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + crsk.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if crsk.Response.Response, err = future.GetResult(sender); err == nil && crsk.Response.Response.StatusCode != http.StatusNoContent { + crsk, err = client.ResetSharedKeyResponder(crsk.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture", "Result", crsk.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsSetSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsSetSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (ConnectionSharedKey, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsSetSharedKeyFuture.Result. +func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + csk.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent { + csk, err = client.SetSharedKeyResponder(csk.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture", "Result", csk.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VirtualNetworkGatewayConnectionsStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsStartPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewayConnectionsStartPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsStopPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewayConnectionsStopPacketCaptureFuture) result(client VirtualNetworkGatewayConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayConnectionsUpdateTagsFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayConnectionsUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayConnectionsClient) (VirtualNetworkGatewayConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayConnectionsUpdateTagsFuture.Result. +func (future *VirtualNetworkGatewayConnectionsUpdateTagsFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayConnectionsUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent { + vngc, err = client.UpdateTagsResponder(vngc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsUpdateTagsFuture", "Result", vngc.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayIPConfiguration IP configuration for virtual network gateway. +type VirtualNetworkGatewayIPConfiguration struct { + // VirtualNetworkGatewayIPConfigurationPropertiesFormat - Properties of the virtual network gateway ip configuration. + *VirtualNetworkGatewayIPConfigurationPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfiguration. +func (vngic VirtualNetworkGatewayIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat != nil { + objectMap["properties"] = vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat + } + if vngic.Name != nil { + objectMap["name"] = vngic.Name + } + if vngic.ID != nil { + objectMap["id"] = vngic.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayIPConfiguration struct. +func (vngic *VirtualNetworkGatewayIPConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayIPConfigurationPropertiesFormat VirtualNetworkGatewayIPConfigurationPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkGatewayIPConfigurationPropertiesFormat) + if err != nil { + return err + } + vngic.VirtualNetworkGatewayIPConfigurationPropertiesFormat = &virtualNetworkGatewayIPConfigurationPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngic.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngic.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngic.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkGatewayIPConfigurationPropertiesFormat properties of VirtualNetworkGatewayIPConfiguration. +type VirtualNetworkGatewayIPConfigurationPropertiesFormat struct { + // PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: 'IPAllocationMethodStatic', 'IPAllocationMethodDynamic' + PrivateIPAllocationMethod IPAllocationMethod `json:"privateIPAllocationMethod,omitempty"` + // Subnet - The reference to the subnet resource. + Subnet *SubResource `json:"subnet,omitempty"` + // PublicIPAddress - The reference to the public IP resource. + PublicIPAddress *SubResource `json:"publicIPAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; Private IP Address for this gateway. + PrivateIPAddress *string `json:"privateIPAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway IP configuration resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayIPConfigurationPropertiesFormat. +func (vngicpf VirtualNetworkGatewayIPConfigurationPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngicpf.PrivateIPAllocationMethod != "" { + objectMap["privateIPAllocationMethod"] = vngicpf.PrivateIPAllocationMethod + } + if vngicpf.Subnet != nil { + objectMap["subnet"] = vngicpf.Subnet + } + if vngicpf.PublicIPAddress != nil { + objectMap["publicIPAddress"] = vngicpf.PublicIPAddress + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListConnectionsResult response for the VirtualNetworkGatewayListConnections API +// service call. +type VirtualNetworkGatewayListConnectionsResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGatewayConnection resources that exists in a resource group. + Value *[]VirtualNetworkGatewayConnectionListEntity `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListConnectionsResult. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnglcr.Value != nil { + objectMap["value"] = vnglcr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListConnectionsResultIterator provides access to a complete listing of +// VirtualNetworkGatewayConnectionListEntity values. +type VirtualNetworkGatewayListConnectionsResultIterator struct { + i int + page VirtualNetworkGatewayListConnectionsResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayListConnectionsResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayListConnectionsResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) Response() VirtualNetworkGatewayListConnectionsResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayListConnectionsResultIterator) Value() VirtualNetworkGatewayConnectionListEntity { + if !iter.page.NotDone() { + return VirtualNetworkGatewayConnectionListEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultIterator type. +func NewVirtualNetworkGatewayListConnectionsResultIterator(page VirtualNetworkGatewayListConnectionsResultPage) VirtualNetworkGatewayListConnectionsResultIterator { + return VirtualNetworkGatewayListConnectionsResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) IsEmpty() bool { + return vnglcr.Value == nil || len(*vnglcr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) hasNextLink() bool { + return vnglcr.NextLink != nil && len(*vnglcr.NextLink) != 0 +} + +// virtualNetworkGatewayListConnectionsResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnglcr VirtualNetworkGatewayListConnectionsResult) virtualNetworkGatewayListConnectionsResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnglcr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnglcr.NextLink))) +} + +// VirtualNetworkGatewayListConnectionsResultPage contains a page of +// VirtualNetworkGatewayConnectionListEntity values. +type VirtualNetworkGatewayListConnectionsResultPage struct { + fn func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error) + vnglcr VirtualNetworkGatewayListConnectionsResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayListConnectionsResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListConnectionsResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnglcr) + if err != nil { + return err + } + page.vnglcr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayListConnectionsResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayListConnectionsResultPage) NotDone() bool { + return !page.vnglcr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayListConnectionsResultPage) Response() VirtualNetworkGatewayListConnectionsResult { + return page.vnglcr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayListConnectionsResultPage) Values() []VirtualNetworkGatewayConnectionListEntity { + if page.vnglcr.IsEmpty() { + return nil + } + return *page.vnglcr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayListConnectionsResultPage type. +func NewVirtualNetworkGatewayListConnectionsResultPage(cur VirtualNetworkGatewayListConnectionsResult, getNextPage func(context.Context, VirtualNetworkGatewayListConnectionsResult) (VirtualNetworkGatewayListConnectionsResult, error)) VirtualNetworkGatewayListConnectionsResultPage { + return VirtualNetworkGatewayListConnectionsResultPage{ + fn: getNextPage, + vnglcr: cur, + } +} + +// VirtualNetworkGatewayListResult response for the ListVirtualNetworkGateways API service call. +type VirtualNetworkGatewayListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkGateway resources that exists in a resource group. + Value *[]VirtualNetworkGateway `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayListResult. +func (vnglr VirtualNetworkGatewayListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnglr.Value != nil { + objectMap["value"] = vnglr.Value + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayListResultIterator provides access to a complete listing of VirtualNetworkGateway +// values. +type VirtualNetworkGatewayListResultIterator struct { + i int + page VirtualNetworkGatewayListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkGatewayListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkGatewayListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkGatewayListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkGatewayListResultIterator) Response() VirtualNetworkGatewayListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkGatewayListResultIterator) Value() VirtualNetworkGateway { + if !iter.page.NotDone() { + return VirtualNetworkGateway{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkGatewayListResultIterator type. +func NewVirtualNetworkGatewayListResultIterator(page VirtualNetworkGatewayListResultPage) VirtualNetworkGatewayListResultIterator { + return VirtualNetworkGatewayListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnglr VirtualNetworkGatewayListResult) IsEmpty() bool { + return vnglr.Value == nil || len(*vnglr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnglr VirtualNetworkGatewayListResult) hasNextLink() bool { + return vnglr.NextLink != nil && len(*vnglr.NextLink) != 0 +} + +// virtualNetworkGatewayListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnglr VirtualNetworkGatewayListResult) virtualNetworkGatewayListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnglr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnglr.NextLink))) +} + +// VirtualNetworkGatewayListResultPage contains a page of VirtualNetworkGateway values. +type VirtualNetworkGatewayListResultPage struct { + fn func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error) + vnglr VirtualNetworkGatewayListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkGatewayListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnglr) + if err != nil { + return err + } + page.vnglr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkGatewayListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkGatewayListResultPage) NotDone() bool { + return !page.vnglr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkGatewayListResultPage) Response() VirtualNetworkGatewayListResult { + return page.vnglr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkGatewayListResultPage) Values() []VirtualNetworkGateway { + if page.vnglr.IsEmpty() { + return nil + } + return *page.vnglr.Value +} + +// Creates a new instance of the VirtualNetworkGatewayListResultPage type. +func NewVirtualNetworkGatewayListResultPage(cur VirtualNetworkGatewayListResult, getNextPage func(context.Context, VirtualNetworkGatewayListResult) (VirtualNetworkGatewayListResult, error)) VirtualNetworkGatewayListResultPage { + return VirtualNetworkGatewayListResultPage{ + fn: getNextPage, + vnglr: cur, + } +} + +// VirtualNetworkGatewayNatRule virtualNetworkGatewayNatRule Resource. +type VirtualNetworkGatewayNatRule struct { + autorest.Response `json:"-"` + // VirtualNetworkGatewayNatRuleProperties - Properties of the Virtual Network Gateway NAT rule. + *VirtualNetworkGatewayNatRuleProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRule. +func (vngnr VirtualNetworkGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngnr.VirtualNetworkGatewayNatRuleProperties != nil { + objectMap["properties"] = vngnr.VirtualNetworkGatewayNatRuleProperties + } + if vngnr.Name != nil { + objectMap["name"] = vngnr.Name + } + if vngnr.ID != nil { + objectMap["id"] = vngnr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkGatewayNatRule struct. +func (vngnr *VirtualNetworkGatewayNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkGatewayNatRuleProperties VirtualNetworkGatewayNatRuleProperties + err = json.Unmarshal(*v, &virtualNetworkGatewayNatRuleProperties) + if err != nil { + return err + } + vngnr.VirtualNetworkGatewayNatRuleProperties = &virtualNetworkGatewayNatRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vngnr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vngnr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vngnr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vngnr.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkGatewayNatRuleProperties parameters for VirtualNetworkGatewayNatRule. +type VirtualNetworkGatewayNatRuleProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' + Type VpnNatRuleType `json:"type,omitempty"` + // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' + Mode VpnNatRuleMode `json:"mode,omitempty"` + // InternalMappings - The private IP address internal mapping for NAT. + InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` + // ExternalMappings - The private IP address external mapping for NAT. + ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` + // IPConfigurationID - The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayNatRuleProperties. +func (vngnrp VirtualNetworkGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngnrp.Type != "" { + objectMap["type"] = vngnrp.Type + } + if vngnrp.Mode != "" { + objectMap["mode"] = vngnrp.Mode + } + if vngnrp.InternalMappings != nil { + objectMap["internalMappings"] = vngnrp.InternalMappings + } + if vngnrp.ExternalMappings != nil { + objectMap["externalMappings"] = vngnrp.ExternalMappings + } + if vngnrp.IPConfigurationID != nil { + objectMap["ipConfigurationId"] = vngnrp.IPConfigurationID + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewayNatRulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewayNatRulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayNatRulesClient) (VirtualNetworkGatewayNatRule, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayNatRulesCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewayNatRulesCreateOrUpdateFuture) result(client VirtualNetworkGatewayNatRulesClient) (vngnr VirtualNetworkGatewayNatRule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vngnr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vngnr.Response.Response, err = future.GetResult(sender); err == nil && vngnr.Response.Response.StatusCode != http.StatusNoContent { + vngnr, err = client.CreateOrUpdateResponder(vngnr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture", "Result", vngnr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewayNatRulesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewayNatRulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewayNatRulesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewayNatRulesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewayNatRulesDeleteFuture.Result. +func (future *VirtualNetworkGatewayNatRulesDeleteFuture) result(client VirtualNetworkGatewayNatRulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewayNatRulesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewayPropertiesFormat virtualNetworkGateway properties. +type VirtualNetworkGatewayPropertiesFormat struct { + // IPConfigurations - IP configurations for virtual network gateway. + IPConfigurations *[]VirtualNetworkGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + // GatewayType - The type of this virtual network gateway. Possible values include: 'VirtualNetworkGatewayTypeVpn', 'VirtualNetworkGatewayTypeExpressRoute', 'VirtualNetworkGatewayTypeLocalGateway' + GatewayType VirtualNetworkGatewayType `json:"gatewayType,omitempty"` + // VpnType - The type of this virtual network gateway. Possible values include: 'VpnTypePolicyBased', 'VpnTypeRouteBased' + VpnType VpnType `json:"vpnType,omitempty"` + // VpnGatewayGeneration - The generation for this VirtualNetworkGateway. Must be None if gatewayType is not VPN. Possible values include: 'VpnGatewayGenerationNone', 'VpnGatewayGenerationGeneration1', 'VpnGatewayGenerationGeneration2' + VpnGatewayGeneration VpnGatewayGeneration `json:"vpnGatewayGeneration,omitempty"` + // EnableBgp - Whether BGP is enabled for this virtual network gateway or not. + EnableBgp *bool `json:"enableBgp,omitempty"` + // EnablePrivateIPAddress - Whether private IP needs to be enabled on this gateway for connections or not. + EnablePrivateIPAddress *bool `json:"enablePrivateIpAddress,omitempty"` + // ActiveActive - ActiveActive flag. + ActiveActive *bool `json:"activeActive,omitempty"` + // DisableIPSecReplayProtection - disableIPSecReplayProtection flag. + DisableIPSecReplayProtection *bool `json:"disableIPSecReplayProtection,omitempty"` + // GatewayDefaultSite - The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. + GatewayDefaultSite *SubResource `json:"gatewayDefaultSite,omitempty"` + // Sku - The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. + Sku *VirtualNetworkGatewaySku `json:"sku,omitempty"` + // VpnClientConfiguration - The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. + VpnClientConfiguration *VpnClientConfiguration `json:"vpnClientConfiguration,omitempty"` + // BgpSettings - Virtual network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // CustomRoutes - The reference to the address space resource which represents the custom routes address space specified by the customer for virtual network gateway and VpnClient. + CustomRoutes *AddressSpace `json:"customRoutes,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network gateway resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // EnableDNSForwarding - Whether dns forwarding is enabled or not. + EnableDNSForwarding *bool `json:"enableDnsForwarding,omitempty"` + // InboundDNSForwardingEndpoint - READ-ONLY; The IP address allocated by the gateway to which dns requests can be sent. + InboundDNSForwardingEndpoint *string `json:"inboundDnsForwardingEndpoint,omitempty"` + // VNetExtendedLocationResourceID - Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. + VNetExtendedLocationResourceID *string `json:"vNetExtendedLocationResourceId,omitempty"` + // NatRules - NatRules for virtual network gateway. + NatRules *[]VirtualNetworkGatewayNatRule `json:"natRules,omitempty"` + // EnableBgpRouteTranslationForNat - EnableBgpRouteTranslationForNat flag. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewayPropertiesFormat. +func (vngpf VirtualNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngpf.IPConfigurations != nil { + objectMap["ipConfigurations"] = vngpf.IPConfigurations + } + if vngpf.GatewayType != "" { + objectMap["gatewayType"] = vngpf.GatewayType + } + if vngpf.VpnType != "" { + objectMap["vpnType"] = vngpf.VpnType + } + if vngpf.VpnGatewayGeneration != "" { + objectMap["vpnGatewayGeneration"] = vngpf.VpnGatewayGeneration + } + if vngpf.EnableBgp != nil { + objectMap["enableBgp"] = vngpf.EnableBgp + } + if vngpf.EnablePrivateIPAddress != nil { + objectMap["enablePrivateIpAddress"] = vngpf.EnablePrivateIPAddress + } + if vngpf.ActiveActive != nil { + objectMap["activeActive"] = vngpf.ActiveActive + } + if vngpf.DisableIPSecReplayProtection != nil { + objectMap["disableIPSecReplayProtection"] = vngpf.DisableIPSecReplayProtection + } + if vngpf.GatewayDefaultSite != nil { + objectMap["gatewayDefaultSite"] = vngpf.GatewayDefaultSite + } + if vngpf.Sku != nil { + objectMap["sku"] = vngpf.Sku + } + if vngpf.VpnClientConfiguration != nil { + objectMap["vpnClientConfiguration"] = vngpf.VpnClientConfiguration + } + if vngpf.BgpSettings != nil { + objectMap["bgpSettings"] = vngpf.BgpSettings + } + if vngpf.CustomRoutes != nil { + objectMap["customRoutes"] = vngpf.CustomRoutes + } + if vngpf.EnableDNSForwarding != nil { + objectMap["enableDnsForwarding"] = vngpf.EnableDNSForwarding + } + if vngpf.VNetExtendedLocationResourceID != nil { + objectMap["vNetExtendedLocationResourceId"] = vngpf.VNetExtendedLocationResourceID + } + if vngpf.NatRules != nil { + objectMap["natRules"] = vngpf.NatRules + } + if vngpf.EnableBgpRouteTranslationForNat != nil { + objectMap["enableBgpRouteTranslationForNat"] = vngpf.EnableBgpRouteTranslationForNat + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysCreateOrUpdateFuture.Result. +func (future *VirtualNetworkGatewaysCreateOrUpdateFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.CreateOrUpdateResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysCreateOrUpdateFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysDeleteFuture.Result. +func (future *VirtualNetworkGatewaysDeleteFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture an abstraction for monitoring +// and retrieving the results of a long-running operation. +type VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture.Result. +func (future *VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysGeneratevpnclientpackageFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGeneratevpnclientpackageFuture.Result. +func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GeneratevpnclientpackageResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGenerateVpnProfileFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysGenerateVpnProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGenerateVpnProfileFuture.Result. +func (future *VirtualNetworkGatewaysGenerateVpnProfileFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGenerateVpnProfileFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GenerateVpnProfileResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGenerateVpnProfileFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetAdvertisedRoutesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysGetAdvertisedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetAdvertisedRoutesFuture.Result. +func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetBgpPeerStatusFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewaysGetBgpPeerStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (BgpPeerStatusListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetBgpPeerStatusFuture.Result. +func (future *VirtualNetworkGatewaysGetBgpPeerStatusFuture) result(client VirtualNetworkGatewaysClient) (bpslr BgpPeerStatusListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + bpslr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetBgpPeerStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bpslr.Response.Response, err = future.GetResult(sender); err == nil && bpslr.Response.Response.StatusCode != http.StatusNoContent { + bpslr, err = client.GetBgpPeerStatusResponder(bpslr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetBgpPeerStatusFuture", "Result", bpslr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetLearnedRoutesFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VirtualNetworkGatewaysGetLearnedRoutesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (GatewayRouteListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetLearnedRoutesFuture.Result. +func (future *VirtualNetworkGatewaysGetLearnedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + grlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetLearnedRoutesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent { + grlr, err = client.GetLearnedRoutesResponder(grlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetLearnedRoutesFuture", "Result", grlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientConnectionHealthDetailListResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) result(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcchdlr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent { + vcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture", "Result", vcchdlr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcipp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { + vcipp, err = client.GetVpnclientIpsecParametersResponder(vcipp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysGetVpnProfilePackageURLFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysGetVpnProfilePackageURLFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysGetVpnProfilePackageURLFuture.Result. +func (future *VirtualNetworkGatewaysGetVpnProfilePackageURLFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetVpnProfilePackageURLResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaySku virtualNetworkGatewaySku details. +type VirtualNetworkGatewaySku struct { + // Name - Gateway SKU name. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard', 'VirtualNetworkGatewaySkuNameUltraPerformance', 'VirtualNetworkGatewaySkuNameVpnGw1', 'VirtualNetworkGatewaySkuNameVpnGw2', 'VirtualNetworkGatewaySkuNameVpnGw3', 'VirtualNetworkGatewaySkuNameVpnGw4', 'VirtualNetworkGatewaySkuNameVpnGw5', 'VirtualNetworkGatewaySkuNameVpnGw1AZ', 'VirtualNetworkGatewaySkuNameVpnGw2AZ', 'VirtualNetworkGatewaySkuNameVpnGw3AZ', 'VirtualNetworkGatewaySkuNameVpnGw4AZ', 'VirtualNetworkGatewaySkuNameVpnGw5AZ', 'VirtualNetworkGatewaySkuNameErGw1AZ', 'VirtualNetworkGatewaySkuNameErGw2AZ', 'VirtualNetworkGatewaySkuNameErGw3AZ' + Name VirtualNetworkGatewaySkuName `json:"name,omitempty"` + // Tier - Gateway SKU tier. Possible values include: 'VirtualNetworkGatewaySkuTierBasic', 'VirtualNetworkGatewaySkuTierHighPerformance', 'VirtualNetworkGatewaySkuTierStandard', 'VirtualNetworkGatewaySkuTierUltraPerformance', 'VirtualNetworkGatewaySkuTierVpnGw1', 'VirtualNetworkGatewaySkuTierVpnGw2', 'VirtualNetworkGatewaySkuTierVpnGw3', 'VirtualNetworkGatewaySkuTierVpnGw4', 'VirtualNetworkGatewaySkuTierVpnGw5', 'VirtualNetworkGatewaySkuTierVpnGw1AZ', 'VirtualNetworkGatewaySkuTierVpnGw2AZ', 'VirtualNetworkGatewaySkuTierVpnGw3AZ', 'VirtualNetworkGatewaySkuTierVpnGw4AZ', 'VirtualNetworkGatewaySkuTierVpnGw5AZ', 'VirtualNetworkGatewaySkuTierErGw1AZ', 'VirtualNetworkGatewaySkuTierErGw2AZ', 'VirtualNetworkGatewaySkuTierErGw3AZ' + Tier VirtualNetworkGatewaySkuTier `json:"tier,omitempty"` + // Capacity - READ-ONLY; The capacity. + Capacity *int32 `json:"capacity,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkGatewaySku. +func (vngs VirtualNetworkGatewaySku) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vngs.Name != "" { + objectMap["name"] = vngs.Name + } + if vngs.Tier != "" { + objectMap["tier"] = vngs.Tier + } + return json.Marshal(objectMap) +} + +// VirtualNetworkGatewaysResetFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysResetFuture.Result. +func (future *VirtualNetworkGatewaysResetFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.ResetResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysResetVpnClientSharedKeyFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysResetVpnClientSharedKeyFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysResetVpnClientSharedKeyFuture.Result. +func (future *VirtualNetworkGatewaysResetVpnClientSharedKeyFuture) result(client VirtualNetworkGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VpnClientIPsecParameters, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture.Result. +func (future *VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture) result(client VirtualNetworkGatewaysClient) (vcipp VpnClientIPsecParameters, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vcipp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vcipp.Response.Response, err = future.GetResult(sender); err == nil && vcipp.Response.Response.StatusCode != http.StatusNoContent { + vcipp, err = client.SetVpnclientIpsecParametersResponder(vcipp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture", "Result", vcipp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysStartPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewaysStartPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type VirtualNetworkGatewaysStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysStopPacketCaptureFuture.Result. +func (future *VirtualNetworkGatewaysStopPacketCaptureFuture) result(client VirtualNetworkGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkGatewaysClient) (VirtualNetworkGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkGatewaysUpdateTagsFuture.Result. +func (future *VirtualNetworkGatewaysUpdateTagsFuture) result(client VirtualNetworkGatewaysClient) (vng VirtualNetworkGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vng.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vng.Response.Response, err = future.GetResult(sender); err == nil && vng.Response.Response.StatusCode != http.StatusNoContent { + vng, err = client.UpdateTagsResponder(vng.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysUpdateTagsFuture", "Result", vng.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkListResult response for the ListVirtualNetworks API service call. +type VirtualNetworkListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetwork resources in a resource group. + Value *[]VirtualNetwork `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkListResultIterator provides access to a complete listing of VirtualNetwork values. +type VirtualNetworkListResultIterator struct { + i int + page VirtualNetworkListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkListResultIterator) Response() VirtualNetworkListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkListResultIterator) Value() VirtualNetwork { + if !iter.page.NotDone() { + return VirtualNetwork{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkListResultIterator type. +func NewVirtualNetworkListResultIterator(page VirtualNetworkListResultPage) VirtualNetworkListResultIterator { + return VirtualNetworkListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnlr VirtualNetworkListResult) IsEmpty() bool { + return vnlr.Value == nil || len(*vnlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnlr VirtualNetworkListResult) hasNextLink() bool { + return vnlr.NextLink != nil && len(*vnlr.NextLink) != 0 +} + +// virtualNetworkListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnlr VirtualNetworkListResult) virtualNetworkListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnlr.NextLink))) +} + +// VirtualNetworkListResultPage contains a page of VirtualNetwork values. +type VirtualNetworkListResultPage struct { + fn func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error) + vnlr VirtualNetworkListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnlr) + if err != nil { + return err + } + page.vnlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkListResultPage) NotDone() bool { + return !page.vnlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkListResultPage) Response() VirtualNetworkListResult { + return page.vnlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkListResultPage) Values() []VirtualNetwork { + if page.vnlr.IsEmpty() { + return nil + } + return *page.vnlr.Value +} + +// Creates a new instance of the VirtualNetworkListResultPage type. +func NewVirtualNetworkListResultPage(cur VirtualNetworkListResult, getNextPage func(context.Context, VirtualNetworkListResult) (VirtualNetworkListResult, error)) VirtualNetworkListResultPage { + return VirtualNetworkListResultPage{ + fn: getNextPage, + vnlr: cur, + } +} + +// VirtualNetworkListUsageResult response for the virtual networks GetUsage API service call. +type VirtualNetworkListUsageResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; VirtualNetwork usage stats. + Value *[]VirtualNetworkUsage `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkListUsageResult. +func (vnlur VirtualNetworkListUsageResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnlur.NextLink != nil { + objectMap["nextLink"] = vnlur.NextLink + } + return json.Marshal(objectMap) +} + +// VirtualNetworkListUsageResultIterator provides access to a complete listing of VirtualNetworkUsage +// values. +type VirtualNetworkListUsageResultIterator struct { + i int + page VirtualNetworkListUsageResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkListUsageResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkListUsageResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkListUsageResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkListUsageResultIterator) Response() VirtualNetworkListUsageResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkListUsageResultIterator) Value() VirtualNetworkUsage { + if !iter.page.NotDone() { + return VirtualNetworkUsage{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkListUsageResultIterator type. +func NewVirtualNetworkListUsageResultIterator(page VirtualNetworkListUsageResultPage) VirtualNetworkListUsageResultIterator { + return VirtualNetworkListUsageResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnlur VirtualNetworkListUsageResult) IsEmpty() bool { + return vnlur.Value == nil || len(*vnlur.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnlur VirtualNetworkListUsageResult) hasNextLink() bool { + return vnlur.NextLink != nil && len(*vnlur.NextLink) != 0 +} + +// virtualNetworkListUsageResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnlur VirtualNetworkListUsageResult) virtualNetworkListUsageResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnlur.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnlur.NextLink))) +} + +// VirtualNetworkListUsageResultPage contains a page of VirtualNetworkUsage values. +type VirtualNetworkListUsageResultPage struct { + fn func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error) + vnlur VirtualNetworkListUsageResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkListUsageResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkListUsageResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnlur) + if err != nil { + return err + } + page.vnlur = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkListUsageResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkListUsageResultPage) NotDone() bool { + return !page.vnlur.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkListUsageResultPage) Response() VirtualNetworkListUsageResult { + return page.vnlur +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkListUsageResultPage) Values() []VirtualNetworkUsage { + if page.vnlur.IsEmpty() { + return nil + } + return *page.vnlur.Value +} + +// Creates a new instance of the VirtualNetworkListUsageResultPage type. +func NewVirtualNetworkListUsageResultPage(cur VirtualNetworkListUsageResult, getNextPage func(context.Context, VirtualNetworkListUsageResult) (VirtualNetworkListUsageResult, error)) VirtualNetworkListUsageResultPage { + return VirtualNetworkListUsageResultPage{ + fn: getNextPage, + vnlur: cur, + } +} + +// VirtualNetworkPeering peerings in a virtual network resource. +type VirtualNetworkPeering struct { + autorest.Response `json:"-"` + // VirtualNetworkPeeringPropertiesFormat - Properties of the virtual network peering. + *VirtualNetworkPeeringPropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeering. +func (vnp VirtualNetworkPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnp.VirtualNetworkPeeringPropertiesFormat != nil { + objectMap["properties"] = vnp.VirtualNetworkPeeringPropertiesFormat + } + if vnp.Name != nil { + objectMap["name"] = vnp.Name + } + if vnp.Type != nil { + objectMap["type"] = vnp.Type + } + if vnp.ID != nil { + objectMap["id"] = vnp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkPeering struct. +func (vnp *VirtualNetworkPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkPeeringPropertiesFormat VirtualNetworkPeeringPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkPeeringPropertiesFormat) + if err != nil { + return err + } + vnp.VirtualNetworkPeeringPropertiesFormat = &virtualNetworkPeeringPropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vnp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnp.ID = &ID + } + } + } + + return nil +} + +// VirtualNetworkPeeringListResult response for ListSubnets API service call. Retrieves all subnets that +// belong to a virtual network. +type VirtualNetworkPeeringListResult struct { + autorest.Response `json:"-"` + // Value - The peerings in a virtual network. + Value *[]VirtualNetworkPeering `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkPeeringListResultIterator provides access to a complete listing of VirtualNetworkPeering +// values. +type VirtualNetworkPeeringListResultIterator struct { + i int + page VirtualNetworkPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkPeeringListResultIterator) Response() VirtualNetworkPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkPeeringListResultIterator) Value() VirtualNetworkPeering { + if !iter.page.NotDone() { + return VirtualNetworkPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkPeeringListResultIterator type. +func NewVirtualNetworkPeeringListResultIterator(page VirtualNetworkPeeringListResultPage) VirtualNetworkPeeringListResultIterator { + return VirtualNetworkPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vnplr VirtualNetworkPeeringListResult) IsEmpty() bool { + return vnplr.Value == nil || len(*vnplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vnplr VirtualNetworkPeeringListResult) hasNextLink() bool { + return vnplr.NextLink != nil && len(*vnplr.NextLink) != 0 +} + +// virtualNetworkPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vnplr VirtualNetworkPeeringListResult) virtualNetworkPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vnplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vnplr.NextLink))) +} + +// VirtualNetworkPeeringListResultPage contains a page of VirtualNetworkPeering values. +type VirtualNetworkPeeringListResultPage struct { + fn func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error) + vnplr VirtualNetworkPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vnplr) + if err != nil { + return err + } + page.vnplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkPeeringListResultPage) NotDone() bool { + return !page.vnplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkPeeringListResultPage) Response() VirtualNetworkPeeringListResult { + return page.vnplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkPeeringListResultPage) Values() []VirtualNetworkPeering { + if page.vnplr.IsEmpty() { + return nil + } + return *page.vnplr.Value +} + +// Creates a new instance of the VirtualNetworkPeeringListResultPage type. +func NewVirtualNetworkPeeringListResultPage(cur VirtualNetworkPeeringListResult, getNextPage func(context.Context, VirtualNetworkPeeringListResult) (VirtualNetworkPeeringListResult, error)) VirtualNetworkPeeringListResultPage { + return VirtualNetworkPeeringListResultPage{ + fn: getNextPage, + vnplr: cur, + } +} + +// VirtualNetworkPeeringPropertiesFormat properties of the virtual network peering. +type VirtualNetworkPeeringPropertiesFormat struct { + // AllowVirtualNetworkAccess - Whether the VMs in the local virtual network space would be able to access the VMs in remote virtual network space. + AllowVirtualNetworkAccess *bool `json:"allowVirtualNetworkAccess,omitempty"` + // AllowForwardedTraffic - Whether the forwarded traffic from the VMs in the local virtual network will be allowed/disallowed in remote virtual network. + AllowForwardedTraffic *bool `json:"allowForwardedTraffic,omitempty"` + // AllowGatewayTransit - If gateway links can be used in remote virtual networking to link to this virtual network. + AllowGatewayTransit *bool `json:"allowGatewayTransit,omitempty"` + // UseRemoteGateways - If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. + UseRemoteGateways *bool `json:"useRemoteGateways,omitempty"` + // RemoteVirtualNetwork - The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + RemoteVirtualNetwork *SubResource `json:"remoteVirtualNetwork,omitempty"` + // RemoteAddressSpace - The reference to the address space peered with the remote virtual network. + RemoteAddressSpace *AddressSpace `json:"remoteAddressSpace,omitempty"` + // RemoteVirtualNetworkAddressSpace - The reference to the current address space of the remote virtual network. + RemoteVirtualNetworkAddressSpace *AddressSpace `json:"remoteVirtualNetworkAddressSpace,omitempty"` + // RemoteBgpCommunities - The reference to the remote virtual network's Bgp Communities. + RemoteBgpCommunities *VirtualNetworkBgpCommunities `json:"remoteBgpCommunities,omitempty"` + // RemoteVirtualNetworkEncryption - READ-ONLY; The reference to the remote virtual network's encryption + RemoteVirtualNetworkEncryption *VirtualNetworkEncryption `json:"remoteVirtualNetworkEncryption,omitempty"` + // PeeringState - The status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringStateInitiated', 'VirtualNetworkPeeringStateConnected', 'VirtualNetworkPeeringStateDisconnected' + PeeringState VirtualNetworkPeeringState `json:"peeringState,omitempty"` + // PeeringSyncLevel - The peering sync status of the virtual network peering. Possible values include: 'VirtualNetworkPeeringLevelFullyInSync', 'VirtualNetworkPeeringLevelRemoteNotInSync', 'VirtualNetworkPeeringLevelLocalNotInSync', 'VirtualNetworkPeeringLevelLocalAndRemoteNotInSync' + PeeringSyncLevel VirtualNetworkPeeringLevel `json:"peeringSyncLevel,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network peering resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DoNotVerifyRemoteGateways - If we need to verify the provisioning state of the remote gateway. + DoNotVerifyRemoteGateways *bool `json:"doNotVerifyRemoteGateways,omitempty"` + // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network peering resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPeeringPropertiesFormat. +func (vnppf VirtualNetworkPeeringPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnppf.AllowVirtualNetworkAccess != nil { + objectMap["allowVirtualNetworkAccess"] = vnppf.AllowVirtualNetworkAccess + } + if vnppf.AllowForwardedTraffic != nil { + objectMap["allowForwardedTraffic"] = vnppf.AllowForwardedTraffic + } + if vnppf.AllowGatewayTransit != nil { + objectMap["allowGatewayTransit"] = vnppf.AllowGatewayTransit + } + if vnppf.UseRemoteGateways != nil { + objectMap["useRemoteGateways"] = vnppf.UseRemoteGateways + } + if vnppf.RemoteVirtualNetwork != nil { + objectMap["remoteVirtualNetwork"] = vnppf.RemoteVirtualNetwork + } + if vnppf.RemoteAddressSpace != nil { + objectMap["remoteAddressSpace"] = vnppf.RemoteAddressSpace + } + if vnppf.RemoteVirtualNetworkAddressSpace != nil { + objectMap["remoteVirtualNetworkAddressSpace"] = vnppf.RemoteVirtualNetworkAddressSpace + } + if vnppf.RemoteBgpCommunities != nil { + objectMap["remoteBgpCommunities"] = vnppf.RemoteBgpCommunities + } + if vnppf.PeeringState != "" { + objectMap["peeringState"] = vnppf.PeeringState + } + if vnppf.PeeringSyncLevel != "" { + objectMap["peeringSyncLevel"] = vnppf.PeeringSyncLevel + } + if vnppf.DoNotVerifyRemoteGateways != nil { + objectMap["doNotVerifyRemoteGateways"] = vnppf.DoNotVerifyRemoteGateways + } + return json.Marshal(objectMap) +} + +// VirtualNetworkPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkPeeringsClient) (VirtualNetworkPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkPeeringsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkPeeringsCreateOrUpdateFuture) result(client VirtualNetworkPeeringsClient) (vnp VirtualNetworkPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnp.Response.Response, err = future.GetResult(sender); err == nil && vnp.Response.Response.StatusCode != http.StatusNoContent { + vnp, err = client.CreateOrUpdateResponder(vnp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsCreateOrUpdateFuture", "Result", vnp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkPeeringsDeleteFuture.Result. +func (future *VirtualNetworkPeeringsDeleteFuture) result(client VirtualNetworkPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkPropertiesFormat properties of the virtual network. +type VirtualNetworkPropertiesFormat struct { + // AddressSpace - The AddressSpace that contains an array of IP address ranges that can be used by subnets. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + // DhcpOptions - The dhcpOptions that contains an array of DNS servers available to VMs deployed in the virtual network. + DhcpOptions *DhcpOptions `json:"dhcpOptions,omitempty"` + // FlowTimeoutInMinutes - The FlowTimeout value (in minutes) for the Virtual Network + FlowTimeoutInMinutes *int32 `json:"flowTimeoutInMinutes,omitempty"` + // Subnets - A list of subnets in a Virtual Network. + Subnets *[]Subnet `json:"subnets,omitempty"` + // VirtualNetworkPeerings - A list of peerings in a Virtual Network. + VirtualNetworkPeerings *[]VirtualNetworkPeering `json:"virtualNetworkPeerings,omitempty"` + // ResourceGUID - READ-ONLY; The resourceGuid property of the Virtual Network resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // EnableDdosProtection - Indicates if DDoS protection is enabled for all the protected resources in the virtual network. It requires a DDoS protection plan associated with the resource. + EnableDdosProtection *bool `json:"enableDdosProtection,omitempty"` + // EnableVMProtection - Indicates if VM protection is enabled for all the subnets in the virtual network. + EnableVMProtection *bool `json:"enableVmProtection,omitempty"` + // DdosProtectionPlan - The DDoS protection plan associated with the virtual network. + DdosProtectionPlan *SubResource `json:"ddosProtectionPlan,omitempty"` + // BgpCommunities - Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. + BgpCommunities *VirtualNetworkBgpCommunities `json:"bgpCommunities,omitempty"` + // Encryption - Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. + Encryption *VirtualNetworkEncryption `json:"encryption,omitempty"` + // IPAllocations - Array of IpAllocation which reference this VNET. + IPAllocations *[]SubResource `json:"ipAllocations,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkPropertiesFormat. +func (vnpf VirtualNetworkPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnpf.AddressSpace != nil { + objectMap["addressSpace"] = vnpf.AddressSpace + } + if vnpf.DhcpOptions != nil { + objectMap["dhcpOptions"] = vnpf.DhcpOptions + } + if vnpf.FlowTimeoutInMinutes != nil { + objectMap["flowTimeoutInMinutes"] = vnpf.FlowTimeoutInMinutes + } + if vnpf.Subnets != nil { + objectMap["subnets"] = vnpf.Subnets + } + if vnpf.VirtualNetworkPeerings != nil { + objectMap["virtualNetworkPeerings"] = vnpf.VirtualNetworkPeerings + } + if vnpf.EnableDdosProtection != nil { + objectMap["enableDdosProtection"] = vnpf.EnableDdosProtection + } + if vnpf.EnableVMProtection != nil { + objectMap["enableVmProtection"] = vnpf.EnableVMProtection + } + if vnpf.DdosProtectionPlan != nil { + objectMap["ddosProtectionPlan"] = vnpf.DdosProtectionPlan + } + if vnpf.BgpCommunities != nil { + objectMap["bgpCommunities"] = vnpf.BgpCommunities + } + if vnpf.Encryption != nil { + objectMap["encryption"] = vnpf.Encryption + } + if vnpf.IPAllocations != nil { + objectMap["ipAllocations"] = vnpf.IPAllocations + } + return json.Marshal(objectMap) +} + +// VirtualNetworksCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworksCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (VirtualNetwork, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksCreateOrUpdateFuture.Result. +func (future *VirtualNetworksCreateOrUpdateFuture) result(client VirtualNetworksClient) (vn VirtualNetwork, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vn.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vn.Response.Response, err = future.GetResult(sender); err == nil && vn.Response.Response.StatusCode != http.StatusNoContent { + vn, err = client.CreateOrUpdateResponder(vn.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksCreateOrUpdateFuture", "Result", vn.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworksDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualNetworksDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworksClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworksDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworksDeleteFuture.Result. +func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworksDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkTap virtual Network Tap resource. +type VirtualNetworkTap struct { + autorest.Response `json:"-"` + // VirtualNetworkTapPropertiesFormat - Virtual Network Tap Properties. + *VirtualNetworkTapPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkTap. +func (vnt VirtualNetworkTap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vnt.VirtualNetworkTapPropertiesFormat != nil { + objectMap["properties"] = vnt.VirtualNetworkTapPropertiesFormat + } + if vnt.ID != nil { + objectMap["id"] = vnt.ID + } + if vnt.Location != nil { + objectMap["location"] = vnt.Location + } + if vnt.Tags != nil { + objectMap["tags"] = vnt.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualNetworkTap struct. +func (vnt *VirtualNetworkTap) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualNetworkTapPropertiesFormat VirtualNetworkTapPropertiesFormat + err = json.Unmarshal(*v, &virtualNetworkTapPropertiesFormat) + if err != nil { + return err + } + vnt.VirtualNetworkTapPropertiesFormat = &virtualNetworkTapPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vnt.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vnt.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vnt.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vnt.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vnt.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vnt.Tags = tags + } + } + } + + return nil +} + +// VirtualNetworkTapListResult response for ListVirtualNetworkTap API service call. +type VirtualNetworkTapListResult struct { + autorest.Response `json:"-"` + // Value - A list of VirtualNetworkTaps in a resource group. + Value *[]VirtualNetworkTap `json:"value,omitempty"` + // NextLink - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualNetworkTapListResultIterator provides access to a complete listing of VirtualNetworkTap values. +type VirtualNetworkTapListResultIterator struct { + i int + page VirtualNetworkTapListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualNetworkTapListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualNetworkTapListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualNetworkTapListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualNetworkTapListResultIterator) Response() VirtualNetworkTapListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualNetworkTapListResultIterator) Value() VirtualNetworkTap { + if !iter.page.NotDone() { + return VirtualNetworkTap{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualNetworkTapListResultIterator type. +func NewVirtualNetworkTapListResultIterator(page VirtualNetworkTapListResultPage) VirtualNetworkTapListResultIterator { + return VirtualNetworkTapListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vntlr VirtualNetworkTapListResult) IsEmpty() bool { + return vntlr.Value == nil || len(*vntlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vntlr VirtualNetworkTapListResult) hasNextLink() bool { + return vntlr.NextLink != nil && len(*vntlr.NextLink) != 0 +} + +// virtualNetworkTapListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vntlr VirtualNetworkTapListResult) virtualNetworkTapListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vntlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vntlr.NextLink))) +} + +// VirtualNetworkTapListResultPage contains a page of VirtualNetworkTap values. +type VirtualNetworkTapListResultPage struct { + fn func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error) + vntlr VirtualNetworkTapListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualNetworkTapListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vntlr) + if err != nil { + return err + } + page.vntlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualNetworkTapListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualNetworkTapListResultPage) NotDone() bool { + return !page.vntlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualNetworkTapListResultPage) Response() VirtualNetworkTapListResult { + return page.vntlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualNetworkTapListResultPage) Values() []VirtualNetworkTap { + if page.vntlr.IsEmpty() { + return nil + } + return *page.vntlr.Value +} + +// Creates a new instance of the VirtualNetworkTapListResultPage type. +func NewVirtualNetworkTapListResultPage(cur VirtualNetworkTapListResult, getNextPage func(context.Context, VirtualNetworkTapListResult) (VirtualNetworkTapListResult, error)) VirtualNetworkTapListResultPage { + return VirtualNetworkTapListResultPage{ + fn: getNextPage, + vntlr: cur, + } +} + +// VirtualNetworkTapPropertiesFormat virtual Network Tap properties. +type VirtualNetworkTapPropertiesFormat struct { + // NetworkInterfaceTapConfigurations - READ-ONLY; Specifies the list of resource IDs for the network interface IP configuration that needs to be tapped. + NetworkInterfaceTapConfigurations *[]InterfaceTapConfiguration `json:"networkInterfaceTapConfigurations,omitempty"` + // ResourceGUID - READ-ONLY; The resource GUID property of the virtual network tap resource. + ResourceGUID *string `json:"resourceGuid,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual network tap resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // DestinationNetworkInterfaceIPConfiguration - The reference to the private IP Address of the collector nic that will receive the tap. + DestinationNetworkInterfaceIPConfiguration *InterfaceIPConfiguration `json:"destinationNetworkInterfaceIPConfiguration,omitempty"` + // DestinationLoadBalancerFrontEndIPConfiguration - The reference to the private IP address on the internal Load Balancer that will receive the tap. + DestinationLoadBalancerFrontEndIPConfiguration *FrontendIPConfiguration `json:"destinationLoadBalancerFrontEndIPConfiguration,omitempty"` + // DestinationPort - The VXLAN destination port that will receive the tapped traffic. + DestinationPort *int32 `json:"destinationPort,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkTapPropertiesFormat. +func (vntpf VirtualNetworkTapPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vntpf.DestinationNetworkInterfaceIPConfiguration != nil { + objectMap["destinationNetworkInterfaceIPConfiguration"] = vntpf.DestinationNetworkInterfaceIPConfiguration + } + if vntpf.DestinationLoadBalancerFrontEndIPConfiguration != nil { + objectMap["destinationLoadBalancerFrontEndIPConfiguration"] = vntpf.DestinationLoadBalancerFrontEndIPConfiguration + } + if vntpf.DestinationPort != nil { + objectMap["destinationPort"] = vntpf.DestinationPort + } + return json.Marshal(objectMap) +} + +// VirtualNetworkTapsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkTapsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkTapsClient) (VirtualNetworkTap, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkTapsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkTapsCreateOrUpdateFuture.Result. +func (future *VirtualNetworkTapsCreateOrUpdateFuture) result(client VirtualNetworkTapsClient) (vnt VirtualNetworkTap, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vnt.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vnt.Response.Response, err = future.GetResult(sender); err == nil && vnt.Response.Response.StatusCode != http.StatusNoContent { + vnt, err = client.CreateOrUpdateResponder(vnt.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsCreateOrUpdateFuture", "Result", vnt.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualNetworkTapsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualNetworkTapsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualNetworkTapsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualNetworkTapsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualNetworkTapsDeleteFuture.Result. +func (future *VirtualNetworkTapsDeleteFuture) result(client VirtualNetworkTapsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkTapsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualNetworkUsage usage details for subnet. +type VirtualNetworkUsage struct { + // CurrentValue - READ-ONLY; Indicates number of IPs used from the Subnet. + CurrentValue *float64 `json:"currentValue,omitempty"` + // ID - READ-ONLY; Subnet identifier. + ID *string `json:"id,omitempty"` + // Limit - READ-ONLY; Indicates the size of the subnet. + Limit *float64 `json:"limit,omitempty"` + // Name - READ-ONLY; The name containing common and localized value for usage. + Name *VirtualNetworkUsageName `json:"name,omitempty"` + // Unit - READ-ONLY; Usage units. Returns 'Count'. + Unit *string `json:"unit,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkUsage. +func (vnu VirtualNetworkUsage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualNetworkUsageName usage strings container. +type VirtualNetworkUsageName struct { + // LocalizedValue - READ-ONLY; Localized subnet size and usage string. + LocalizedValue *string `json:"localizedValue,omitempty"` + // Value - READ-ONLY; Subnet size and usage string. + Value *string `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualNetworkUsageName. +func (vnun VirtualNetworkUsageName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VirtualRouter virtualRouter Resource. +type VirtualRouter struct { + autorest.Response `json:"-"` + // VirtualRouterPropertiesFormat - Properties of the Virtual Router. + *VirtualRouterPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualRouter. +func (vr VirtualRouter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.VirtualRouterPropertiesFormat != nil { + objectMap["properties"] = vr.VirtualRouterPropertiesFormat + } + if vr.ID != nil { + objectMap["id"] = vr.ID + } + if vr.Location != nil { + objectMap["location"] = vr.Location + } + if vr.Tags != nil { + objectMap["tags"] = vr.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualRouter struct. +func (vr *VirtualRouter) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualRouterPropertiesFormat VirtualRouterPropertiesFormat + err = json.Unmarshal(*v, &virtualRouterPropertiesFormat) + if err != nil { + return err + } + vr.VirtualRouterPropertiesFormat = &virtualRouterPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vr.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vr.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vr.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vr.Tags = tags + } + } + } + + return nil +} + +// VirtualRouterListResult response for ListVirtualRouters API service call. +type VirtualRouterListResult struct { + autorest.Response `json:"-"` + // Value - List of Virtual Routers. + Value *[]VirtualRouter `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualRouterListResultIterator provides access to a complete listing of VirtualRouter values. +type VirtualRouterListResultIterator struct { + i int + page VirtualRouterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualRouterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualRouterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualRouterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualRouterListResultIterator) Response() VirtualRouterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualRouterListResultIterator) Value() VirtualRouter { + if !iter.page.NotDone() { + return VirtualRouter{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualRouterListResultIterator type. +func NewVirtualRouterListResultIterator(page VirtualRouterListResultPage) VirtualRouterListResultIterator { + return VirtualRouterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vrlr VirtualRouterListResult) IsEmpty() bool { + return vrlr.Value == nil || len(*vrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vrlr VirtualRouterListResult) hasNextLink() bool { + return vrlr.NextLink != nil && len(*vrlr.NextLink) != 0 +} + +// virtualRouterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vrlr VirtualRouterListResult) virtualRouterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vrlr.NextLink))) +} + +// VirtualRouterListResultPage contains a page of VirtualRouter values. +type VirtualRouterListResultPage struct { + fn func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error) + vrlr VirtualRouterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualRouterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vrlr) + if err != nil { + return err + } + page.vrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualRouterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualRouterListResultPage) NotDone() bool { + return !page.vrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualRouterListResultPage) Response() VirtualRouterListResult { + return page.vrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualRouterListResultPage) Values() []VirtualRouter { + if page.vrlr.IsEmpty() { + return nil + } + return *page.vrlr.Value +} + +// Creates a new instance of the VirtualRouterListResultPage type. +func NewVirtualRouterListResultPage(cur VirtualRouterListResult, getNextPage func(context.Context, VirtualRouterListResult) (VirtualRouterListResult, error)) VirtualRouterListResultPage { + return VirtualRouterListResultPage{ + fn: getNextPage, + vrlr: cur, + } +} + +// VirtualRouterPeering virtual Router Peering resource. +type VirtualRouterPeering struct { + autorest.Response `json:"-"` + // VirtualRouterPeeringProperties - The properties of the Virtual Router Peering. + *VirtualRouterPeeringProperties `json:"properties,omitempty"` + // Name - Name of the virtual router peering that is unique within a virtual router. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Peering type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPeering. +func (vrp VirtualRouterPeering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrp.VirtualRouterPeeringProperties != nil { + objectMap["properties"] = vrp.VirtualRouterPeeringProperties + } + if vrp.Name != nil { + objectMap["name"] = vrp.Name + } + if vrp.ID != nil { + objectMap["id"] = vrp.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualRouterPeering struct. +func (vrp *VirtualRouterPeering) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualRouterPeeringProperties VirtualRouterPeeringProperties + err = json.Unmarshal(*v, &virtualRouterPeeringProperties) + if err != nil { + return err + } + vrp.VirtualRouterPeeringProperties = &virtualRouterPeeringProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vrp.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vrp.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vrp.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vrp.ID = &ID + } + } + } + + return nil +} + +// VirtualRouterPeeringListResult response for ListVirtualRouterPeerings API service call. +type VirtualRouterPeeringListResult struct { + autorest.Response `json:"-"` + // Value - List of VirtualRouterPeerings in a VirtualRouter. + Value *[]VirtualRouterPeering `json:"value,omitempty"` + // NextLink - URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// VirtualRouterPeeringListResultIterator provides access to a complete listing of VirtualRouterPeering +// values. +type VirtualRouterPeeringListResultIterator struct { + i int + page VirtualRouterPeeringListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *VirtualRouterPeeringListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *VirtualRouterPeeringListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter VirtualRouterPeeringListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter VirtualRouterPeeringListResultIterator) Response() VirtualRouterPeeringListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter VirtualRouterPeeringListResultIterator) Value() VirtualRouterPeering { + if !iter.page.NotDone() { + return VirtualRouterPeering{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the VirtualRouterPeeringListResultIterator type. +func NewVirtualRouterPeeringListResultIterator(page VirtualRouterPeeringListResultPage) VirtualRouterPeeringListResultIterator { + return VirtualRouterPeeringListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (vrplr VirtualRouterPeeringListResult) IsEmpty() bool { + return vrplr.Value == nil || len(*vrplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (vrplr VirtualRouterPeeringListResult) hasNextLink() bool { + return vrplr.NextLink != nil && len(*vrplr.NextLink) != 0 +} + +// virtualRouterPeeringListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (vrplr VirtualRouterPeeringListResult) virtualRouterPeeringListResultPreparer(ctx context.Context) (*http.Request, error) { + if !vrplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(vrplr.NextLink))) +} + +// VirtualRouterPeeringListResultPage contains a page of VirtualRouterPeering values. +type VirtualRouterPeeringListResultPage struct { + fn func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error) + vrplr VirtualRouterPeeringListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *VirtualRouterPeeringListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.vrplr) + if err != nil { + return err + } + page.vrplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *VirtualRouterPeeringListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page VirtualRouterPeeringListResultPage) NotDone() bool { + return !page.vrplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page VirtualRouterPeeringListResultPage) Response() VirtualRouterPeeringListResult { + return page.vrplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page VirtualRouterPeeringListResultPage) Values() []VirtualRouterPeering { + if page.vrplr.IsEmpty() { + return nil + } + return *page.vrplr.Value +} + +// Creates a new instance of the VirtualRouterPeeringListResultPage type. +func NewVirtualRouterPeeringListResultPage(cur VirtualRouterPeeringListResult, getNextPage func(context.Context, VirtualRouterPeeringListResult) (VirtualRouterPeeringListResult, error)) VirtualRouterPeeringListResultPage { + return VirtualRouterPeeringListResultPage{ + fn: getNextPage, + vrplr: cur, + } +} + +// VirtualRouterPeeringProperties properties of the rule group. +type VirtualRouterPeeringProperties struct { + // PeerAsn - Peer ASN. + PeerAsn *int64 `json:"peerAsn,omitempty"` + // PeerIP - Peer IP. + PeerIP *string `json:"peerIp,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPeeringProperties. +func (vrpp VirtualRouterPeeringProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrpp.PeerAsn != nil { + objectMap["peerAsn"] = vrpp.PeerAsn + } + if vrpp.PeerIP != nil { + objectMap["peerIp"] = vrpp.PeerIP + } + return json.Marshal(objectMap) +} + +// VirtualRouterPeeringsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRouterPeeringsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRouterPeeringsClient) (VirtualRouterPeering, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRouterPeeringsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRouterPeeringsCreateOrUpdateFuture.Result. +func (future *VirtualRouterPeeringsCreateOrUpdateFuture) result(client VirtualRouterPeeringsClient) (vrp VirtualRouterPeering, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vrp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vrp.Response.Response, err = future.GetResult(sender); err == nil && vrp.Response.Response.StatusCode != http.StatusNoContent { + vrp, err = client.CreateOrUpdateResponder(vrp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsCreateOrUpdateFuture", "Result", vrp.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualRouterPeeringsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRouterPeeringsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRouterPeeringsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRouterPeeringsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRouterPeeringsDeleteFuture.Result. +func (future *VirtualRouterPeeringsDeleteFuture) result(client VirtualRouterPeeringsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRouterPeeringsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualRouterPropertiesFormat virtual Router definition. +type VirtualRouterPropertiesFormat struct { + // VirtualRouterAsn - VirtualRouter ASN. + VirtualRouterAsn *int64 `json:"virtualRouterAsn,omitempty"` + // VirtualRouterIps - VirtualRouter IPs. + VirtualRouterIps *[]string `json:"virtualRouterIps,omitempty"` + // HostedSubnet - The Subnet on which VirtualRouter is hosted. + HostedSubnet *SubResource `json:"hostedSubnet,omitempty"` + // HostedGateway - The Gateway on which VirtualRouter is hosted. + HostedGateway *SubResource `json:"hostedGateway,omitempty"` + // Peerings - READ-ONLY; List of references to VirtualRouterPeerings. + Peerings *[]SubResource `json:"peerings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualRouterPropertiesFormat. +func (vrpf VirtualRouterPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vrpf.VirtualRouterAsn != nil { + objectMap["virtualRouterAsn"] = vrpf.VirtualRouterAsn + } + if vrpf.VirtualRouterIps != nil { + objectMap["virtualRouterIps"] = vrpf.VirtualRouterIps + } + if vrpf.HostedSubnet != nil { + objectMap["hostedSubnet"] = vrpf.HostedSubnet + } + if vrpf.HostedGateway != nil { + objectMap["hostedGateway"] = vrpf.HostedGateway + } + return json.Marshal(objectMap) +} + +// VirtualRoutersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualRoutersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRoutersClient) (VirtualRouter, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRoutersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRoutersCreateOrUpdateFuture.Result. +func (future *VirtualRoutersCreateOrUpdateFuture) result(client VirtualRoutersClient) (vr VirtualRouter, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vr.Response.Response, err = future.GetResult(sender); err == nil && vr.Response.Response.StatusCode != http.StatusNoContent { + vr, err = client.CreateOrUpdateResponder(vr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersCreateOrUpdateFuture", "Result", vr.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualRoutersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualRoutersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualRoutersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualRoutersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualRoutersDeleteFuture.Result. +func (future *VirtualRoutersDeleteFuture) result(client VirtualRoutersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualRoutersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualWAN virtualWAN Resource. +type VirtualWAN struct { + autorest.Response `json:"-"` + // VirtualWanProperties - Properties of the virtual WAN. + *VirtualWanProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VirtualWAN. +func (vw VirtualWAN) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vw.VirtualWanProperties != nil { + objectMap["properties"] = vw.VirtualWanProperties + } + if vw.ID != nil { + objectMap["id"] = vw.ID + } + if vw.Location != nil { + objectMap["location"] = vw.Location + } + if vw.Tags != nil { + objectMap["tags"] = vw.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VirtualWAN struct. +func (vw *VirtualWAN) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var virtualWanProperties VirtualWanProperties + err = json.Unmarshal(*v, &virtualWanProperties) + if err != nil { + return err + } + vw.VirtualWanProperties = &virtualWanProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vw.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vw.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vw.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vw.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vw.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vw.Tags = tags + } + } + } + + return nil +} + +// VirtualWanProperties parameters for VirtualWAN. +type VirtualWanProperties struct { + // DisableVpnEncryption - Vpn encryption to be disabled or not. + DisableVpnEncryption *bool `json:"disableVpnEncryption,omitempty"` + // VirtualHubs - READ-ONLY; List of VirtualHubs in the VirtualWAN. + VirtualHubs *[]SubResource `json:"virtualHubs,omitempty"` + // VpnSites - READ-ONLY; List of VpnSites in the VirtualWAN. + VpnSites *[]SubResource `json:"vpnSites,omitempty"` + // AllowBranchToBranchTraffic - True if branch to branch traffic is allowed. + AllowBranchToBranchTraffic *bool `json:"allowBranchToBranchTraffic,omitempty"` + // AllowVnetToVnetTraffic - True if Vnet to Vnet traffic is allowed. + AllowVnetToVnetTraffic *bool `json:"allowVnetToVnetTraffic,omitempty"` + // Office365LocalBreakoutCategory - The office local breakout category. Possible values include: 'OfficeTrafficCategoryOptimize', 'OfficeTrafficCategoryOptimizeAndAllow', 'OfficeTrafficCategoryAll', 'OfficeTrafficCategoryNone' + Office365LocalBreakoutCategory OfficeTrafficCategory `json:"office365LocalBreakoutCategory,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the virtual WAN resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of the VirtualWAN. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for VirtualWanProperties. +func (vwp VirtualWanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vwp.DisableVpnEncryption != nil { + objectMap["disableVpnEncryption"] = vwp.DisableVpnEncryption + } + if vwp.AllowBranchToBranchTraffic != nil { + objectMap["allowBranchToBranchTraffic"] = vwp.AllowBranchToBranchTraffic + } + if vwp.AllowVnetToVnetTraffic != nil { + objectMap["allowVnetToVnetTraffic"] = vwp.AllowVnetToVnetTraffic + } + if vwp.Office365LocalBreakoutCategory != "" { + objectMap["office365LocalBreakoutCategory"] = vwp.Office365LocalBreakoutCategory + } + if vwp.Type != nil { + objectMap["type"] = vwp.Type + } + return json.Marshal(objectMap) +} + +// VirtualWansCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VirtualWansCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualWansClient) (VirtualWAN, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualWansCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualWansCreateOrUpdateFuture.Result. +func (future *VirtualWansCreateOrUpdateFuture) result(client VirtualWansClient) (vw VirtualWAN, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vw.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualWansCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vw.Response.Response, err = future.GetResult(sender); err == nil && vw.Response.Response.StatusCode != http.StatusNoContent { + vw, err = client.CreateOrUpdateResponder(vw.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansCreateOrUpdateFuture", "Result", vw.Response.Response, "Failure responding to request") + } + } + return +} + +// VirtualWansDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VirtualWansDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VirtualWansClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VirtualWansDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VirtualWansDeleteFuture.Result. +func (future *VirtualWansDeleteFuture) result(client VirtualWansClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VirtualWansDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VirtualWanSecurityProvider collection of SecurityProviders. +type VirtualWanSecurityProvider struct { + // Name - Name of the security provider. + Name *string `json:"name,omitempty"` + // URL - Url of the security provider. + URL *string `json:"url,omitempty"` + // Type - Name of the security provider. Possible values include: 'VirtualWanSecurityProviderTypeExternal', 'VirtualWanSecurityProviderTypeNative' + Type VirtualWanSecurityProviderType `json:"type,omitempty"` +} + +// VirtualWanSecurityProviders collection of SecurityProviders. +type VirtualWanSecurityProviders struct { + autorest.Response `json:"-"` + // SupportedProviders - List of VirtualWAN security providers. + SupportedProviders *[]VirtualWanSecurityProvider `json:"supportedProviders,omitempty"` +} + +// VirtualWanVpnProfileParameters virtual Wan Vpn profile parameters Vpn profile generation. +type VirtualWanVpnProfileParameters struct { + // VpnServerConfigurationResourceID - VpnServerConfiguration partial resource uri with which VirtualWan is associated to. + VpnServerConfigurationResourceID *string `json:"vpnServerConfigurationResourceId,omitempty"` + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` +} + +// VM describes a Virtual Machine. +type VM struct { + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VM. +func (vVar VM) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vVar.ID != nil { + objectMap["id"] = vVar.ID + } + if vVar.Location != nil { + objectMap["location"] = vVar.Location + } + if vVar.Tags != nil { + objectMap["tags"] = vVar.Tags + } + return json.Marshal(objectMap) +} + +// VnetRoute list of routes that control routing from VirtualHub into a virtual network connection. +type VnetRoute struct { + // StaticRoutes - List of all Static Routes. + StaticRoutes *[]StaticRoute `json:"staticRoutes,omitempty"` + // BgpConnections - READ-ONLY; The list of references to HubBgpConnection objects. + BgpConnections *[]SubResource `json:"bgpConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for VnetRoute. +func (vr VnetRoute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.StaticRoutes != nil { + objectMap["staticRoutes"] = vr.StaticRoutes + } + return json.Marshal(objectMap) +} + +// VpnClientConfiguration vpnClientConfiguration for P2S client. +type VpnClientConfiguration struct { + // VpnClientAddressPool - The reference to the address space resource which represents Address space for P2S VpnClient. + VpnClientAddressPool *AddressSpace `json:"vpnClientAddressPool,omitempty"` + // VpnClientRootCertificates - VpnClientRootCertificate for virtual network gateway. + VpnClientRootCertificates *[]VpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + // VpnClientRevokedCertificates - VpnClientRevokedCertificate for Virtual network gateway. + VpnClientRevokedCertificates *[]VpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + // VpnClientProtocols - VpnClientProtocols for Virtual network gateway. + VpnClientProtocols *[]VpnClientProtocol `json:"vpnClientProtocols,omitempty"` + // VpnAuthenticationTypes - VPN authentication types for the virtual network gateway.. + VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + // VpnClientIpsecPolicies - VpnClientIpsecPolicies for virtual network gateway P2S client. + VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + // RadiusServerAddress - The radius server address property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerSecret - The radius secret property of the VirtualNetworkGateway resource for vpn client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + // RadiusServers - The radiusServers property for multiple radius server configuration. + RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` + // AadTenant - The AADTenant property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadTenant *string `json:"aadTenant,omitempty"` + // AadAudience - The AADAudience property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadAudience *string `json:"aadAudience,omitempty"` + // AadIssuer - The AADIssuer property of the VirtualNetworkGateway resource for vpn client connection used for AAD authentication. + AadIssuer *string `json:"aadIssuer,omitempty"` +} + +// VpnClientConnectionHealth vpnClientConnectionHealth properties. +type VpnClientConnectionHealth struct { + // TotalIngressBytesTransferred - READ-ONLY; Total of the Ingress Bytes Transferred in this P2S Vpn connection. + TotalIngressBytesTransferred *int64 `json:"totalIngressBytesTransferred,omitempty"` + // TotalEgressBytesTransferred - READ-ONLY; Total of the Egress Bytes Transferred in this connection. + TotalEgressBytesTransferred *int64 `json:"totalEgressBytesTransferred,omitempty"` + // VpnClientConnectionsCount - The total of p2s vpn clients connected at this time to this P2SVpnGateway. + VpnClientConnectionsCount *int32 `json:"vpnClientConnectionsCount,omitempty"` + // AllocatedIPAddresses - List of allocated ip addresses to the connected p2s vpn clients. + AllocatedIPAddresses *[]string `json:"allocatedIpAddresses,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientConnectionHealth. +func (vcch VpnClientConnectionHealth) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcch.VpnClientConnectionsCount != nil { + objectMap["vpnClientConnectionsCount"] = vcch.VpnClientConnectionsCount + } + if vcch.AllocatedIPAddresses != nil { + objectMap["allocatedIpAddresses"] = vcch.AllocatedIPAddresses + } + return json.Marshal(objectMap) +} + +// VpnClientConnectionHealthDetail VPN client connection health detail. +type VpnClientConnectionHealthDetail struct { + // VpnConnectionID - READ-ONLY; The vpn client Id. + VpnConnectionID *string `json:"vpnConnectionId,omitempty"` + // VpnConnectionDuration - READ-ONLY; The duration time of a connected vpn client. + VpnConnectionDuration *int64 `json:"vpnConnectionDuration,omitempty"` + // VpnConnectionTime - READ-ONLY; The start time of a connected vpn client. + VpnConnectionTime *string `json:"vpnConnectionTime,omitempty"` + // PublicIPAddress - READ-ONLY; The public Ip of a connected vpn client. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - READ-ONLY; The assigned private Ip of a connected vpn client. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + // VpnUserName - READ-ONLY; The user name of a connected vpn client. + VpnUserName *string `json:"vpnUserName,omitempty"` + // MaxBandwidth - READ-ONLY; The max band width. + MaxBandwidth *int64 `json:"maxBandwidth,omitempty"` + // EgressPacketsTransferred - READ-ONLY; The egress packets per second. + EgressPacketsTransferred *int64 `json:"egressPacketsTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; The egress bytes per second. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // IngressPacketsTransferred - READ-ONLY; The ingress packets per second. + IngressPacketsTransferred *int64 `json:"ingressPacketsTransferred,omitempty"` + // IngressBytesTransferred - READ-ONLY; The ingress bytes per second. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // MaxPacketsPerSecond - READ-ONLY; The max packets transferred per second. + MaxPacketsPerSecond *int64 `json:"maxPacketsPerSecond,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientConnectionHealthDetail. +func (vcchd VpnClientConnectionHealthDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VpnClientConnectionHealthDetailListResult list of virtual network gateway vpn client connection health. +type VpnClientConnectionHealthDetailListResult struct { + autorest.Response `json:"-"` + // Value - List of vpn client connection health. + Value *[]VpnClientConnectionHealthDetail `json:"value,omitempty"` +} + +// VpnClientIPsecParameters an IPSec parameters for a virtual network gateway P2S connection. +type VpnClientIPsecParameters struct { + autorest.Response `json:"-"` + // SaLifeTimeSeconds - The IPSec Security Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + SaLifeTimeSeconds *int32 `json:"saLifeTimeSeconds,omitempty"` + // SaDataSizeKilobytes - The IPSec Security Association (also called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + SaDataSizeKilobytes *int32 `json:"saDataSizeKilobytes,omitempty"` + // IpsecEncryption - The IPSec encryption algorithm (IKE phase 1). Possible values include: 'IpsecEncryptionNone', 'IpsecEncryptionDES', 'IpsecEncryptionDES3', 'IpsecEncryptionAES128', 'IpsecEncryptionAES192', 'IpsecEncryptionAES256', 'IpsecEncryptionGCMAES128', 'IpsecEncryptionGCMAES192', 'IpsecEncryptionGCMAES256' + IpsecEncryption IpsecEncryption `json:"ipsecEncryption,omitempty"` + // IpsecIntegrity - The IPSec integrity algorithm (IKE phase 1). Possible values include: 'IpsecIntegrityMD5', 'IpsecIntegritySHA1', 'IpsecIntegritySHA256', 'IpsecIntegrityGCMAES128', 'IpsecIntegrityGCMAES192', 'IpsecIntegrityGCMAES256' + IpsecIntegrity IpsecIntegrity `json:"ipsecIntegrity,omitempty"` + // IkeEncryption - The IKE encryption algorithm (IKE phase 2). Possible values include: 'IkeEncryptionDES', 'IkeEncryptionDES3', 'IkeEncryptionAES128', 'IkeEncryptionAES192', 'IkeEncryptionAES256', 'IkeEncryptionGCMAES256', 'IkeEncryptionGCMAES128' + IkeEncryption IkeEncryption `json:"ikeEncryption,omitempty"` + // IkeIntegrity - The IKE integrity algorithm (IKE phase 2). Possible values include: 'IkeIntegrityMD5', 'IkeIntegritySHA1', 'IkeIntegritySHA256', 'IkeIntegritySHA384', 'IkeIntegrityGCMAES256', 'IkeIntegrityGCMAES128' + IkeIntegrity IkeIntegrity `json:"ikeIntegrity,omitempty"` + // DhGroup - The DH Group used in IKE Phase 1 for initial SA. Possible values include: 'DhGroupNone', 'DhGroupDHGroup1', 'DhGroupDHGroup2', 'DhGroupDHGroup14', 'DhGroupDHGroup2048', 'DhGroupECP256', 'DhGroupECP384', 'DhGroupDHGroup24' + DhGroup DhGroup `json:"dhGroup,omitempty"` + // PfsGroup - The Pfs Group used in IKE Phase 2 for new child SA. Possible values include: 'PfsGroupNone', 'PfsGroupPFS1', 'PfsGroupPFS2', 'PfsGroupPFS2048', 'PfsGroupECP256', 'PfsGroupECP384', 'PfsGroupPFS24', 'PfsGroupPFS14', 'PfsGroupPFSMM' + PfsGroup PfsGroup `json:"pfsGroup,omitempty"` +} + +// VpnClientParameters vpn Client Parameters for package generation. +type VpnClientParameters struct { + // ProcessorArchitecture - VPN client Processor Architecture. Possible values include: 'ProcessorArchitectureAmd64', 'ProcessorArchitectureX86' + ProcessorArchitecture ProcessorArchitecture `json:"processorArchitecture,omitempty"` + // AuthenticationMethod - VPN client authentication method. Possible values include: 'AuthenticationMethodEAPTLS', 'AuthenticationMethodEAPMSCHAPv2' + AuthenticationMethod AuthenticationMethod `json:"authenticationMethod,omitempty"` + // RadiusServerAuthCertificate - The public certificate data for the radius server authentication certificate as a Base-64 encoded string. Required only if external radius authentication has been configured with EAPTLS authentication. + RadiusServerAuthCertificate *string `json:"radiusServerAuthCertificate,omitempty"` + // ClientRootCertificates - A list of client root certificates public certificate data encoded as Base-64 strings. Optional parameter for external radius based authentication with EAPTLS. + ClientRootCertificates *[]string `json:"clientRootCertificates,omitempty"` +} + +// VpnClientRevokedCertificate VPN client revoked certificate of virtual network gateway. +type VpnClientRevokedCertificate struct { + // VpnClientRevokedCertificatePropertiesFormat - Properties of the vpn client revoked certificate. + *VpnClientRevokedCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRevokedCertificate. +func (vcrc VpnClientRevokedCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrc.VpnClientRevokedCertificatePropertiesFormat != nil { + objectMap["properties"] = vcrc.VpnClientRevokedCertificatePropertiesFormat + } + if vcrc.Name != nil { + objectMap["name"] = vcrc.Name + } + if vcrc.ID != nil { + objectMap["id"] = vcrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnClientRevokedCertificate struct. +func (vcrc *VpnClientRevokedCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnClientRevokedCertificatePropertiesFormat VpnClientRevokedCertificatePropertiesFormat + err = json.Unmarshal(*v, &vpnClientRevokedCertificatePropertiesFormat) + if err != nil { + return err + } + vcrc.VpnClientRevokedCertificatePropertiesFormat = &vpnClientRevokedCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vcrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vcrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vcrc.ID = &ID + } + } + } + + return nil +} + +// VpnClientRevokedCertificatePropertiesFormat properties of the revoked VPN client certificate of virtual +// network gateway. +type VpnClientRevokedCertificatePropertiesFormat struct { + // Thumbprint - The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN client revoked certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRevokedCertificatePropertiesFormat. +func (vcrcpf VpnClientRevokedCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrcpf.Thumbprint != nil { + objectMap["thumbprint"] = vcrcpf.Thumbprint + } + return json.Marshal(objectMap) +} + +// VpnClientRootCertificate VPN client root certificate of virtual network gateway. +type VpnClientRootCertificate struct { + // VpnClientRootCertificatePropertiesFormat - Properties of the vpn client root certificate. + *VpnClientRootCertificatePropertiesFormat `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRootCertificate. +func (vcrc VpnClientRootCertificate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrc.VpnClientRootCertificatePropertiesFormat != nil { + objectMap["properties"] = vcrc.VpnClientRootCertificatePropertiesFormat + } + if vcrc.Name != nil { + objectMap["name"] = vcrc.Name + } + if vcrc.ID != nil { + objectMap["id"] = vcrc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnClientRootCertificate struct. +func (vcrc *VpnClientRootCertificate) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnClientRootCertificatePropertiesFormat VpnClientRootCertificatePropertiesFormat + err = json.Unmarshal(*v, &vpnClientRootCertificatePropertiesFormat) + if err != nil { + return err + } + vcrc.VpnClientRootCertificatePropertiesFormat = &vpnClientRootCertificatePropertiesFormat + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vcrc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vcrc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vcrc.ID = &ID + } + } + } + + return nil +} + +// VpnClientRootCertificatePropertiesFormat properties of SSL certificates of application gateway. +type VpnClientRootCertificatePropertiesFormat struct { + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN client root certificate resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnClientRootCertificatePropertiesFormat. +func (vcrcpf VpnClientRootCertificatePropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcrcpf.PublicCertData != nil { + objectMap["publicCertData"] = vcrcpf.PublicCertData + } + return json.Marshal(objectMap) +} + +// VpnConnection vpnConnection Resource. +type VpnConnection struct { + autorest.Response `json:"-"` + // VpnConnectionProperties - Properties of the VPN connection. + *VpnConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnConnection. +func (vc VpnConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vc.VpnConnectionProperties != nil { + objectMap["properties"] = vc.VpnConnectionProperties + } + if vc.Name != nil { + objectMap["name"] = vc.Name + } + if vc.ID != nil { + objectMap["id"] = vc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnConnection struct. +func (vc *VpnConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnConnectionProperties VpnConnectionProperties + err = json.Unmarshal(*v, &vpnConnectionProperties) + if err != nil { + return err + } + vc.VpnConnectionProperties = &vpnConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vc.ID = &ID + } + } + } + + return nil +} + +// VpnConnectionPacketCaptureStartParameters vpn Connection packet capture parameters supplied to start +// packet capture on gateway connection. +type VpnConnectionPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters on vpn connection. + FilterData *string `json:"filterData,omitempty"` + // LinkConnectionNames - List of site link connection names. + LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` +} + +// VpnConnectionPacketCaptureStopParameters vpn Connection packet capture parameters supplied to stop +// packet capture on gateway connection. +type VpnConnectionPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on vpn connection. + SasURL *string `json:"sasUrl,omitempty"` + // LinkConnectionNames - List of site link connection names. + LinkConnectionNames *[]string `json:"linkConnectionNames,omitempty"` +} + +// VpnConnectionProperties parameters for VpnConnection. +type VpnConnectionProperties struct { + // RemoteVpnSite - Id of the connected vpn site. + RemoteVpnSite *SubResource `json:"remoteVpnSite,omitempty"` + // RoutingWeight - Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // DpdTimeoutSeconds - DPD timeout in seconds for vpn connection. + DpdTimeoutSeconds *int32 `json:"dpdTimeoutSeconds,omitempty"` + // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' + ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` + // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // ConnectionBandwidth - Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + // SharedKey - SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // TrafficSelectorPolicies - The Traffic Selector Policies to be considered by this connection. + TrafficSelectorPolicies *[]TrafficSelectorPolicy `json:"trafficSelectorPolicies,omitempty"` + // EnableRateLimiting - EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + // EnableInternetSecurity - Enable internet security. + EnableInternetSecurity *bool `json:"enableInternetSecurity,omitempty"` + // UseLocalAzureIPAddress - Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnLinkConnections - List of all vpn site link connections to the gateway. + VpnLinkConnections *[]VpnSiteLinkConnection `json:"vpnLinkConnections,omitempty"` + // RoutingConfiguration - The Routing Configuration indicating the associated and propagated route tables on this connection. + RoutingConfiguration *RoutingConfiguration `json:"routingConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnConnectionProperties. +func (vcp VpnConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vcp.RemoteVpnSite != nil { + objectMap["remoteVpnSite"] = vcp.RemoteVpnSite + } + if vcp.RoutingWeight != nil { + objectMap["routingWeight"] = vcp.RoutingWeight + } + if vcp.DpdTimeoutSeconds != nil { + objectMap["dpdTimeoutSeconds"] = vcp.DpdTimeoutSeconds + } + if vcp.ConnectionStatus != "" { + objectMap["connectionStatus"] = vcp.ConnectionStatus + } + if vcp.VpnConnectionProtocolType != "" { + objectMap["vpnConnectionProtocolType"] = vcp.VpnConnectionProtocolType + } + if vcp.ConnectionBandwidth != nil { + objectMap["connectionBandwidth"] = vcp.ConnectionBandwidth + } + if vcp.SharedKey != nil { + objectMap["sharedKey"] = vcp.SharedKey + } + if vcp.EnableBgp != nil { + objectMap["enableBgp"] = vcp.EnableBgp + } + if vcp.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vcp.UsePolicyBasedTrafficSelectors + } + if vcp.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vcp.IpsecPolicies + } + if vcp.TrafficSelectorPolicies != nil { + objectMap["trafficSelectorPolicies"] = vcp.TrafficSelectorPolicies + } + if vcp.EnableRateLimiting != nil { + objectMap["enableRateLimiting"] = vcp.EnableRateLimiting + } + if vcp.EnableInternetSecurity != nil { + objectMap["enableInternetSecurity"] = vcp.EnableInternetSecurity + } + if vcp.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vcp.UseLocalAzureIPAddress + } + if vcp.VpnLinkConnections != nil { + objectMap["vpnLinkConnections"] = vcp.VpnLinkConnections + } + if vcp.RoutingConfiguration != nil { + objectMap["routingConfiguration"] = vcp.RoutingConfiguration + } + return json.Marshal(objectMap) +} + +// VpnConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (VpnConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsCreateOrUpdateFuture.Result. +func (future *VpnConnectionsCreateOrUpdateFuture) result(client VpnConnectionsClient) (vc VpnConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent { + vc, err = client.CreateOrUpdateResponder(vc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsCreateOrUpdateFuture", "Result", vc.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsDeleteFuture.Result. +func (future *VpnConnectionsDeleteFuture) result(client VpnConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnConnectionsStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsStartPacketCaptureFuture.Result. +func (future *VpnConnectionsStartPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnConnectionsStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnConnectionsStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnConnectionsStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnConnectionsStopPacketCaptureFuture.Result. +func (future *VpnConnectionsStopPacketCaptureFuture) result(client VpnConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnConnectionsStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnDeviceScriptParameters vpn device configuration script generation parameters. +type VpnDeviceScriptParameters struct { + // Vendor - The vendor for the vpn device. + Vendor *string `json:"vendor,omitempty"` + // DeviceFamily - The device family for the vpn device. + DeviceFamily *string `json:"deviceFamily,omitempty"` + // FirmwareVersion - The firmware version for the vpn device. + FirmwareVersion *string `json:"firmwareVersion,omitempty"` +} + +// VpnGateway vpnGateway Resource. +type VpnGateway struct { + autorest.Response `json:"-"` + // VpnGatewayProperties - Properties of the VPN gateway. + *VpnGatewayProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnGateway. +func (vg VpnGateway) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vg.VpnGatewayProperties != nil { + objectMap["properties"] = vg.VpnGatewayProperties + } + if vg.ID != nil { + objectMap["id"] = vg.ID + } + if vg.Location != nil { + objectMap["location"] = vg.Location + } + if vg.Tags != nil { + objectMap["tags"] = vg.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnGateway struct. +func (vg *VpnGateway) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnGatewayProperties VpnGatewayProperties + err = json.Unmarshal(*v, &vpnGatewayProperties) + if err != nil { + return err + } + vg.VpnGatewayProperties = &vpnGatewayProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vg.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vg.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vg.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vg.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vg.Tags = tags + } + } + } + + return nil +} + +// VpnGatewayIPConfiguration IP Configuration of a VPN Gateway Resource. +type VpnGatewayIPConfiguration struct { + // ID - The identifier of the IP configuration for a VPN Gateway. + ID *string `json:"id,omitempty"` + // PublicIPAddress - The public IP address of this IP configuration. + PublicIPAddress *string `json:"publicIpAddress,omitempty"` + // PrivateIPAddress - The private IP address of this IP configuration. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` +} + +// VpnGatewayNatRule vpnGatewayNatRule Resource. +type VpnGatewayNatRule struct { + autorest.Response `json:"-"` + // VpnGatewayNatRuleProperties - Properties of the VpnGateway NAT rule. + *VpnGatewayNatRuleProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayNatRule. +func (vgnr VpnGatewayNatRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgnr.VpnGatewayNatRuleProperties != nil { + objectMap["properties"] = vgnr.VpnGatewayNatRuleProperties + } + if vgnr.Name != nil { + objectMap["name"] = vgnr.Name + } + if vgnr.ID != nil { + objectMap["id"] = vgnr.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnGatewayNatRule struct. +func (vgnr *VpnGatewayNatRule) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnGatewayNatRuleProperties VpnGatewayNatRuleProperties + err = json.Unmarshal(*v, &vpnGatewayNatRuleProperties) + if err != nil { + return err + } + vgnr.VpnGatewayNatRuleProperties = &vpnGatewayNatRuleProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vgnr.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vgnr.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vgnr.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vgnr.ID = &ID + } + } + } + + return nil +} + +// VpnGatewayNatRuleProperties parameters for VpnGatewayNatRule. +type VpnGatewayNatRuleProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state of the NAT Rule resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Type - The type of NAT rule for VPN NAT. Possible values include: 'VpnNatRuleTypeStatic', 'VpnNatRuleTypeDynamic' + Type VpnNatRuleType `json:"type,omitempty"` + // Mode - The Source NAT direction of a VPN NAT. Possible values include: 'VpnNatRuleModeEgressSnat', 'VpnNatRuleModeIngressSnat' + Mode VpnNatRuleMode `json:"mode,omitempty"` + // InternalMappings - The private IP address internal mapping for NAT. + InternalMappings *[]VpnNatRuleMapping `json:"internalMappings,omitempty"` + // ExternalMappings - The private IP address external mapping for NAT. + ExternalMappings *[]VpnNatRuleMapping `json:"externalMappings,omitempty"` + // IPConfigurationID - The IP Configuration ID this NAT rule applies to. + IPConfigurationID *string `json:"ipConfigurationId,omitempty"` + // EgressVpnSiteLinkConnections - READ-ONLY; List of egress VpnSiteLinkConnections. + EgressVpnSiteLinkConnections *[]SubResource `json:"egressVpnSiteLinkConnections,omitempty"` + // IngressVpnSiteLinkConnections - READ-ONLY; List of ingress VpnSiteLinkConnections. + IngressVpnSiteLinkConnections *[]SubResource `json:"ingressVpnSiteLinkConnections,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayNatRuleProperties. +func (vgnrp VpnGatewayNatRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgnrp.Type != "" { + objectMap["type"] = vgnrp.Type + } + if vgnrp.Mode != "" { + objectMap["mode"] = vgnrp.Mode + } + if vgnrp.InternalMappings != nil { + objectMap["internalMappings"] = vgnrp.InternalMappings + } + if vgnrp.ExternalMappings != nil { + objectMap["externalMappings"] = vgnrp.ExternalMappings + } + if vgnrp.IPConfigurationID != nil { + objectMap["ipConfigurationId"] = vgnrp.IPConfigurationID + } + return json.Marshal(objectMap) +} + +// VpnGatewayPacketCaptureStartParameters start packet capture parameters. +type VpnGatewayPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters on vpn gateway. + FilterData *string `json:"filterData,omitempty"` +} + +// VpnGatewayPacketCaptureStopParameters stop packet capture parameters. +type VpnGatewayPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on vpn gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VpnGatewayProperties parameters for VpnGateway. +type VpnGatewayProperties struct { + // VirtualHub - The VirtualHub to which the gateway belongs. + VirtualHub *SubResource `json:"virtualHub,omitempty"` + // Connections - List of all vpn connections to the gateway. + Connections *[]VpnConnection `json:"connections,omitempty"` + // BgpSettings - Local network gateway's BGP speaker settings. + BgpSettings *BgpSettings `json:"bgpSettings,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN gateway resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // VpnGatewayScaleUnit - The scale unit for this vpn gateway. + VpnGatewayScaleUnit *int32 `json:"vpnGatewayScaleUnit,omitempty"` + // IPConfigurations - READ-ONLY; List of all IPs configured on the gateway. + IPConfigurations *[]VpnGatewayIPConfiguration `json:"ipConfigurations,omitempty"` + // EnableBgpRouteTranslationForNat - Enable BGP routes translation for NAT on this VpnGateway. + EnableBgpRouteTranslationForNat *bool `json:"enableBgpRouteTranslationForNat,omitempty"` + // IsRoutingPreferenceInternet - Enable Routing Preference property for the Public IP Interface of the VpnGateway. + IsRoutingPreferenceInternet *bool `json:"isRoutingPreferenceInternet,omitempty"` + // NatRules - List of all the nat Rules associated with the gateway. + NatRules *[]VpnGatewayNatRule `json:"natRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnGatewayProperties. +func (vgp VpnGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vgp.VirtualHub != nil { + objectMap["virtualHub"] = vgp.VirtualHub + } + if vgp.Connections != nil { + objectMap["connections"] = vgp.Connections + } + if vgp.BgpSettings != nil { + objectMap["bgpSettings"] = vgp.BgpSettings + } + if vgp.VpnGatewayScaleUnit != nil { + objectMap["vpnGatewayScaleUnit"] = vgp.VpnGatewayScaleUnit + } + if vgp.EnableBgpRouteTranslationForNat != nil { + objectMap["enableBgpRouteTranslationForNat"] = vgp.EnableBgpRouteTranslationForNat + } + if vgp.IsRoutingPreferenceInternet != nil { + objectMap["isRoutingPreferenceInternet"] = vgp.IsRoutingPreferenceInternet + } + if vgp.NatRules != nil { + objectMap["natRules"] = vgp.NatRules + } + return json.Marshal(objectMap) +} + +// VpnGatewaysCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysCreateOrUpdateFuture.Result. +func (future *VpnGatewaysCreateOrUpdateFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.CreateOrUpdateResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysCreateOrUpdateFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysDeleteFuture.Result. +func (future *VpnGatewaysDeleteFuture) result(client VpnGatewaysClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnGatewaysResetFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysResetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysResetFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysResetFuture.Result. +func (future *VpnGatewaysResetFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysResetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.ResetResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysResetFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysStartPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysStartPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysStartPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysStartPacketCaptureFuture.Result. +func (future *VpnGatewaysStartPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStartPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StartPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStartPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysStopPacketCaptureFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnGatewaysStopPacketCaptureFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysStopPacketCaptureFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysStopPacketCaptureFuture.Result. +func (future *VpnGatewaysStopPacketCaptureFuture) result(client VpnGatewaysClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysStopPacketCaptureFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.StopPacketCaptureResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysStopPacketCaptureFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnGatewaysUpdateTagsFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnGatewaysUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnGatewaysClient) (VpnGateway, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnGatewaysUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnGatewaysUpdateTagsFuture.Result. +func (future *VpnGatewaysUpdateTagsFuture) result(client VpnGatewaysClient) (vg VpnGateway, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vg.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnGatewaysUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vg.Response.Response, err = future.GetResult(sender); err == nil && vg.Response.Response.StatusCode != http.StatusNoContent { + vg, err = client.UpdateTagsResponder(vg.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysUpdateTagsFuture", "Result", vg.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnLinkBgpSettings BGP settings details for a link. +type VpnLinkBgpSettings struct { + // Asn - The BGP speaker's ASN. + Asn *int64 `json:"asn,omitempty"` + // BgpPeeringAddress - The BGP peering address and BGP identifier of this BGP speaker. + BgpPeeringAddress *string `json:"bgpPeeringAddress,omitempty"` +} + +// VpnLinkConnectionsGetIkeSasFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnLinkConnectionsGetIkeSasFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnLinkConnectionsClient) (String, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnLinkConnectionsGetIkeSasFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnLinkConnectionsGetIkeSasFuture.Result. +func (future *VpnLinkConnectionsGetIkeSasFuture) result(client VpnLinkConnectionsClient) (s String, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + s.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsGetIkeSasFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.GetIkeSasResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsGetIkeSasFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnLinkConnectionsResetConnectionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnLinkConnectionsResetConnectionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnLinkConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnLinkConnectionsResetConnectionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnLinkConnectionsResetConnectionFuture.Result. +func (future *VpnLinkConnectionsResetConnectionFuture) result(client VpnLinkConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsResetConnectionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnLinkConnectionsResetConnectionFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnLinkProviderProperties list of properties of a link provider. +type VpnLinkProviderProperties struct { + // LinkProviderName - Name of the link provider. + LinkProviderName *string `json:"linkProviderName,omitempty"` + // LinkSpeedInMbps - Link speed. + LinkSpeedInMbps *int32 `json:"linkSpeedInMbps,omitempty"` +} + +// VpnNatRuleMapping vpn NatRule mapping. +type VpnNatRuleMapping struct { + // AddressSpace - Address space for Vpn NatRule mapping. + AddressSpace *string `json:"addressSpace,omitempty"` + // PortRange - Port range for Vpn NatRule mapping. + PortRange *string `json:"portRange,omitempty"` +} + +// VpnPacketCaptureStartParameters start packet capture parameters on virtual network gateway. +type VpnPacketCaptureStartParameters struct { + // FilterData - Start Packet capture parameters. + FilterData *string `json:"filterData,omitempty"` +} + +// VpnPacketCaptureStopParameters stop packet capture parameters. +type VpnPacketCaptureStopParameters struct { + // SasURL - SAS url for packet capture on virtual network gateway. + SasURL *string `json:"sasUrl,omitempty"` +} + +// VpnProfileResponse vpn Profile Response for package generation. +type VpnProfileResponse struct { + autorest.Response `json:"-"` + // ProfileURL - URL to the VPN profile. + ProfileURL *string `json:"profileUrl,omitempty"` +} + +// VpnServerConfigRadiusClientRootCertificate properties of the Radius client root certificate of +// VpnServerConfiguration. +type VpnServerConfigRadiusClientRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // Thumbprint - The Radius client root certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VpnServerConfigRadiusServerRootCertificate properties of Radius Server root certificate of +// VpnServerConfiguration. +type VpnServerConfigRadiusServerRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VpnServerConfiguration vpnServerConfiguration Resource. +type VpnServerConfiguration struct { + autorest.Response `json:"-"` + // VpnServerConfigurationProperties - Properties of the P2SVpnServer configuration. + *VpnServerConfigurationProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfiguration. +func (vsc VpnServerConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsc.VpnServerConfigurationProperties != nil { + objectMap["properties"] = vsc.VpnServerConfigurationProperties + } + if vsc.ID != nil { + objectMap["id"] = vsc.ID + } + if vsc.Location != nil { + objectMap["location"] = vsc.Location + } + if vsc.Tags != nil { + objectMap["tags"] = vsc.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnServerConfiguration struct. +func (vsc *VpnServerConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnServerConfigurationProperties VpnServerConfigurationProperties + err = json.Unmarshal(*v, &vpnServerConfigurationProperties) + if err != nil { + return err + } + vsc.VpnServerConfigurationProperties = &vpnServerConfigurationProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vsc.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vsc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vsc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vsc.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vsc.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vsc.Tags = tags + } + } + } + + return nil +} + +// VpnServerConfigurationPolicyGroup vpnServerConfigurationPolicyGroup Resource. +type VpnServerConfigurationPolicyGroup struct { + autorest.Response `json:"-"` + // VpnServerConfigurationPolicyGroupProperties - Properties of the VpnServerConfigurationPolicyGroup. + *VpnServerConfigurationPolicyGroupProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroup. +func (vscpg VpnServerConfigurationPolicyGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscpg.VpnServerConfigurationPolicyGroupProperties != nil { + objectMap["properties"] = vscpg.VpnServerConfigurationPolicyGroupProperties + } + if vscpg.Name != nil { + objectMap["name"] = vscpg.Name + } + if vscpg.ID != nil { + objectMap["id"] = vscpg.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnServerConfigurationPolicyGroup struct. +func (vscpg *VpnServerConfigurationPolicyGroup) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnServerConfigurationPolicyGroupProperties VpnServerConfigurationPolicyGroupProperties + err = json.Unmarshal(*v, &vpnServerConfigurationPolicyGroupProperties) + if err != nil { + return err + } + vscpg.VpnServerConfigurationPolicyGroupProperties = &vpnServerConfigurationPolicyGroupProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vscpg.Etag = &etag + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vscpg.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vscpg.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vscpg.ID = &ID + } + } + } + + return nil +} + +// VpnServerConfigurationPolicyGroupMember vpnServerConfiguration PolicyGroup member +type VpnServerConfigurationPolicyGroupMember struct { + // Name - Name of the VpnServerConfigurationPolicyGroupMember. + Name *string `json:"name,omitempty"` + // AttributeType - The Vpn Policy member attribute type. Possible values include: 'VpnPolicyMemberAttributeTypeCertificateGroupID', 'VpnPolicyMemberAttributeTypeAADGroupID', 'VpnPolicyMemberAttributeTypeRadiusAzureGroupID' + AttributeType VpnPolicyMemberAttributeType `json:"attributeType,omitempty"` + // AttributeValue - The value of Attribute used for this VpnServerConfigurationPolicyGroupMember. + AttributeValue *string `json:"attributeValue,omitempty"` +} + +// VpnServerConfigurationPolicyGroupProperties parameters for VpnServerConfigurationPolicyGroup. +type VpnServerConfigurationPolicyGroupProperties struct { + // IsDefault - Shows if this is a Default VpnServerConfigurationPolicyGroup or not. + IsDefault *bool `json:"isDefault,omitempty"` + // Priority - Priority for VpnServerConfigurationPolicyGroup. + Priority *int32 `json:"priority,omitempty"` + // PolicyMembers - Multiple PolicyMembers for VpnServerConfigurationPolicyGroup. + PolicyMembers *[]VpnServerConfigurationPolicyGroupMember `json:"policyMembers,omitempty"` + // P2SConnectionConfigurations - READ-ONLY; List of references to P2SConnectionConfigurations. + P2SConnectionConfigurations *[]SubResource `json:"p2SConnectionConfigurations,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfigurationPolicyGroup resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationPolicyGroupProperties. +func (vscpgp VpnServerConfigurationPolicyGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscpgp.IsDefault != nil { + objectMap["isDefault"] = vscpgp.IsDefault + } + if vscpgp.Priority != nil { + objectMap["priority"] = vscpgp.Priority + } + if vscpgp.PolicyMembers != nil { + objectMap["policyMembers"] = vscpgp.PolicyMembers + } + return json.Marshal(objectMap) +} + +// VpnServerConfigurationProperties parameters for VpnServerConfiguration. +type VpnServerConfigurationProperties struct { + // Name - The name of the VpnServerConfiguration that is unique within a resource group. + Name *string `json:"name,omitempty"` + // VpnProtocols - VPN protocols for the VpnServerConfiguration. + VpnProtocols *[]VpnGatewayTunnelingProtocol `json:"vpnProtocols,omitempty"` + // VpnAuthenticationTypes - VPN authentication types for the VpnServerConfiguration. + VpnAuthenticationTypes *[]VpnAuthenticationType `json:"vpnAuthenticationTypes,omitempty"` + // VpnClientRootCertificates - VPN client root certificate of VpnServerConfiguration. + VpnClientRootCertificates *[]VpnServerConfigVpnClientRootCertificate `json:"vpnClientRootCertificates,omitempty"` + // VpnClientRevokedCertificates - VPN client revoked certificate of VpnServerConfiguration. + VpnClientRevokedCertificates *[]VpnServerConfigVpnClientRevokedCertificate `json:"vpnClientRevokedCertificates,omitempty"` + // RadiusServerRootCertificates - Radius Server root certificate of VpnServerConfiguration. + RadiusServerRootCertificates *[]VpnServerConfigRadiusServerRootCertificate `json:"radiusServerRootCertificates,omitempty"` + // RadiusClientRootCertificates - Radius client root certificate of VpnServerConfiguration. + RadiusClientRootCertificates *[]VpnServerConfigRadiusClientRootCertificate `json:"radiusClientRootCertificates,omitempty"` + // VpnClientIpsecPolicies - VpnClientIpsecPolicies for VpnServerConfiguration. + VpnClientIpsecPolicies *[]IpsecPolicy `json:"vpnClientIpsecPolicies,omitempty"` + // RadiusServerAddress - The radius server address property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerAddress *string `json:"radiusServerAddress,omitempty"` + // RadiusServerSecret - The radius secret property of the VpnServerConfiguration resource for point to site client connection. + RadiusServerSecret *string `json:"radiusServerSecret,omitempty"` + // RadiusServers - Multiple Radius Server configuration for VpnServerConfiguration. + RadiusServers *[]RadiusServer `json:"radiusServers,omitempty"` + // AadAuthenticationParameters - The set of aad vpn authentication parameters. + AadAuthenticationParameters *AadAuthenticationParameters `json:"aadAuthenticationParameters,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VpnServerConfiguration resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + ProvisioningState *string `json:"provisioningState,omitempty"` + // P2SVpnGateways - READ-ONLY; List of references to P2SVpnGateways. + P2SVpnGateways *[]P2SVpnGateway `json:"p2SVpnGateways,omitempty"` + // ConfigurationPolicyGroups - List of all VpnServerConfigurationPolicyGroups. + ConfigurationPolicyGroups *[]VpnServerConfigurationPolicyGroup `json:"configurationPolicyGroups,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnServerConfigurationProperties. +func (vscp VpnServerConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vscp.Name != nil { + objectMap["name"] = vscp.Name + } + if vscp.VpnProtocols != nil { + objectMap["vpnProtocols"] = vscp.VpnProtocols + } + if vscp.VpnAuthenticationTypes != nil { + objectMap["vpnAuthenticationTypes"] = vscp.VpnAuthenticationTypes + } + if vscp.VpnClientRootCertificates != nil { + objectMap["vpnClientRootCertificates"] = vscp.VpnClientRootCertificates + } + if vscp.VpnClientRevokedCertificates != nil { + objectMap["vpnClientRevokedCertificates"] = vscp.VpnClientRevokedCertificates + } + if vscp.RadiusServerRootCertificates != nil { + objectMap["radiusServerRootCertificates"] = vscp.RadiusServerRootCertificates + } + if vscp.RadiusClientRootCertificates != nil { + objectMap["radiusClientRootCertificates"] = vscp.RadiusClientRootCertificates + } + if vscp.VpnClientIpsecPolicies != nil { + objectMap["vpnClientIpsecPolicies"] = vscp.VpnClientIpsecPolicies + } + if vscp.RadiusServerAddress != nil { + objectMap["radiusServerAddress"] = vscp.RadiusServerAddress + } + if vscp.RadiusServerSecret != nil { + objectMap["radiusServerSecret"] = vscp.RadiusServerSecret + } + if vscp.RadiusServers != nil { + objectMap["radiusServers"] = vscp.RadiusServers + } + if vscp.AadAuthenticationParameters != nil { + objectMap["aadAuthenticationParameters"] = vscp.AadAuthenticationParameters + } + if vscp.ConfigurationPolicyGroups != nil { + objectMap["configurationPolicyGroups"] = vscp.ConfigurationPolicyGroups + } + return json.Marshal(objectMap) +} + +// VpnServerConfigurationsAssociatedWithVirtualWanListFuture an abstraction for monitoring and retrieving +// the results of a long-running operation. +type VpnServerConfigurationsAssociatedWithVirtualWanListFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsAssociatedWithVirtualWanClient) (VpnServerConfigurationsResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsAssociatedWithVirtualWanListFuture.Result. +func (future *VpnServerConfigurationsAssociatedWithVirtualWanListFuture) result(client VpnServerConfigurationsAssociatedWithVirtualWanClient) (vscr VpnServerConfigurationsResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vscr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vscr.Response.Response, err = future.GetResult(sender); err == nil && vscr.Response.Response.StatusCode != http.StatusNoContent { + vscr, err = client.ListResponder(vscr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture", "Result", vscr.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnServerConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type VpnServerConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsClient) (VpnServerConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsCreateOrUpdateFuture.Result. +func (future *VpnServerConfigurationsCreateOrUpdateFuture) result(client VpnServerConfigurationsClient) (vsc VpnServerConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vsc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vsc.Response.Response, err = future.GetResult(sender); err == nil && vsc.Response.Response.StatusCode != http.StatusNoContent { + vsc, err = client.CreateOrUpdateResponder(vsc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsCreateOrUpdateFuture", "Result", vsc.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnServerConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnServerConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnServerConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnServerConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnServerConfigurationsDeleteFuture.Result. +func (future *VpnServerConfigurationsDeleteFuture) result(client VpnServerConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnServerConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnServerConfigurationsResponse vpnServerConfigurations list associated with VirtualWan Response. +type VpnServerConfigurationsResponse struct { + autorest.Response `json:"-"` + // VpnServerConfigurationResourceIds - List of VpnServerConfigurations associated with VirtualWan. + VpnServerConfigurationResourceIds *[]string `json:"vpnServerConfigurationResourceIds,omitempty"` +} + +// VpnServerConfigVpnClientRevokedCertificate properties of the revoked VPN client certificate of +// VpnServerConfiguration. +type VpnServerConfigVpnClientRevokedCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // Thumbprint - The revoked VPN client certificate thumbprint. + Thumbprint *string `json:"thumbprint,omitempty"` +} + +// VpnServerConfigVpnClientRootCertificate properties of VPN client root certificate of +// VpnServerConfiguration. +type VpnServerConfigVpnClientRootCertificate struct { + // Name - The certificate name. + Name *string `json:"name,omitempty"` + // PublicCertData - The certificate public data. + PublicCertData *string `json:"publicCertData,omitempty"` +} + +// VpnSite vpnSite Resource. +type VpnSite struct { + autorest.Response `json:"-"` + // VpnSiteProperties - Properties of the VPN site. + *VpnSiteProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for VpnSite. +func (vs VpnSite) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vs.VpnSiteProperties != nil { + objectMap["properties"] = vs.VpnSiteProperties + } + if vs.ID != nil { + objectMap["id"] = vs.ID + } + if vs.Location != nil { + objectMap["location"] = vs.Location + } + if vs.Tags != nil { + objectMap["tags"] = vs.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSite struct. +func (vs *VpnSite) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteProperties VpnSiteProperties + err = json.Unmarshal(*v, &vpnSiteProperties) + if err != nil { + return err + } + vs.VpnSiteProperties = &vpnSiteProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vs.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vs.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + vs.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + vs.Tags = tags + } + } + } + + return nil +} + +// VpnSiteID vpnSite Resource. +type VpnSiteID struct { + // VpnSite - READ-ONLY; The resource-uri of the vpn-site for which config is to be fetched. + VpnSite *string `json:"vpnSite,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteID. +func (vsi VpnSiteID) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// VpnSiteLink vpnSiteLink Resource. +type VpnSiteLink struct { + autorest.Response `json:"-"` + // VpnSiteLinkProperties - Properties of the VPN site link. + *VpnSiteLinkProperties `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLink. +func (vsl VpnSiteLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsl.VpnSiteLinkProperties != nil { + objectMap["properties"] = vsl.VpnSiteLinkProperties + } + if vsl.Name != nil { + objectMap["name"] = vsl.Name + } + if vsl.ID != nil { + objectMap["id"] = vsl.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSiteLink struct. +func (vsl *VpnSiteLink) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteLinkProperties VpnSiteLinkProperties + err = json.Unmarshal(*v, &vpnSiteLinkProperties) + if err != nil { + return err + } + vsl.VpnSiteLinkProperties = &vpnSiteLinkProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vsl.Etag = &etag + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vsl.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vsl.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vsl.ID = &ID + } + } + } + + return nil +} + +// VpnSiteLinkConnection vpnSiteLinkConnection Resource. +type VpnSiteLinkConnection struct { + autorest.Response `json:"-"` + // VpnSiteLinkConnectionProperties - Properties of the VPN site link connection. + *VpnSiteLinkConnectionProperties `json:"properties,omitempty"` + // Name - The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkConnection. +func (vslc VpnSiteLinkConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslc.VpnSiteLinkConnectionProperties != nil { + objectMap["properties"] = vslc.VpnSiteLinkConnectionProperties + } + if vslc.Name != nil { + objectMap["name"] = vslc.Name + } + if vslc.ID != nil { + objectMap["id"] = vslc.ID + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for VpnSiteLinkConnection struct. +func (vslc *VpnSiteLinkConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var vpnSiteLinkConnectionProperties VpnSiteLinkConnectionProperties + err = json.Unmarshal(*v, &vpnSiteLinkConnectionProperties) + if err != nil { + return err + } + vslc.VpnSiteLinkConnectionProperties = &vpnSiteLinkConnectionProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + vslc.Name = &name + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + vslc.Etag = &etag + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + vslc.Type = &typeVar + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + vslc.ID = &ID + } + } + } + + return nil +} + +// VpnSiteLinkConnectionProperties parameters for VpnConnection. +type VpnSiteLinkConnectionProperties struct { + // VpnSiteLink - Id of the connected vpn site link. + VpnSiteLink *SubResource `json:"vpnSiteLink,omitempty"` + // RoutingWeight - Routing weight for vpn connection. + RoutingWeight *int32 `json:"routingWeight,omitempty"` + // VpnLinkConnectionMode - Vpn link connection mode. Possible values include: 'VpnLinkConnectionModeDefault', 'VpnLinkConnectionModeResponderOnly', 'VpnLinkConnectionModeInitiatorOnly' + VpnLinkConnectionMode VpnLinkConnectionMode `json:"vpnLinkConnectionMode,omitempty"` + // ConnectionStatus - The connection status. Possible values include: 'VpnConnectionStatusUnknown', 'VpnConnectionStatusConnecting', 'VpnConnectionStatusConnected', 'VpnConnectionStatusNotConnected' + ConnectionStatus VpnConnectionStatus `json:"connectionStatus,omitempty"` + // VpnConnectionProtocolType - Connection protocol used for this connection. Possible values include: 'VirtualNetworkGatewayConnectionProtocolIKEv2', 'VirtualNetworkGatewayConnectionProtocolIKEv1' + VpnConnectionProtocolType VirtualNetworkGatewayConnectionProtocol `json:"vpnConnectionProtocolType,omitempty"` + // IngressBytesTransferred - READ-ONLY; Ingress bytes transferred. + IngressBytesTransferred *int64 `json:"ingressBytesTransferred,omitempty"` + // EgressBytesTransferred - READ-ONLY; Egress bytes transferred. + EgressBytesTransferred *int64 `json:"egressBytesTransferred,omitempty"` + // ConnectionBandwidth - Expected bandwidth in MBPS. + ConnectionBandwidth *int32 `json:"connectionBandwidth,omitempty"` + // SharedKey - SharedKey for the vpn connection. + SharedKey *string `json:"sharedKey,omitempty"` + // EnableBgp - EnableBgp flag. + EnableBgp *bool `json:"enableBgp,omitempty"` + // VpnGatewayCustomBgpAddresses - vpnGatewayCustomBgpAddresses used by this connection. + VpnGatewayCustomBgpAddresses *[]GatewayCustomBgpIPAddressIPConfiguration `json:"vpnGatewayCustomBgpAddresses,omitempty"` + // UsePolicyBasedTrafficSelectors - Enable policy-based traffic selectors. + UsePolicyBasedTrafficSelectors *bool `json:"usePolicyBasedTrafficSelectors,omitempty"` + // IpsecPolicies - The IPSec Policies to be considered by this connection. + IpsecPolicies *[]IpsecPolicy `json:"ipsecPolicies,omitempty"` + // EnableRateLimiting - EnableBgp flag. + EnableRateLimiting *bool `json:"enableRateLimiting,omitempty"` + // UseLocalAzureIPAddress - Use local azure ip to initiate connection. + UseLocalAzureIPAddress *bool `json:"useLocalAzureIpAddress,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link connection resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IngressNatRules - List of ingress NatRules. + IngressNatRules *[]SubResource `json:"ingressNatRules,omitempty"` + // EgressNatRules - List of egress NatRules. + EgressNatRules *[]SubResource `json:"egressNatRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkConnectionProperties. +func (vslcp VpnSiteLinkConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslcp.VpnSiteLink != nil { + objectMap["vpnSiteLink"] = vslcp.VpnSiteLink + } + if vslcp.RoutingWeight != nil { + objectMap["routingWeight"] = vslcp.RoutingWeight + } + if vslcp.VpnLinkConnectionMode != "" { + objectMap["vpnLinkConnectionMode"] = vslcp.VpnLinkConnectionMode + } + if vslcp.ConnectionStatus != "" { + objectMap["connectionStatus"] = vslcp.ConnectionStatus + } + if vslcp.VpnConnectionProtocolType != "" { + objectMap["vpnConnectionProtocolType"] = vslcp.VpnConnectionProtocolType + } + if vslcp.ConnectionBandwidth != nil { + objectMap["connectionBandwidth"] = vslcp.ConnectionBandwidth + } + if vslcp.SharedKey != nil { + objectMap["sharedKey"] = vslcp.SharedKey + } + if vslcp.EnableBgp != nil { + objectMap["enableBgp"] = vslcp.EnableBgp + } + if vslcp.VpnGatewayCustomBgpAddresses != nil { + objectMap["vpnGatewayCustomBgpAddresses"] = vslcp.VpnGatewayCustomBgpAddresses + } + if vslcp.UsePolicyBasedTrafficSelectors != nil { + objectMap["usePolicyBasedTrafficSelectors"] = vslcp.UsePolicyBasedTrafficSelectors + } + if vslcp.IpsecPolicies != nil { + objectMap["ipsecPolicies"] = vslcp.IpsecPolicies + } + if vslcp.EnableRateLimiting != nil { + objectMap["enableRateLimiting"] = vslcp.EnableRateLimiting + } + if vslcp.UseLocalAzureIPAddress != nil { + objectMap["useLocalAzureIpAddress"] = vslcp.UseLocalAzureIPAddress + } + if vslcp.IngressNatRules != nil { + objectMap["ingressNatRules"] = vslcp.IngressNatRules + } + if vslcp.EgressNatRules != nil { + objectMap["egressNatRules"] = vslcp.EgressNatRules + } + return json.Marshal(objectMap) +} + +// VpnSiteLinkProperties parameters for VpnSite. +type VpnSiteLinkProperties struct { + // LinkProperties - The link provider properties. + LinkProperties *VpnLinkProviderProperties `json:"linkProperties,omitempty"` + // IPAddress - The ip-address for the vpn-site-link. + IPAddress *string `json:"ipAddress,omitempty"` + // Fqdn - FQDN of vpn-site-link. + Fqdn *string `json:"fqdn,omitempty"` + // BgpProperties - The set of bgp properties. + BgpProperties *VpnLinkBgpSettings `json:"bgpProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site link resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteLinkProperties. +func (vslp VpnSiteLinkProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vslp.LinkProperties != nil { + objectMap["linkProperties"] = vslp.LinkProperties + } + if vslp.IPAddress != nil { + objectMap["ipAddress"] = vslp.IPAddress + } + if vslp.Fqdn != nil { + objectMap["fqdn"] = vslp.Fqdn + } + if vslp.BgpProperties != nil { + objectMap["bgpProperties"] = vslp.BgpProperties + } + return json.Marshal(objectMap) +} + +// VpnSiteProperties parameters for VpnSite. +type VpnSiteProperties struct { + // VirtualWan - The VirtualWAN to which the vpnSite belongs. + VirtualWan *SubResource `json:"virtualWan,omitempty"` + // DeviceProperties - The device properties. + DeviceProperties *DeviceProperties `json:"deviceProperties,omitempty"` + // IPAddress - The ip-address for the vpn-site. + IPAddress *string `json:"ipAddress,omitempty"` + // SiteKey - The key for vpn-site that can be used for connections. + SiteKey *string `json:"siteKey,omitempty"` + // AddressSpace - The AddressSpace that contains an array of IP address ranges. + AddressSpace *AddressSpace `json:"addressSpace,omitempty"` + // BgpProperties - The set of bgp properties. + BgpProperties *BgpSettings `json:"bgpProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the VPN site resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // IsSecuritySite - IsSecuritySite flag. + IsSecuritySite *bool `json:"isSecuritySite,omitempty"` + // VpnSiteLinks - List of all vpn site links. + VpnSiteLinks *[]VpnSiteLink `json:"vpnSiteLinks,omitempty"` + // O365Policy - Office365 Policy. + O365Policy *O365PolicyProperties `json:"o365Policy,omitempty"` +} + +// MarshalJSON is the custom marshaler for VpnSiteProperties. +func (vsp VpnSiteProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vsp.VirtualWan != nil { + objectMap["virtualWan"] = vsp.VirtualWan + } + if vsp.DeviceProperties != nil { + objectMap["deviceProperties"] = vsp.DeviceProperties + } + if vsp.IPAddress != nil { + objectMap["ipAddress"] = vsp.IPAddress + } + if vsp.SiteKey != nil { + objectMap["siteKey"] = vsp.SiteKey + } + if vsp.AddressSpace != nil { + objectMap["addressSpace"] = vsp.AddressSpace + } + if vsp.BgpProperties != nil { + objectMap["bgpProperties"] = vsp.BgpProperties + } + if vsp.IsSecuritySite != nil { + objectMap["isSecuritySite"] = vsp.IsSecuritySite + } + if vsp.VpnSiteLinks != nil { + objectMap["vpnSiteLinks"] = vsp.VpnSiteLinks + } + if vsp.O365Policy != nil { + objectMap["o365Policy"] = vsp.O365Policy + } + return json.Marshal(objectMap) +} + +// VpnSitesConfigurationDownloadFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type VpnSitesConfigurationDownloadFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesConfigurationClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesConfigurationDownloadFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesConfigurationDownloadFuture.Result. +func (future *VpnSitesConfigurationDownloadFuture) result(client VpnSitesConfigurationClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesConfigurationDownloadFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesConfigurationDownloadFuture") + return + } + ar.Response = future.Response() + return +} + +// VpnSitesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnSitesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesClient) (VpnSite, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesCreateOrUpdateFuture.Result. +func (future *VpnSitesCreateOrUpdateFuture) result(client VpnSitesClient) (vs VpnSite, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vs.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vs.Response.Response, err = future.GetResult(sender); err == nil && vs.Response.Response.StatusCode != http.StatusNoContent { + vs, err = client.CreateOrUpdateResponder(vs.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesCreateOrUpdateFuture", "Result", vs.Response.Response, "Failure responding to request") + } + } + return +} + +// VpnSitesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type VpnSitesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(VpnSitesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *VpnSitesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for VpnSitesDeleteFuture.Result. +func (future *VpnSitesDeleteFuture) result(client VpnSitesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.VpnSitesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// Watcher network watcher in a resource group. +type Watcher struct { + autorest.Response `json:"-"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // WatcherPropertiesFormat - Properties of the network watcher. + *WatcherPropertiesFormat `json:"properties,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WatcherPropertiesFormat != nil { + objectMap["properties"] = w.WatcherPropertiesFormat + } + if w.ID != nil { + objectMap["id"] = w.ID + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Watcher struct. +func (w *Watcher) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = &etag + } + case "properties": + if v != nil { + var watcherPropertiesFormat WatcherPropertiesFormat + err = json.Unmarshal(*v, &watcherPropertiesFormat) + if err != nil { + return err + } + w.WatcherPropertiesFormat = &watcherPropertiesFormat + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + } + } + + return nil +} + +// WatcherListResult response for ListNetworkWatchers API service call. +type WatcherListResult struct { + autorest.Response `json:"-"` + // Value - List of network watcher resources. + Value *[]Watcher `json:"value,omitempty"` +} + +// WatcherPropertiesFormat the network watcher properties. +type WatcherPropertiesFormat struct { + // ProvisioningState - READ-ONLY; The provisioning state of the network watcher resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherPropertiesFormat. +func (wpf WatcherPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WatchersCheckConnectivityFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersCheckConnectivityFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (ConnectivityInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersCheckConnectivityFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersCheckConnectivityFuture.Result. +func (future *WatchersCheckConnectivityFuture) result(client WatchersClient) (ci ConnectivityInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ci.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersCheckConnectivityFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent { + ci, err = client.CheckConnectivityResponder(ci.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersCheckConnectivityFuture", "Result", ci.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WatchersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersDeleteFuture.Result. +func (future *WatchersDeleteFuture) result(client WatchersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WatchersGetAzureReachabilityReportFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetAzureReachabilityReportFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (AzureReachabilityReport, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetAzureReachabilityReportFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetAzureReachabilityReportFuture.Result. +func (future *WatchersGetAzureReachabilityReportFuture) result(client WatchersClient) (arr AzureReachabilityReport, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + arr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetAzureReachabilityReportFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if arr.Response.Response, err = future.GetResult(sender); err == nil && arr.Response.Response.StatusCode != http.StatusNoContent { + arr, err = client.GetAzureReachabilityReportResponder(arr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetAzureReachabilityReportFuture", "Result", arr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetFlowLogStatusFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetFlowLogStatusFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (FlowLogInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetFlowLogStatusFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetFlowLogStatusFuture.Result. +func (future *WatchersGetFlowLogStatusFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fli.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetFlowLogStatusFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.GetFlowLogStatusResponder(fli.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetFlowLogStatusFuture", "Result", fli.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetNetworkConfigurationDiagnosticFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type WatchersGetNetworkConfigurationDiagnosticFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (ConfigurationDiagnosticResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetNetworkConfigurationDiagnosticFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetNetworkConfigurationDiagnosticFuture.Result. +func (future *WatchersGetNetworkConfigurationDiagnosticFuture) result(client WatchersClient) (cdr ConfigurationDiagnosticResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + cdr.Response.Response = future.Response() + 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.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (NextHopResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetNextHopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetNextHopFuture.Result. +func (future *WatchersGetNextHopFuture) result(client WatchersClient) (nhr NextHopResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + nhr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNextHopFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if nhr.Response.Response, err = future.GetResult(sender); err == nil && nhr.Response.Response.StatusCode != http.StatusNoContent { + nhr, err = client.GetNextHopResponder(nhr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNextHopFuture", "Result", nhr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetTroubleshootingFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetTroubleshootingFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (TroubleshootingResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetTroubleshootingFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetTroubleshootingFuture.Result. +func (future *WatchersGetTroubleshootingFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetTroubleshootingResultFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetTroubleshootingResultFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (TroubleshootingResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetTroubleshootingResultFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetTroubleshootingResultFuture.Result. +func (future *WatchersGetTroubleshootingResultFuture) result(client WatchersClient) (tr TroubleshootingResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetTroubleshootingResultFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tr.Response.Response, err = future.GetResult(sender); err == nil && tr.Response.Response.StatusCode != http.StatusNoContent { + tr, err = client.GetTroubleshootingResultResponder(tr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetTroubleshootingResultFuture", "Result", tr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersGetVMSecurityRulesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetVMSecurityRulesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (SecurityGroupViewResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersGetVMSecurityRulesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersGetVMSecurityRulesFuture.Result. +func (future *WatchersGetVMSecurityRulesFuture) result(client WatchersClient) (sgvr SecurityGroupViewResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + sgvr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersGetVMSecurityRulesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sgvr.Response.Response, err = future.GetResult(sender); err == nil && sgvr.Response.Response.StatusCode != http.StatusNoContent { + sgvr, err = client.GetVMSecurityRulesResponder(sgvr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetVMSecurityRulesFuture", "Result", sgvr.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersListAvailableProvidersFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersListAvailableProvidersFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (AvailableProvidersList, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersListAvailableProvidersFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersListAvailableProvidersFuture.Result. +func (future *WatchersListAvailableProvidersFuture) result(client WatchersClient) (apl AvailableProvidersList, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + apl.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersListAvailableProvidersFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if apl.Response.Response, err = future.GetResult(sender); err == nil && apl.Response.Response.StatusCode != http.StatusNoContent { + apl, err = client.ListAvailableProvidersResponder(apl.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersListAvailableProvidersFuture", "Result", apl.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersSetFlowLogConfigurationFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersSetFlowLogConfigurationFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (FlowLogInformation, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersSetFlowLogConfigurationFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersSetFlowLogConfigurationFuture.Result. +func (future *WatchersSetFlowLogConfigurationFuture) result(client WatchersClient) (fli FlowLogInformation, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fli.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersSetFlowLogConfigurationFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fli.Response.Response, err = future.GetResult(sender); err == nil && fli.Response.Response.StatusCode != http.StatusNoContent { + fli, err = client.SetFlowLogConfigurationResponder(fli.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersSetFlowLogConfigurationFuture", "Result", fli.Response.Response, "Failure responding to request") + } + } + return +} + +// WatchersVerifyIPFlowFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type WatchersVerifyIPFlowFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WatchersClient) (VerificationIPFlowResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WatchersVerifyIPFlowFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WatchersVerifyIPFlowFuture.Result. +func (future *WatchersVerifyIPFlowFuture) result(client WatchersClient) (vifr VerificationIPFlowResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + vifr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WatchersVerifyIPFlowFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if vifr.Response.Response, err = future.GetResult(sender); err == nil && vifr.Response.Response.StatusCode != http.StatusNoContent { + vifr, err = client.VerifyIPFlowResponder(vifr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersVerifyIPFlowFuture", "Result", vifr.Response.Response, "Failure responding to request") + } + } + return +} + +// WebApplicationFirewallCustomRule defines contents of a web application rule. +type WebApplicationFirewallCustomRule struct { + // Name - The name of the resource that is unique within a policy. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // Priority - Priority of the rule. Rules with a lower value will be evaluated before rules with a higher value. + Priority *int32 `json:"priority,omitempty"` + // RuleType - The rule type. Possible values include: 'WebApplicationFirewallRuleTypeMatchRule', 'WebApplicationFirewallRuleTypeInvalid' + RuleType WebApplicationFirewallRuleType `json:"ruleType,omitempty"` + // MatchConditions - List of match conditions. + MatchConditions *[]MatchCondition `json:"matchConditions,omitempty"` + // Action - Type of Actions. Possible values include: 'WebApplicationFirewallActionAllow', 'WebApplicationFirewallActionBlock', 'WebApplicationFirewallActionLog' + Action WebApplicationFirewallAction `json:"action,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallCustomRule. +func (wafcr WebApplicationFirewallCustomRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafcr.Name != nil { + objectMap["name"] = wafcr.Name + } + if wafcr.Priority != nil { + objectMap["priority"] = wafcr.Priority + } + if wafcr.RuleType != "" { + objectMap["ruleType"] = wafcr.RuleType + } + if wafcr.MatchConditions != nil { + objectMap["matchConditions"] = wafcr.MatchConditions + } + if wafcr.Action != "" { + objectMap["action"] = wafcr.Action + } + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WebApplicationFirewallPoliciesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WebApplicationFirewallPoliciesClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WebApplicationFirewallPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WebApplicationFirewallPoliciesDeleteFuture.Result. +func (future *WebApplicationFirewallPoliciesDeleteFuture) result(client WebApplicationFirewallPoliciesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("network.WebApplicationFirewallPoliciesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// WebApplicationFirewallPolicy defines web application firewall policy. +type WebApplicationFirewallPolicy struct { + autorest.Response `json:"-"` + // WebApplicationFirewallPolicyPropertiesFormat - Properties of the web application firewall policy. + *WebApplicationFirewallPolicyPropertiesFormat `json:"properties,omitempty"` + // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty"` + // ID - Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Location - Resource location. + Location *string `json:"location,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicy. +func (wafp WebApplicationFirewallPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafp.WebApplicationFirewallPolicyPropertiesFormat != nil { + objectMap["properties"] = wafp.WebApplicationFirewallPolicyPropertiesFormat + } + if wafp.ID != nil { + objectMap["id"] = wafp.ID + } + if wafp.Location != nil { + objectMap["location"] = wafp.Location + } + if wafp.Tags != nil { + objectMap["tags"] = wafp.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WebApplicationFirewallPolicy struct. +func (wafp *WebApplicationFirewallPolicy) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var webApplicationFirewallPolicyPropertiesFormat WebApplicationFirewallPolicyPropertiesFormat + err = json.Unmarshal(*v, &webApplicationFirewallPolicyPropertiesFormat) + if err != nil { + return err + } + wafp.WebApplicationFirewallPolicyPropertiesFormat = &webApplicationFirewallPolicyPropertiesFormat + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + wafp.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + wafp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wafp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + wafp.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + wafp.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + wafp.Tags = tags + } + } + } + + return nil +} + +// WebApplicationFirewallPolicyListResult result of the request to list WebApplicationFirewallPolicies. It +// contains a list of WebApplicationFirewallPolicy objects and a URL link to get the next set of results. +type WebApplicationFirewallPolicyListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of WebApplicationFirewallPolicies within a resource group. + Value *[]WebApplicationFirewallPolicy `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of WebApplicationFirewallPolicy objects if there are any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyListResult. +func (wafplr WebApplicationFirewallPolicyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// WebApplicationFirewallPolicyListResultIterator provides access to a complete listing of +// WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListResultIterator struct { + i int + page WebApplicationFirewallPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *WebApplicationFirewallPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *WebApplicationFirewallPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WebApplicationFirewallPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter WebApplicationFirewallPolicyListResultIterator) Response() WebApplicationFirewallPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter WebApplicationFirewallPolicyListResultIterator) Value() WebApplicationFirewallPolicy { + if !iter.page.NotDone() { + return WebApplicationFirewallPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WebApplicationFirewallPolicyListResultIterator type. +func NewWebApplicationFirewallPolicyListResultIterator(page WebApplicationFirewallPolicyListResultPage) WebApplicationFirewallPolicyListResultIterator { + return WebApplicationFirewallPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wafplr WebApplicationFirewallPolicyListResult) IsEmpty() bool { + return wafplr.Value == nil || len(*wafplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wafplr WebApplicationFirewallPolicyListResult) hasNextLink() bool { + return wafplr.NextLink != nil && len(*wafplr.NextLink) != 0 +} + +// webApplicationFirewallPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wafplr WebApplicationFirewallPolicyListResult) webApplicationFirewallPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wafplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wafplr.NextLink))) +} + +// WebApplicationFirewallPolicyListResultPage contains a page of WebApplicationFirewallPolicy values. +type WebApplicationFirewallPolicyListResultPage struct { + fn func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error) + wafplr WebApplicationFirewallPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *WebApplicationFirewallPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wafplr) + if err != nil { + return err + } + page.wafplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *WebApplicationFirewallPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WebApplicationFirewallPolicyListResultPage) NotDone() bool { + return !page.wafplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WebApplicationFirewallPolicyListResultPage) Response() WebApplicationFirewallPolicyListResult { + return page.wafplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WebApplicationFirewallPolicyListResultPage) Values() []WebApplicationFirewallPolicy { + if page.wafplr.IsEmpty() { + return nil + } + return *page.wafplr.Value +} + +// Creates a new instance of the WebApplicationFirewallPolicyListResultPage type. +func NewWebApplicationFirewallPolicyListResultPage(cur WebApplicationFirewallPolicyListResult, getNextPage func(context.Context, WebApplicationFirewallPolicyListResult) (WebApplicationFirewallPolicyListResult, error)) WebApplicationFirewallPolicyListResultPage { + return WebApplicationFirewallPolicyListResultPage{ + fn: getNextPage, + wafplr: cur, + } +} + +// WebApplicationFirewallPolicyPropertiesFormat defines web application firewall policy properties. +type WebApplicationFirewallPolicyPropertiesFormat struct { + // PolicySettings - The PolicySettings for policy. + PolicySettings *PolicySettings `json:"policySettings,omitempty"` + // CustomRules - The custom rules inside the policy. + CustomRules *[]WebApplicationFirewallCustomRule `json:"customRules,omitempty"` + // ApplicationGateways - READ-ONLY; A collection of references to application gateways. + ApplicationGateways *[]ApplicationGateway `json:"applicationGateways,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the web application firewall policy resource. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting', 'ProvisioningStateFailed' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceState - READ-ONLY; Resource status of the policy. Possible values include: 'WebApplicationFirewallPolicyResourceStateCreating', 'WebApplicationFirewallPolicyResourceStateEnabling', 'WebApplicationFirewallPolicyResourceStateEnabled', 'WebApplicationFirewallPolicyResourceStateDisabling', 'WebApplicationFirewallPolicyResourceStateDisabled', 'WebApplicationFirewallPolicyResourceStateDeleting' + ResourceState WebApplicationFirewallPolicyResourceState `json:"resourceState,omitempty"` + // ManagedRules - Describes the managedRules structure. + ManagedRules *ManagedRulesDefinition `json:"managedRules,omitempty"` + // HTTPListeners - READ-ONLY; A collection of references to application gateway http listeners. + HTTPListeners *[]SubResource `json:"httpListeners,omitempty"` + // PathBasedRules - READ-ONLY; A collection of references to application gateway path rules. + PathBasedRules *[]SubResource `json:"pathBasedRules,omitempty"` +} + +// MarshalJSON is the custom marshaler for WebApplicationFirewallPolicyPropertiesFormat. +func (wafppf WebApplicationFirewallPolicyPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wafppf.PolicySettings != nil { + objectMap["policySettings"] = wafppf.PolicySettings + } + if wafppf.CustomRules != nil { + objectMap["customRules"] = wafppf.CustomRules + } + if wafppf.ManagedRules != nil { + objectMap["managedRules"] = wafppf.ManagedRules + } + return json.Marshal(objectMap) +} diff --git a/services/network/mgmt/2021-08-01/network/natgateways.go b/services/network/mgmt/2021-08-01/network/natgateways.go new file mode 100644 index 000000000000..83c7d146cab1 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/natgateways.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// NatGatewaysClient is the network Client +type NatGatewaysClient struct { + BaseClient +} + +// NewNatGatewaysClient creates an instance of the NatGatewaysClient client. +func NewNatGatewaysClient(subscriptionID string) NatGatewaysClient { + return NewNatGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNatGatewaysClientWithBaseURI creates an instance of the NatGatewaysClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewNatGatewaysClientWithBaseURI(baseURI string, subscriptionID string) NatGatewaysClient { + return NatGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a nat gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// natGatewayName - the name of the nat gateway. +// parameters - parameters supplied to the create or update nat gateway operation. +func (client NatGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway) (result NatGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, natGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NatGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, natGatewayName string, parameters NatGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natGatewayName": autorest.Encode("path", natGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) CreateOrUpdateSender(req *http.Request) (future NatGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result NatGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified nat gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// natGatewayName - the name of the nat gateway. +func (client NatGatewaysClient) Delete(ctx context.Context, resourceGroupName string, natGatewayName string) (result NatGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, natGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NatGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, natGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natGatewayName": autorest.Encode("path", natGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) DeleteSender(req *http.Request) (future NatGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified nat gateway in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// natGatewayName - the name of the nat gateway. +// expand - expands referenced resources. +func (client NatGatewaysClient) Get(ctx context.Context, resourceGroupName string, natGatewayName string, expand string) (result NatGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, natGatewayName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client NatGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, natGatewayName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natGatewayName": autorest.Encode("path", natGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) GetResponder(resp *http.Response) (result NatGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all nat gateways in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client NatGatewaysClient) List(ctx context.Context, resourceGroupName string) (result NatGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.List") + defer func() { + sc := -1 + if result.nglr.Response.Response != nil { + sc = result.nglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.nglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.nglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.nglr.hasNextLink() && result.nglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client NatGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) ListResponder(resp *http.Response) (result NatGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client NatGatewaysClient) listNextResults(ctx context.Context, lastResults NatGatewayListResult) (result NatGatewayListResult, err error) { + req, err := lastResults.natGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client NatGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result NatGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the Nat Gateways in a subscription. +func (client NatGatewaysClient) ListAll(ctx context.Context) (result NatGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.ListAll") + defer func() { + sc := -1 + if result.nglr.Response.Response != nil { + sc = result.nglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.nglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "ListAll", resp, "Failure sending request") + return + } + + result.nglr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "ListAll", resp, "Failure responding to request") + return + } + if result.nglr.hasNextLink() && result.nglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client NatGatewaysClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/natGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) ListAllResponder(resp *http.Response) (result NatGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client NatGatewaysClient) listAllNextResults(ctx context.Context, lastResults NatGatewayListResult) (result NatGatewayListResult, err error) { + req, err := lastResults.natGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client NatGatewaysClient) ListAllComplete(ctx context.Context) (result NatGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates nat gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// natGatewayName - the name of the nat gateway. +// parameters - parameters supplied to update nat gateway tags. +func (client NatGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, natGatewayName string, parameters TagsObject) (result NatGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, natGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatGatewaysClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client NatGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, natGatewayName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natGatewayName": autorest.Encode("path", natGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/natGateways/{natGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client NatGatewaysClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client NatGatewaysClient) UpdateTagsResponder(resp *http.Response) (result NatGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/natrules.go b/services/network/mgmt/2021-08-01/network/natrules.go new file mode 100644 index 000000000000..cff3437cc005 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/natrules.go @@ -0,0 +1,393 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// NatRulesClient is the network Client +type NatRulesClient struct { + BaseClient +} + +// NewNatRulesClient creates an instance of the NatRulesClient client. +func NewNatRulesClient(subscriptionID string) NatRulesClient { + return NewNatRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNatRulesClientWithBaseURI creates an instance of the NatRulesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewNatRulesClientWithBaseURI(baseURI string, subscriptionID string) NatRulesClient { + return NatRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat rules. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +// natRuleParameters - parameters supplied to create or Update a Nat Rule. +func (client NatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VpnGatewayNatRule) (result NatRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, gatewayName, natRuleName, natRuleParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client NatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters VpnGatewayNatRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + natRuleParameters.Etag = nil + natRuleParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithJSON(natRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client NatRulesClient) CreateOrUpdateSender(req *http.Request) (future NatRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client NatRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VpnGatewayNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a nat rule. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +func (client NatRulesClient) Delete(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (result NatRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, gatewayName, natRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client NatRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client NatRulesClient) DeleteSender(req *http.Request) (future NatRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client NatRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a nat ruleGet. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +func (client NatRulesClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (result VpnGatewayNatRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName, natRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client NatRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client NatRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client NatRulesClient) GetResponder(resp *http.Response) (result VpnGatewayNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVpnGateway retrieves all nat rules for a particular virtual wan vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +func (client NatRulesClient) ListByVpnGateway(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnGatewayNatRulesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatRulesClient.ListByVpnGateway") + defer func() { + sc := -1 + if result.lvgnrr.Response.Response != nil { + sc = result.lvgnrr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVpnGatewayNextResults + req, err := client.ListByVpnGatewayPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "ListByVpnGateway", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVpnGatewaySender(req) + if err != nil { + result.lvgnrr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "ListByVpnGateway", resp, "Failure sending request") + return + } + + result.lvgnrr, err = client.ListByVpnGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "ListByVpnGateway", resp, "Failure responding to request") + return + } + if result.lvgnrr.hasNextLink() && result.lvgnrr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVpnGatewayPreparer prepares the ListByVpnGateway request. +func (client NatRulesClient) ListByVpnGatewayPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/natRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVpnGatewaySender sends the ListByVpnGateway request. The method will close the +// http.Response Body if it receives an error. +func (client NatRulesClient) ListByVpnGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVpnGatewayResponder handles the response to the ListByVpnGateway request. The method always +// closes the http.Response Body. +func (client NatRulesClient) ListByVpnGatewayResponder(resp *http.Response) (result ListVpnGatewayNatRulesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVpnGatewayNextResults retrieves the next set of results, if any. +func (client NatRulesClient) listByVpnGatewayNextResults(ctx context.Context, lastResults ListVpnGatewayNatRulesResult) (result ListVpnGatewayNatRulesResult, err error) { + req, err := lastResults.listVpnGatewayNatRulesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.NatRulesClient", "listByVpnGatewayNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVpnGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.NatRulesClient", "listByVpnGatewayNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVpnGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.NatRulesClient", "listByVpnGatewayNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVpnGatewayComplete enumerates all values, automatically crossing page boundaries as required. +func (client NatRulesClient) ListByVpnGatewayComplete(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnGatewayNatRulesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NatRulesClient.ListByVpnGateway") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVpnGateway(ctx, resourceGroupName, gatewayName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/networkapi/interfaces.go b/services/network/mgmt/2021-08-01/network/networkapi/interfaces.go new file mode 100644 index 000000000000..a40faa29fe31 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/networkapi/interfaces.go @@ -0,0 +1,1406 @@ +package networkapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result network.DNSNameAvailabilityResult, err error) + DeleteBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest network.BastionShareableLinkListRequest) (result network.DeleteBastionShareableLinkFuture, err error) + DisconnectActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds network.SessionIds) (result network.BastionSessionDeleteResultPage, err error) + DisconnectActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string, sessionIds network.SessionIds) (result network.BastionSessionDeleteResultIterator, err error) + Generatevirtualwanvpnserverconfigurationvpnprofile(ctx context.Context, resourceGroupName string, virtualWANName string, vpnClientParams network.VirtualWanVpnProfileParameters) (result network.GeneratevirtualwanvpnserverconfigurationvpnprofileFuture, err error) + GetActiveSessions(ctx context.Context, resourceGroupName string, bastionHostName string) (result network.GetActiveSessionsFuture, err error) + GetActiveSessionsComplete(ctx context.Context, resourceGroupName string, bastionHostName string) (result network.GetActiveSessionsAllFuture, err error) + GetBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest network.BastionShareableLinkListRequest) (result network.BastionShareableLinkListResultPage, err error) + GetBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest network.BastionShareableLinkListRequest) (result network.BastionShareableLinkListResultIterator, err error) + PutBastionShareableLink(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest network.BastionShareableLinkListRequest) (result network.PutBastionShareableLinkFuture, err error) + PutBastionShareableLinkComplete(ctx context.Context, resourceGroupName string, bastionHostName string, bslRequest network.BastionShareableLinkListRequest) (result network.PutBastionShareableLinkAllFuture, err error) + SupportedSecurityProviders(ctx context.Context, resourceGroupName string, virtualWANName string) (result network.VirtualWanSecurityProviders, err error) +} + +var _ BaseClientAPI = (*network.BaseClient)(nil) + +// ApplicationGatewaysClientAPI contains the set of methods on the ApplicationGatewaysClient type. +type ApplicationGatewaysClientAPI interface { + BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result network.ApplicationGatewaysBackendHealthFuture, err error) + BackendHealthOnDemand(ctx context.Context, resourceGroupName string, applicationGatewayName string, probeRequest network.ApplicationGatewayOnDemandProbe, expand string) (result network.ApplicationGatewaysBackendHealthOnDemandFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters network.ApplicationGateway) (result network.ApplicationGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGateway, err error) + GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result network.ApplicationGatewaySslPredefinedPolicy, err error) + List(ctx context.Context, resourceGroupName string) (result network.ApplicationGatewayListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.ApplicationGatewayListResultIterator, err error) + ListAll(ctx context.Context) (result network.ApplicationGatewayListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.ApplicationGatewayListResultIterator, err error) + ListAvailableRequestHeaders(ctx context.Context) (result network.ListString, err error) + ListAvailableResponseHeaders(ctx context.Context) (result network.ListString, err error) + ListAvailableServerVariables(ctx context.Context) (result network.ListString, err error) + ListAvailableSslOptions(ctx context.Context) (result network.ApplicationGatewayAvailableSslOptions, err error) + ListAvailableSslPredefinedPolicies(ctx context.Context) (result network.ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) + ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result network.ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) + ListAvailableWafRuleSets(ctx context.Context) (result network.ApplicationGatewayAvailableWafRuleSetsResult, err error) + Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysStopFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters network.TagsObject) (result network.ApplicationGateway, err error) +} + +var _ ApplicationGatewaysClientAPI = (*network.ApplicationGatewaysClient)(nil) + +// ApplicationGatewayPrivateLinkResourcesClientAPI contains the set of methods on the ApplicationGatewayPrivateLinkResourcesClient type. +type ApplicationGatewayPrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewayPrivateLinkResourceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewayPrivateLinkResourceListResultIterator, err error) +} + +var _ ApplicationGatewayPrivateLinkResourcesClientAPI = (*network.ApplicationGatewayPrivateLinkResourcesClient)(nil) + +// ApplicationGatewayPrivateEndpointConnectionsClientAPI contains the set of methods on the ApplicationGatewayPrivateEndpointConnectionsClient type. +type ApplicationGatewayPrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (result network.ApplicationGatewayPrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string) (result network.ApplicationGatewayPrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewayPrivateEndpointConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewayPrivateEndpointConnectionListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, applicationGatewayName string, connectionName string, parameters network.ApplicationGatewayPrivateEndpointConnection) (result network.ApplicationGatewayPrivateEndpointConnectionsUpdateFuture, err error) +} + +var _ ApplicationGatewayPrivateEndpointConnectionsClientAPI = (*network.ApplicationGatewayPrivateEndpointConnectionsClient)(nil) + +// ApplicationSecurityGroupsClientAPI contains the set of methods on the ApplicationSecurityGroupsClient type. +type ApplicationSecurityGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters network.ApplicationSecurityGroup) (result network.ApplicationSecurityGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result network.ApplicationSecurityGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result network.ApplicationSecurityGroup, err error) + List(ctx context.Context, resourceGroupName string) (result network.ApplicationSecurityGroupListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.ApplicationSecurityGroupListResultIterator, err error) + ListAll(ctx context.Context) (result network.ApplicationSecurityGroupListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.ApplicationSecurityGroupListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters network.TagsObject) (result network.ApplicationSecurityGroup, err error) +} + +var _ ApplicationSecurityGroupsClientAPI = (*network.ApplicationSecurityGroupsClient)(nil) + +// AvailableDelegationsClientAPI contains the set of methods on the AvailableDelegationsClient type. +type AvailableDelegationsClientAPI interface { + List(ctx context.Context, location string) (result network.AvailableDelegationsResultPage, err error) + ListComplete(ctx context.Context, location string) (result network.AvailableDelegationsResultIterator, err error) +} + +var _ AvailableDelegationsClientAPI = (*network.AvailableDelegationsClient)(nil) + +// AvailableResourceGroupDelegationsClientAPI contains the set of methods on the AvailableResourceGroupDelegationsClient type. +type AvailableResourceGroupDelegationsClientAPI interface { + List(ctx context.Context, location string, resourceGroupName string) (result network.AvailableDelegationsResultPage, err error) + ListComplete(ctx context.Context, location string, resourceGroupName string) (result network.AvailableDelegationsResultIterator, err error) +} + +var _ AvailableResourceGroupDelegationsClientAPI = (*network.AvailableResourceGroupDelegationsClient)(nil) + +// AvailableServiceAliasesClientAPI contains the set of methods on the AvailableServiceAliasesClient type. +type AvailableServiceAliasesClientAPI interface { + List(ctx context.Context, location string) (result network.AvailableServiceAliasesResultPage, err error) + ListComplete(ctx context.Context, location string) (result network.AvailableServiceAliasesResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, location string) (result network.AvailableServiceAliasesResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, location string) (result network.AvailableServiceAliasesResultIterator, err error) +} + +var _ AvailableServiceAliasesClientAPI = (*network.AvailableServiceAliasesClient)(nil) + +// AzureFirewallsClientAPI contains the set of methods on the AzureFirewallsClient type. +type AzureFirewallsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters network.AzureFirewall) (result network.AzureFirewallsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, azureFirewallName string) (result network.AzureFirewallsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, azureFirewallName string) (result network.AzureFirewall, err error) + List(ctx context.Context, resourceGroupName string) (result network.AzureFirewallListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.AzureFirewallListResultIterator, err error) + ListAll(ctx context.Context) (result network.AzureFirewallListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.AzureFirewallListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, azureFirewallName string, parameters network.TagsObject) (result network.AzureFirewallsUpdateTagsFuture, err error) +} + +var _ AzureFirewallsClientAPI = (*network.AzureFirewallsClient)(nil) + +// AzureFirewallFqdnTagsClientAPI contains the set of methods on the AzureFirewallFqdnTagsClient type. +type AzureFirewallFqdnTagsClientAPI interface { + ListAll(ctx context.Context) (result network.AzureFirewallFqdnTagListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.AzureFirewallFqdnTagListResultIterator, err error) +} + +var _ AzureFirewallFqdnTagsClientAPI = (*network.AzureFirewallFqdnTagsClient)(nil) + +// WebCategoriesClientAPI contains the set of methods on the WebCategoriesClient type. +type WebCategoriesClientAPI interface { + Get(ctx context.Context, name string, expand string) (result network.AzureWebCategory, err error) + ListBySubscription(ctx context.Context) (result network.AzureWebCategoryListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result network.AzureWebCategoryListResultIterator, err error) +} + +var _ WebCategoriesClientAPI = (*network.WebCategoriesClient)(nil) + +// BastionHostsClientAPI contains the set of methods on the BastionHostsClient type. +type BastionHostsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, bastionHostName string, parameters network.BastionHost) (result network.BastionHostsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, bastionHostName string) (result network.BastionHostsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, bastionHostName string) (result network.BastionHost, err error) + List(ctx context.Context) (result network.BastionHostListResultPage, err error) + ListComplete(ctx context.Context) (result network.BastionHostListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.BastionHostListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.BastionHostListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, bastionHostName string, parameters network.TagsObject) (result network.BastionHostsUpdateTagsFuture, err error) +} + +var _ BastionHostsClientAPI = (*network.BastionHostsClient)(nil) + +// InterfacesClientAPI contains the set of methods on the InterfacesClient type. +type InterfacesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.Interface) (result network.InterfacesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result network.Interface, err error) + GetCloudServiceNetworkInterface(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, expand string) (result network.Interface, err error) + GetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesGetEffectiveRouteTableFuture, err error) + GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result network.InterfaceIPConfiguration, err error) + GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.Interface, err error) + List(ctx context.Context, resourceGroupName string) (result network.InterfaceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.InterfaceListResultIterator, err error) + ListAll(ctx context.Context) (result network.InterfaceListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.InterfaceListResultIterator, err error) + ListCloudServiceNetworkInterfaces(ctx context.Context, resourceGroupName string, cloudServiceName string) (result network.InterfaceListResultPage, err error) + ListCloudServiceNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string) (result network.InterfaceListResultIterator, err error) + ListCloudServiceRoleInstanceNetworkInterfaces(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string) (result network.InterfaceListResultPage, err error) + ListCloudServiceRoleInstanceNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string) (result network.InterfaceListResultIterator, err error) + ListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) + ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.InterfaceIPConfigurationListResultPage, err error) + ListVirtualMachineScaleSetIPConfigurationsComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.InterfaceIPConfigurationListResultIterator, err error) + ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.InterfaceListResultPage, err error) + ListVirtualMachineScaleSetNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.InterfaceListResultIterator, err error) + ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result network.InterfaceListResultPage, err error) + ListVirtualMachineScaleSetVMNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result network.InterfaceListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.TagsObject) (result network.Interface, err error) +} + +var _ InterfacesClientAPI = (*network.InterfacesClient)(nil) + +// PublicIPAddressesClientAPI contains the set of methods on the PublicIPAddressesClient type. +type PublicIPAddressesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress) (result network.PublicIPAddressesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (result network.PublicIPAddressesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) + GetCloudServicePublicIPAddress(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) + GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) + List(ctx context.Context, resourceGroupName string) (result network.PublicIPAddressListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.PublicIPAddressListResultIterator, err error) + ListAll(ctx context.Context) (result network.PublicIPAddressListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.PublicIPAddressListResultIterator, err error) + ListCloudServicePublicIPAddresses(ctx context.Context, resourceGroupName string, cloudServiceName string) (result network.PublicIPAddressListResultPage, err error) + ListCloudServicePublicIPAddressesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string) (result network.PublicIPAddressListResultIterator, err error) + ListCloudServiceRoleInstancePublicIPAddresses(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultPage, err error) + ListCloudServiceRoleInstancePublicIPAddressesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultIterator, err error) + ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.PublicIPAddressListResultPage, err error) + ListVirtualMachineScaleSetPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.PublicIPAddressListResultIterator, err error) + ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultPage, err error) + ListVirtualMachineScaleSetVMPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.TagsObject) (result network.PublicIPAddress, err error) +} + +var _ PublicIPAddressesClientAPI = (*network.PublicIPAddressesClient)(nil) + +// CustomIPPrefixesClientAPI contains the set of methods on the CustomIPPrefixesClient type. +type CustomIPPrefixesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters network.CustomIPPrefix) (result network.CustomIPPrefixesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, customIPPrefixName string) (result network.CustomIPPrefixesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, customIPPrefixName string, expand string) (result network.CustomIPPrefix, err error) + List(ctx context.Context, resourceGroupName string) (result network.CustomIPPrefixListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.CustomIPPrefixListResultIterator, err error) + ListAll(ctx context.Context) (result network.CustomIPPrefixListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.CustomIPPrefixListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, customIPPrefixName string, parameters network.TagsObject) (result network.CustomIPPrefix, err error) +} + +var _ CustomIPPrefixesClientAPI = (*network.CustomIPPrefixesClient)(nil) + +// DdosCustomPoliciesClientAPI contains the set of methods on the DdosCustomPoliciesClient type. +type DdosCustomPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters network.DdosCustomPolicy) (result network.DdosCustomPoliciesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (result network.DdosCustomPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string) (result network.DdosCustomPolicy, err error) + UpdateTags(ctx context.Context, resourceGroupName string, ddosCustomPolicyName string, parameters network.TagsObject) (result network.DdosCustomPolicy, err error) +} + +var _ DdosCustomPoliciesClientAPI = (*network.DdosCustomPoliciesClient)(nil) + +// DdosProtectionPlansClientAPI contains the set of methods on the DdosProtectionPlansClient type. +type DdosProtectionPlansClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters network.DdosProtectionPlan) (result network.DdosProtectionPlansCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result network.DdosProtectionPlansDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string) (result network.DdosProtectionPlan, err error) + List(ctx context.Context) (result network.DdosProtectionPlanListResultPage, err error) + ListComplete(ctx context.Context) (result network.DdosProtectionPlanListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.DdosProtectionPlanListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.DdosProtectionPlanListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, ddosProtectionPlanName string, parameters network.TagsObject) (result network.DdosProtectionPlan, err error) +} + +var _ DdosProtectionPlansClientAPI = (*network.DdosProtectionPlansClient)(nil) + +// DscpConfigurationClientAPI contains the set of methods on the DscpConfigurationClient type. +type DscpConfigurationClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, dscpConfigurationName string, parameters network.DscpConfiguration) (result network.DscpConfigurationCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (result network.DscpConfigurationDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, dscpConfigurationName string) (result network.DscpConfiguration, err error) + List(ctx context.Context, resourceGroupName string) (result network.DscpConfigurationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.DscpConfigurationListResultIterator, err error) + ListAll(ctx context.Context) (result network.DscpConfigurationListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.DscpConfigurationListResultIterator, err error) +} + +var _ DscpConfigurationClientAPI = (*network.DscpConfigurationClient)(nil) + +// AvailableEndpointServicesClientAPI contains the set of methods on the AvailableEndpointServicesClient type. +type AvailableEndpointServicesClientAPI interface { + List(ctx context.Context, location string) (result network.EndpointServicesListResultPage, err error) + ListComplete(ctx context.Context, location string) (result network.EndpointServicesListResultIterator, err error) +} + +var _ AvailableEndpointServicesClientAPI = (*network.AvailableEndpointServicesClient)(nil) + +// ExpressRouteCircuitAuthorizationsClientAPI contains the set of methods on the ExpressRouteCircuitAuthorizationsClient type. +type ExpressRouteCircuitAuthorizationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters network.ExpressRouteCircuitAuthorization) (result network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result network.ExpressRouteCircuitAuthorizationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result network.ExpressRouteCircuitAuthorization, err error) + List(ctx context.Context, resourceGroupName string, circuitName string) (result network.AuthorizationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result network.AuthorizationListResultIterator, err error) +} + +var _ ExpressRouteCircuitAuthorizationsClientAPI = (*network.ExpressRouteCircuitAuthorizationsClient)(nil) + +// ExpressRouteCircuitPeeringsClientAPI contains the set of methods on the ExpressRouteCircuitPeeringsClient type. +type ExpressRouteCircuitPeeringsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters network.ExpressRouteCircuitPeering) (result network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitPeeringsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitPeering, err error) + List(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitPeeringListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitPeeringListResultIterator, err error) +} + +var _ ExpressRouteCircuitPeeringsClientAPI = (*network.ExpressRouteCircuitPeeringsClient)(nil) + +// ExpressRouteCircuitConnectionsClientAPI contains the set of methods on the ExpressRouteCircuitConnectionsClient type. +type ExpressRouteCircuitConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string, expressRouteCircuitConnectionParameters network.ExpressRouteCircuitConnection) (result network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result network.ExpressRouteCircuitConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result network.ExpressRouteCircuitConnection, err error) + List(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitConnectionListResultIterator, err error) +} + +var _ ExpressRouteCircuitConnectionsClientAPI = (*network.ExpressRouteCircuitConnectionsClient)(nil) + +// PeerExpressRouteCircuitConnectionsClientAPI contains the set of methods on the PeerExpressRouteCircuitConnectionsClient type. +type PeerExpressRouteCircuitConnectionsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result network.PeerExpressRouteCircuitConnection, err error) + List(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.PeerExpressRouteCircuitConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.PeerExpressRouteCircuitConnectionListResultIterator, err error) +} + +var _ PeerExpressRouteCircuitConnectionsClientAPI = (*network.PeerExpressRouteCircuitConnectionsClient)(nil) + +// ExpressRouteCircuitsClientAPI contains the set of methods on the ExpressRouteCircuitsClient type. +type ExpressRouteCircuitsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters network.ExpressRouteCircuit) (result network.ExpressRouteCircuitsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuit, err error) + GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitStats, err error) + GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitStats, err error) + List(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCircuitListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCircuitListResultIterator, err error) + ListAll(ctx context.Context) (result network.ExpressRouteCircuitListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.ExpressRouteCircuitListResultIterator, err error) + ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListArpTableFuture, err error) + ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListRoutesTableFuture, err error) + ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters network.TagsObject) (result network.ExpressRouteCircuit, err error) +} + +var _ ExpressRouteCircuitsClientAPI = (*network.ExpressRouteCircuitsClient)(nil) + +// ExpressRouteServiceProvidersClientAPI contains the set of methods on the ExpressRouteServiceProvidersClient type. +type ExpressRouteServiceProvidersClientAPI interface { + List(ctx context.Context) (result network.ExpressRouteServiceProviderListResultPage, err error) + ListComplete(ctx context.Context) (result network.ExpressRouteServiceProviderListResultIterator, err error) +} + +var _ ExpressRouteServiceProvidersClientAPI = (*network.ExpressRouteServiceProvidersClient)(nil) + +// ExpressRouteCrossConnectionsClientAPI contains the set of methods on the ExpressRouteCrossConnectionsClient type. +type ExpressRouteCrossConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters network.ExpressRouteCrossConnection) (result network.ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) + Get(ctx context.Context, resourceGroupName string, crossConnectionName string) (result network.ExpressRouteCrossConnection, err error) + List(ctx context.Context) (result network.ExpressRouteCrossConnectionListResultPage, err error) + ListComplete(ctx context.Context) (result network.ExpressRouteCrossConnectionListResultIterator, err error) + ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result network.ExpressRouteCrossConnectionsListArpTableFuture, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCrossConnectionListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCrossConnectionListResultIterator, err error) + ListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result network.ExpressRouteCrossConnectionsListRoutesTableFuture, err error) + ListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters network.TagsObject) (result network.ExpressRouteCrossConnection, err error) +} + +var _ ExpressRouteCrossConnectionsClientAPI = (*network.ExpressRouteCrossConnectionsClient)(nil) + +// ExpressRouteCrossConnectionPeeringsClientAPI contains the set of methods on the ExpressRouteCrossConnectionPeeringsClient type. +type ExpressRouteCrossConnectionPeeringsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, peeringParameters network.ExpressRouteCrossConnectionPeering) (result network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result network.ExpressRouteCrossConnectionPeeringsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string) (result network.ExpressRouteCrossConnectionPeering, err error) + List(ctx context.Context, resourceGroupName string, crossConnectionName string) (result network.ExpressRouteCrossConnectionPeeringListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, crossConnectionName string) (result network.ExpressRouteCrossConnectionPeeringListIterator, err error) +} + +var _ ExpressRouteCrossConnectionPeeringsClientAPI = (*network.ExpressRouteCrossConnectionPeeringsClient)(nil) + +// ExpressRoutePortsLocationsClientAPI contains the set of methods on the ExpressRoutePortsLocationsClient type. +type ExpressRoutePortsLocationsClientAPI interface { + Get(ctx context.Context, locationName string) (result network.ExpressRoutePortsLocation, err error) + List(ctx context.Context) (result network.ExpressRoutePortsLocationListResultPage, err error) + ListComplete(ctx context.Context) (result network.ExpressRoutePortsLocationListResultIterator, err error) +} + +var _ ExpressRoutePortsLocationsClientAPI = (*network.ExpressRoutePortsLocationsClient)(nil) + +// ExpressRoutePortsClientAPI contains the set of methods on the ExpressRoutePortsClient type. +type ExpressRoutePortsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters network.ExpressRoutePort) (result network.ExpressRoutePortsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRoutePortsDeleteFuture, err error) + GenerateLOA(ctx context.Context, resourceGroupName string, expressRoutePortName string, request network.GenerateExpressRoutePortsLOARequest) (result network.GenerateExpressRoutePortsLOAResult, err error) + Get(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRoutePort, err error) + List(ctx context.Context) (result network.ExpressRoutePortListResultPage, err error) + ListComplete(ctx context.Context) (result network.ExpressRoutePortListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ExpressRoutePortListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ExpressRoutePortListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, expressRoutePortName string, parameters network.TagsObject) (result network.ExpressRoutePort, err error) +} + +var _ ExpressRoutePortsClientAPI = (*network.ExpressRoutePortsClient)(nil) + +// ExpressRouteLinksClientAPI contains the set of methods on the ExpressRouteLinksClient type. +type ExpressRouteLinksClientAPI interface { + Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, linkName string) (result network.ExpressRouteLink, err error) + List(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRouteLinkListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRouteLinkListResultIterator, err error) +} + +var _ ExpressRouteLinksClientAPI = (*network.ExpressRouteLinksClient)(nil) + +// ExpressRoutePortAuthorizationsClientAPI contains the set of methods on the ExpressRoutePortAuthorizationsClient type. +type ExpressRoutePortAuthorizationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string, authorizationParameters network.ExpressRoutePortAuthorization) (result network.ExpressRoutePortAuthorizationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (result network.ExpressRoutePortAuthorizationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, expressRoutePortName string, authorizationName string) (result network.ExpressRoutePortAuthorization, err error) + List(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRoutePortAuthorizationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, expressRoutePortName string) (result network.ExpressRoutePortAuthorizationListResultIterator, err error) +} + +var _ ExpressRoutePortAuthorizationsClientAPI = (*network.ExpressRoutePortAuthorizationsClient)(nil) + +// FirewallPoliciesClientAPI contains the set of methods on the FirewallPoliciesClient type. +type FirewallPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters network.FirewallPolicy) (result network.FirewallPoliciesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result network.FirewallPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, expand string) (result network.FirewallPolicy, err error) + List(ctx context.Context, resourceGroupName string) (result network.FirewallPolicyListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.FirewallPolicyListResultIterator, err error) + ListAll(ctx context.Context) (result network.FirewallPolicyListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.FirewallPolicyListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters network.TagsObject) (result network.FirewallPolicy, err error) +} + +var _ FirewallPoliciesClientAPI = (*network.FirewallPoliciesClient)(nil) + +// FirewallPolicyRuleCollectionGroupsClientAPI contains the set of methods on the FirewallPolicyRuleCollectionGroupsClient type. +type FirewallPolicyRuleCollectionGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string, parameters network.FirewallPolicyRuleCollectionGroup) (result network.FirewallPolicyRuleCollectionGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (result network.FirewallPolicyRuleCollectionGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleCollectionGroupName string) (result network.FirewallPolicyRuleCollectionGroup, err error) + List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result network.FirewallPolicyRuleCollectionGroupListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result network.FirewallPolicyRuleCollectionGroupListResultIterator, err error) +} + +var _ FirewallPolicyRuleCollectionGroupsClientAPI = (*network.FirewallPolicyRuleCollectionGroupsClient)(nil) + +// FirewallPolicyIdpsSignaturesClientAPI contains the set of methods on the FirewallPolicyIdpsSignaturesClient type. +type FirewallPolicyIdpsSignaturesClientAPI interface { + List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters network.IDPSQueryObject) (result network.QueryResults, err error) +} + +var _ FirewallPolicyIdpsSignaturesClientAPI = (*network.FirewallPolicyIdpsSignaturesClient)(nil) + +// FirewallPolicyIdpsSignaturesOverridesClientAPI contains the set of methods on the FirewallPolicyIdpsSignaturesOverridesClient type. +type FirewallPolicyIdpsSignaturesOverridesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result network.SignaturesOverrides, err error) + List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result network.SignaturesOverridesList, err error) + Patch(ctx context.Context, parameters network.SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (result network.SignaturesOverrides, err error) + Put(ctx context.Context, parameters network.SignaturesOverrides, resourceGroupName string, firewallPolicyName string) (result network.SignaturesOverrides, err error) +} + +var _ FirewallPolicyIdpsSignaturesOverridesClientAPI = (*network.FirewallPolicyIdpsSignaturesOverridesClient)(nil) + +// FirewallPolicyIdpsSignaturesFilterValuesClientAPI contains the set of methods on the FirewallPolicyIdpsSignaturesFilterValuesClient type. +type FirewallPolicyIdpsSignaturesFilterValuesClientAPI interface { + List(ctx context.Context, parameters network.SignatureOverridesFilterValuesQuery, resourceGroupName string, firewallPolicyName string) (result network.SignatureOverridesFilterValuesResponse, err error) +} + +var _ FirewallPolicyIdpsSignaturesFilterValuesClientAPI = (*network.FirewallPolicyIdpsSignaturesFilterValuesClient)(nil) + +// IPAllocationsClientAPI contains the set of methods on the IPAllocationsClient type. +type IPAllocationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters network.IPAllocation) (result network.IPAllocationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, IPAllocationName string) (result network.IPAllocationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, IPAllocationName string, expand string) (result network.IPAllocation, err error) + List(ctx context.Context) (result network.IPAllocationListResultPage, err error) + ListComplete(ctx context.Context) (result network.IPAllocationListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.IPAllocationListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.IPAllocationListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, IPAllocationName string, parameters network.TagsObject) (result network.IPAllocation, err error) +} + +var _ IPAllocationsClientAPI = (*network.IPAllocationsClient)(nil) + +// IPGroupsClientAPI contains the set of methods on the IPGroupsClient type. +type IPGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters network.IPGroup) (result network.IPGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, IPGroupsName string) (result network.IPGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, IPGroupsName string, expand string) (result network.IPGroup, err error) + List(ctx context.Context) (result network.IPGroupListResultPage, err error) + ListComplete(ctx context.Context) (result network.IPGroupListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.IPGroupListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.IPGroupListResultIterator, err error) + UpdateGroups(ctx context.Context, resourceGroupName string, IPGroupsName string, parameters network.TagsObject) (result network.IPGroup, err error) +} + +var _ IPGroupsClientAPI = (*network.IPGroupsClient)(nil) + +// LoadBalancersClientAPI contains the set of methods on the LoadBalancersClient type. +type LoadBalancersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer) (result network.LoadBalancersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, err error) + List(ctx context.Context, resourceGroupName string) (result network.LoadBalancerListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.LoadBalancerListResultIterator, err error) + ListAll(ctx context.Context) (result network.LoadBalancerListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.LoadBalancerListResultIterator, err error) + ListInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters network.QueryInboundNatRulePortMappingRequest) (result network.LoadBalancersListInboundNatRulePortMappingsFuture, err error) + SwapPublicIPAddresses(ctx context.Context, location string, parameters network.LoadBalancerVipSwapRequest) (result network.LoadBalancersSwapPublicIPAddressesFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.TagsObject) (result network.LoadBalancer, err error) +} + +var _ LoadBalancersClientAPI = (*network.LoadBalancersClient)(nil) + +// LoadBalancerBackendAddressPoolsClientAPI contains the set of methods on the LoadBalancerBackendAddressPoolsClient type. +type LoadBalancerBackendAddressPoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string, parameters network.BackendAddressPool) (result network.LoadBalancerBackendAddressPoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result network.LoadBalancerBackendAddressPoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result network.BackendAddressPool, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerBackendAddressPoolListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerBackendAddressPoolListResultIterator, err error) +} + +var _ LoadBalancerBackendAddressPoolsClientAPI = (*network.LoadBalancerBackendAddressPoolsClient)(nil) + +// LoadBalancerFrontendIPConfigurationsClientAPI contains the set of methods on the LoadBalancerFrontendIPConfigurationsClient type. +type LoadBalancerFrontendIPConfigurationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result network.FrontendIPConfiguration, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerFrontendIPConfigurationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerFrontendIPConfigurationListResultIterator, err error) +} + +var _ LoadBalancerFrontendIPConfigurationsClientAPI = (*network.LoadBalancerFrontendIPConfigurationsClient)(nil) + +// InboundNatRulesClientAPI contains the set of methods on the InboundNatRulesClient type. +type InboundNatRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters network.InboundNatRule) (result network.InboundNatRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result network.InboundNatRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result network.InboundNatRule, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InboundNatRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InboundNatRuleListResultIterator, err error) +} + +var _ InboundNatRulesClientAPI = (*network.InboundNatRulesClient)(nil) + +// LoadBalancerLoadBalancingRulesClientAPI contains the set of methods on the LoadBalancerLoadBalancingRulesClient type. +type LoadBalancerLoadBalancingRulesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result network.LoadBalancingRule, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerLoadBalancingRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerLoadBalancingRuleListResultIterator, err error) +} + +var _ LoadBalancerLoadBalancingRulesClientAPI = (*network.LoadBalancerLoadBalancingRulesClient)(nil) + +// LoadBalancerOutboundRulesClientAPI contains the set of methods on the LoadBalancerOutboundRulesClient type. +type LoadBalancerOutboundRulesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, outboundRuleName string) (result network.OutboundRule, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerOutboundRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerOutboundRuleListResultIterator, err error) +} + +var _ LoadBalancerOutboundRulesClientAPI = (*network.LoadBalancerOutboundRulesClient)(nil) + +// LoadBalancerNetworkInterfacesClientAPI contains the set of methods on the LoadBalancerNetworkInterfacesClient type. +type LoadBalancerNetworkInterfacesClientAPI interface { + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InterfaceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InterfaceListResultIterator, err error) +} + +var _ LoadBalancerNetworkInterfacesClientAPI = (*network.LoadBalancerNetworkInterfacesClient)(nil) + +// LoadBalancerProbesClientAPI contains the set of methods on the LoadBalancerProbesClient type. +type LoadBalancerProbesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result network.Probe, err error) + List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerProbeListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerProbeListResultIterator, err error) +} + +var _ LoadBalancerProbesClientAPI = (*network.LoadBalancerProbesClient)(nil) + +// NatGatewaysClientAPI contains the set of methods on the NatGatewaysClient type. +type NatGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, natGatewayName string, parameters network.NatGateway) (result network.NatGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, natGatewayName string) (result network.NatGatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, natGatewayName string, expand string) (result network.NatGateway, err error) + List(ctx context.Context, resourceGroupName string) (result network.NatGatewayListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.NatGatewayListResultIterator, err error) + ListAll(ctx context.Context) (result network.NatGatewayListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.NatGatewayListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, natGatewayName string, parameters network.TagsObject) (result network.NatGateway, err error) +} + +var _ NatGatewaysClientAPI = (*network.NatGatewaysClient)(nil) + +// InterfaceIPConfigurationsClientAPI contains the set of methods on the InterfaceIPConfigurationsClient type. +type InterfaceIPConfigurationsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result network.InterfaceIPConfiguration, err error) + List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceIPConfigurationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceIPConfigurationListResultIterator, err error) +} + +var _ InterfaceIPConfigurationsClientAPI = (*network.InterfaceIPConfigurationsClient)(nil) + +// InterfaceLoadBalancersClientAPI contains the set of methods on the InterfaceLoadBalancersClient type. +type InterfaceLoadBalancersClientAPI interface { + List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceLoadBalancerListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceLoadBalancerListResultIterator, err error) +} + +var _ InterfaceLoadBalancersClientAPI = (*network.InterfaceLoadBalancersClient)(nil) + +// InterfaceTapConfigurationsClientAPI contains the set of methods on the InterfaceTapConfigurationsClient type. +type InterfaceTapConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string, tapConfigurationParameters network.InterfaceTapConfiguration) (result network.InterfaceTapConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (result network.InterfaceTapConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, tapConfigurationName string) (result network.InterfaceTapConfiguration, err error) + List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceTapConfigurationListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceTapConfigurationListResultIterator, err error) +} + +var _ InterfaceTapConfigurationsClientAPI = (*network.InterfaceTapConfigurationsClient)(nil) + +// ProfilesClientAPI contains the set of methods on the ProfilesClient type. +type ProfilesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkProfileName string, parameters network.Profile) (result network.Profile, err error) + Delete(ctx context.Context, resourceGroupName string, networkProfileName string) (result network.ProfilesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkProfileName string, expand string) (result network.Profile, err error) + List(ctx context.Context, resourceGroupName string) (result network.ProfileListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.ProfileListResultIterator, err error) + ListAll(ctx context.Context) (result network.ProfileListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.ProfileListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkProfileName string, parameters network.TagsObject) (result network.Profile, err error) +} + +var _ ProfilesClientAPI = (*network.ProfilesClient)(nil) + +// SecurityGroupsClientAPI contains the set of methods on the SecurityGroupsClient type. +type SecurityGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup) (result network.SecurityGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, err error) + List(ctx context.Context, resourceGroupName string) (result network.SecurityGroupListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.SecurityGroupListResultIterator, err error) + ListAll(ctx context.Context) (result network.SecurityGroupListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.SecurityGroupListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.TagsObject) (result network.SecurityGroup, err error) +} + +var _ SecurityGroupsClientAPI = (*network.SecurityGroupsClient)(nil) + +// SecurityRulesClientAPI contains the set of methods on the SecurityRulesClient type. +type SecurityRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters network.SecurityRule) (result network.SecurityRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result network.SecurityRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result network.SecurityRule, err error) + List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultIterator, err error) +} + +var _ SecurityRulesClientAPI = (*network.SecurityRulesClient)(nil) + +// DefaultSecurityRulesClientAPI contains the set of methods on the DefaultSecurityRulesClient type. +type DefaultSecurityRulesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result network.SecurityRule, err error) + List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultIterator, err error) +} + +var _ DefaultSecurityRulesClientAPI = (*network.DefaultSecurityRulesClient)(nil) + +// VirtualAppliancesClientAPI contains the set of methods on the VirtualAppliancesClient type. +type VirtualAppliancesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters network.VirtualAppliance) (result network.VirtualAppliancesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result network.VirtualAppliancesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, expand string) (result network.VirtualAppliance, err error) + List(ctx context.Context) (result network.VirtualApplianceListResultPage, err error) + ListComplete(ctx context.Context) (result network.VirtualApplianceListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.VirtualApplianceListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.VirtualApplianceListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters network.TagsObject) (result network.VirtualAppliance, err error) +} + +var _ VirtualAppliancesClientAPI = (*network.VirtualAppliancesClient)(nil) + +// VirtualApplianceSitesClientAPI contains the set of methods on the VirtualApplianceSitesClient type. +type VirtualApplianceSitesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters network.VirtualApplianceSite) (result network.VirtualApplianceSitesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (result network.VirtualApplianceSitesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (result network.VirtualApplianceSite, err error) + List(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result network.VirtualApplianceSiteListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result network.VirtualApplianceSiteListResultIterator, err error) +} + +var _ VirtualApplianceSitesClientAPI = (*network.VirtualApplianceSitesClient)(nil) + +// VirtualApplianceSkusClientAPI contains the set of methods on the VirtualApplianceSkusClient type. +type VirtualApplianceSkusClientAPI interface { + Get(ctx context.Context, skuName string) (result network.VirtualApplianceSku, err error) + List(ctx context.Context) (result network.VirtualApplianceSkuListResultPage, err error) + ListComplete(ctx context.Context) (result network.VirtualApplianceSkuListResultIterator, err error) +} + +var _ VirtualApplianceSkusClientAPI = (*network.VirtualApplianceSkusClient)(nil) + +// InboundSecurityRuleClientAPI contains the set of methods on the InboundSecurityRuleClient type. +type InboundSecurityRuleClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, ruleCollectionName string, parameters network.InboundSecurityRule) (result network.InboundSecurityRuleCreateOrUpdateFuture, err error) +} + +var _ InboundSecurityRuleClientAPI = (*network.InboundSecurityRuleClient)(nil) + +// WatchersClientAPI contains the set of methods on the WatchersClient type. +type WatchersClientAPI interface { + CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.ConnectivityParameters) (result network.WatchersCheckConnectivityFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.Watcher) (result network.Watcher, err error) + Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.WatchersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.Watcher, err error) + GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.AzureReachabilityReportParameters) (result network.WatchersGetAzureReachabilityReportFuture, err error) + GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.FlowLogStatusParameters) (result network.WatchersGetFlowLogStatusFuture, err error) + GetNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.ConfigurationDiagnosticParameters) (result network.WatchersGetNetworkConfigurationDiagnosticFuture, err error) + GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.NextHopParameters) (result network.WatchersGetNextHopFuture, err error) + GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TopologyParameters) (result network.Topology, err error) + GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TroubleshootingParameters) (result network.WatchersGetTroubleshootingFuture, err error) + GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.QueryTroubleshootingParameters) (result network.WatchersGetTroubleshootingResultFuture, err error) + GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.SecurityGroupViewParameters) (result network.WatchersGetVMSecurityRulesFuture, err error) + List(ctx context.Context, resourceGroupName string) (result network.WatcherListResult, err error) + ListAll(ctx context.Context) (result network.WatcherListResult, err error) + ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.AvailableProvidersListParameters) (result network.WatchersListAvailableProvidersFuture, err error) + SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.FlowLogInformation) (result network.WatchersSetFlowLogConfigurationFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TagsObject) (result network.Watcher, err error) + VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.VerificationIPFlowParameters) (result network.WatchersVerifyIPFlowFuture, err error) +} + +var _ WatchersClientAPI = (*network.WatchersClient)(nil) + +// PacketCapturesClientAPI contains the set of methods on the PacketCapturesClient type. +type PacketCapturesClientAPI interface { + Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters network.PacketCapture) (result network.PacketCapturesCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCaptureResult, err error) + GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesGetStatusFuture, err error) + List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.PacketCaptureListResult, err error) + Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesStopFuture, err error) +} + +var _ PacketCapturesClientAPI = (*network.PacketCapturesClient)(nil) + +// ConnectionMonitorsClientAPI contains the set of methods on the ConnectionMonitorsClient type. +type ConnectionMonitorsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters network.ConnectionMonitor, migrate string) (result network.ConnectionMonitorsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result network.ConnectionMonitorsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result network.ConnectionMonitorResult, err error) + List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.ConnectionMonitorListResult, err error) + Query(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result network.ConnectionMonitorsQueryFuture, err error) + Start(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result network.ConnectionMonitorsStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string) (result network.ConnectionMonitorsStopFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, connectionMonitorName string, parameters network.TagsObject) (result network.ConnectionMonitorResult, err error) +} + +var _ ConnectionMonitorsClientAPI = (*network.ConnectionMonitorsClient)(nil) + +// FlowLogsClientAPI contains the set of methods on the FlowLogsClient type. +type FlowLogsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters network.FlowLog) (result network.FlowLogsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (result network.FlowLogsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string) (result network.FlowLog, err error) + List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.FlowLogListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.FlowLogListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, flowLogName string, parameters network.TagsObject) (result network.FlowLog, err error) +} + +var _ FlowLogsClientAPI = (*network.FlowLogsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result network.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result network.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*network.OperationsClient)(nil) + +// PrivateEndpointsClientAPI contains the set of methods on the PrivateEndpointsClient type. +type PrivateEndpointsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters network.PrivateEndpoint) (result network.PrivateEndpointsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, privateEndpointName string) (result network.PrivateEndpointsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, privateEndpointName string, expand string) (result network.PrivateEndpoint, err error) + List(ctx context.Context, resourceGroupName string) (result network.PrivateEndpointListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.PrivateEndpointListResultIterator, err error) + ListBySubscription(ctx context.Context) (result network.PrivateEndpointListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result network.PrivateEndpointListResultIterator, err error) +} + +var _ PrivateEndpointsClientAPI = (*network.PrivateEndpointsClient)(nil) + +// AvailablePrivateEndpointTypesClientAPI contains the set of methods on the AvailablePrivateEndpointTypesClient type. +type AvailablePrivateEndpointTypesClientAPI interface { + List(ctx context.Context, location string) (result network.AvailablePrivateEndpointTypesResultPage, err error) + ListComplete(ctx context.Context, location string) (result network.AvailablePrivateEndpointTypesResultIterator, err error) + ListByResourceGroup(ctx context.Context, location string, resourceGroupName string) (result network.AvailablePrivateEndpointTypesResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, location string, resourceGroupName string) (result network.AvailablePrivateEndpointTypesResultIterator, err error) +} + +var _ AvailablePrivateEndpointTypesClientAPI = (*network.AvailablePrivateEndpointTypesClient)(nil) + +// PrivateDNSZoneGroupsClientAPI contains the set of methods on the PrivateDNSZoneGroupsClient type. +type PrivateDNSZoneGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters network.PrivateDNSZoneGroup) (result network.PrivateDNSZoneGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (result network.PrivateDNSZoneGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (result network.PrivateDNSZoneGroup, err error) + List(ctx context.Context, privateEndpointName string, resourceGroupName string) (result network.PrivateDNSZoneGroupListResultPage, err error) + ListComplete(ctx context.Context, privateEndpointName string, resourceGroupName string) (result network.PrivateDNSZoneGroupListResultIterator, err error) +} + +var _ PrivateDNSZoneGroupsClientAPI = (*network.PrivateDNSZoneGroupsClient)(nil) + +// PrivateLinkServicesClientAPI contains the set of methods on the PrivateLinkServicesClient type. +type PrivateLinkServicesClientAPI interface { + CheckPrivateLinkServiceVisibility(ctx context.Context, location string, parameters network.CheckPrivateLinkServiceVisibilityRequest) (result network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture, err error) + CheckPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters network.CheckPrivateLinkServiceVisibilityRequest) (result network.PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters network.PrivateLinkService) (result network.PrivateLinkServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceName string) (result network.PrivateLinkServicesDeleteFuture, err error) + DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string) (result network.PrivateLinkServicesDeletePrivateEndpointConnectionFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceName string, expand string) (result network.PrivateLinkService, err error) + GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, expand string) (result network.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string) (result network.PrivateLinkServiceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.PrivateLinkServiceListResultIterator, err error) + ListAutoApprovedPrivateLinkServices(ctx context.Context, location string) (result network.AutoApprovedPrivateLinkServicesResultPage, err error) + ListAutoApprovedPrivateLinkServicesComplete(ctx context.Context, location string) (result network.AutoApprovedPrivateLinkServicesResultIterator, err error) + ListAutoApprovedPrivateLinkServicesByResourceGroup(ctx context.Context, location string, resourceGroupName string) (result network.AutoApprovedPrivateLinkServicesResultPage, err error) + ListAutoApprovedPrivateLinkServicesByResourceGroupComplete(ctx context.Context, location string, resourceGroupName string) (result network.AutoApprovedPrivateLinkServicesResultIterator, err error) + ListBySubscription(ctx context.Context) (result network.PrivateLinkServiceListResultPage, err error) + ListBySubscriptionComplete(ctx context.Context) (result network.PrivateLinkServiceListResultIterator, err error) + ListPrivateEndpointConnections(ctx context.Context, resourceGroupName string, serviceName string) (result network.PrivateEndpointConnectionListResultPage, err error) + ListPrivateEndpointConnectionsComplete(ctx context.Context, resourceGroupName string, serviceName string) (result network.PrivateEndpointConnectionListResultIterator, err error) + UpdatePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters network.PrivateEndpointConnection) (result network.PrivateEndpointConnection, err error) +} + +var _ PrivateLinkServicesClientAPI = (*network.PrivateLinkServicesClient)(nil) + +// PublicIPPrefixesClientAPI contains the set of methods on the PublicIPPrefixesClient type. +type PublicIPPrefixesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters network.PublicIPPrefix) (result network.PublicIPPrefixesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, publicIPPrefixName string) (result network.PublicIPPrefixesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, publicIPPrefixName string, expand string) (result network.PublicIPPrefix, err error) + List(ctx context.Context, resourceGroupName string) (result network.PublicIPPrefixListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.PublicIPPrefixListResultIterator, err error) + ListAll(ctx context.Context) (result network.PublicIPPrefixListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.PublicIPPrefixListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters network.TagsObject) (result network.PublicIPPrefix, err error) +} + +var _ PublicIPPrefixesClientAPI = (*network.PublicIPPrefixesClient)(nil) + +// RouteFiltersClientAPI contains the set of methods on the RouteFiltersClient type. +type RouteFiltersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters network.RouteFilter) (result network.RouteFiltersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFiltersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (result network.RouteFilter, err error) + List(ctx context.Context) (result network.RouteFilterListResultPage, err error) + ListComplete(ctx context.Context) (result network.RouteFilterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.RouteFilterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.RouteFilterListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, routeFilterName string, parameters network.TagsObject) (result network.RouteFilter, err error) +} + +var _ RouteFiltersClientAPI = (*network.RouteFiltersClient)(nil) + +// RouteFilterRulesClientAPI contains the set of methods on the RouteFilterRulesClient type. +type RouteFilterRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters network.RouteFilterRule) (result network.RouteFilterRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result network.RouteFilterRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result network.RouteFilterRule, err error) + ListByRouteFilter(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFilterRuleListResultPage, err error) + ListByRouteFilterComplete(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFilterRuleListResultIterator, err error) +} + +var _ RouteFilterRulesClientAPI = (*network.RouteFilterRulesClient)(nil) + +// RouteTablesClientAPI contains the set of methods on the RouteTablesClient type. +type RouteTablesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable) (result network.RouteTablesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteTablesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result network.RouteTable, err error) + List(ctx context.Context, resourceGroupName string) (result network.RouteTableListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.RouteTableListResultIterator, err error) + ListAll(ctx context.Context) (result network.RouteTableListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.RouteTableListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.TagsObject) (result network.RouteTable, err error) +} + +var _ RouteTablesClientAPI = (*network.RouteTablesClient)(nil) + +// RoutesClientAPI contains the set of methods on the RoutesClient type. +type RoutesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters network.Route) (result network.RoutesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result network.RoutesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result network.Route, err error) + List(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteListResultIterator, err error) +} + +var _ RoutesClientAPI = (*network.RoutesClient)(nil) + +// SecurityPartnerProvidersClientAPI contains the set of methods on the SecurityPartnerProvidersClient type. +type SecurityPartnerProvidersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters network.SecurityPartnerProvider) (result network.SecurityPartnerProvidersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (result network.SecurityPartnerProvidersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (result network.SecurityPartnerProvider, err error) + List(ctx context.Context) (result network.SecurityPartnerProviderListResultPage, err error) + ListComplete(ctx context.Context) (result network.SecurityPartnerProviderListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.SecurityPartnerProviderListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.SecurityPartnerProviderListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters network.TagsObject) (result network.SecurityPartnerProvider, err error) +} + +var _ SecurityPartnerProvidersClientAPI = (*network.SecurityPartnerProvidersClient)(nil) + +// BgpServiceCommunitiesClientAPI contains the set of methods on the BgpServiceCommunitiesClient type. +type BgpServiceCommunitiesClientAPI interface { + List(ctx context.Context) (result network.BgpServiceCommunityListResultPage, err error) + ListComplete(ctx context.Context) (result network.BgpServiceCommunityListResultIterator, err error) +} + +var _ BgpServiceCommunitiesClientAPI = (*network.BgpServiceCommunitiesClient)(nil) + +// ServiceEndpointPoliciesClientAPI contains the set of methods on the ServiceEndpointPoliciesClient type. +type ServiceEndpointPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters network.ServiceEndpointPolicy) (result network.ServiceEndpointPoliciesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result network.ServiceEndpointPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, expand string) (result network.ServiceEndpointPolicy, err error) + List(ctx context.Context) (result network.ServiceEndpointPolicyListResultPage, err error) + ListComplete(ctx context.Context) (result network.ServiceEndpointPolicyListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ServiceEndpointPolicyListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ServiceEndpointPolicyListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters network.TagsObject) (result network.ServiceEndpointPolicy, err error) +} + +var _ ServiceEndpointPoliciesClientAPI = (*network.ServiceEndpointPoliciesClient)(nil) + +// ServiceEndpointPolicyDefinitionsClientAPI contains the set of methods on the ServiceEndpointPolicyDefinitionsClient type. +type ServiceEndpointPolicyDefinitionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions network.ServiceEndpointPolicyDefinition) (result network.ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (result network.ServiceEndpointPolicyDefinitionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (result network.ServiceEndpointPolicyDefinition, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result network.ServiceEndpointPolicyDefinitionListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result network.ServiceEndpointPolicyDefinitionListResultIterator, err error) +} + +var _ ServiceEndpointPolicyDefinitionsClientAPI = (*network.ServiceEndpointPolicyDefinitionsClient)(nil) + +// ServiceTagsClientAPI contains the set of methods on the ServiceTagsClient type. +type ServiceTagsClientAPI interface { + List(ctx context.Context, location string) (result network.ServiceTagsListResult, err error) +} + +var _ ServiceTagsClientAPI = (*network.ServiceTagsClient)(nil) + +// ServiceTagInformationClientAPI contains the set of methods on the ServiceTagInformationClient type. +type ServiceTagInformationClientAPI interface { + List(ctx context.Context, location string, noAddressPrefixes *bool, tagName string) (result network.ServiceTagInformationListResultPage, err error) + ListComplete(ctx context.Context, location string, noAddressPrefixes *bool, tagName string) (result network.ServiceTagInformationListResultIterator, err error) +} + +var _ ServiceTagInformationClientAPI = (*network.ServiceTagInformationClient)(nil) + +// UsagesClientAPI contains the set of methods on the UsagesClient type. +type UsagesClientAPI interface { + List(ctx context.Context, location string) (result network.UsagesListResultPage, err error) + ListComplete(ctx context.Context, location string) (result network.UsagesListResultIterator, err error) +} + +var _ UsagesClientAPI = (*network.UsagesClient)(nil) + +// VirtualNetworksClientAPI contains the set of methods on the VirtualNetworksClient type. +type VirtualNetworksClientAPI interface { + CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result network.IPAddressAvailabilityResult, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters network.VirtualNetwork) (result network.VirtualNetworksCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworksDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result network.VirtualNetwork, err error) + List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkListResultIterator, err error) + ListAll(ctx context.Context) (result network.VirtualNetworkListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.VirtualNetworkListResultIterator, err error) + ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkListUsageResultPage, err error) + ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkListUsageResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters network.TagsObject) (result network.VirtualNetwork, err error) +} + +var _ VirtualNetworksClientAPI = (*network.VirtualNetworksClient)(nil) + +// SubnetsClientAPI contains the set of methods on the SubnetsClient type. +type SubnetsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet) (result network.SubnetsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result network.SubnetsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, err error) + List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.SubnetListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.SubnetListResultIterator, err error) + PrepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters network.PrepareNetworkPoliciesRequest) (result network.SubnetsPrepareNetworkPoliciesFuture, err error) + UnprepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters network.UnprepareNetworkPoliciesRequest) (result network.SubnetsUnprepareNetworkPoliciesFuture, err error) +} + +var _ SubnetsClientAPI = (*network.SubnetsClient)(nil) + +// ResourceNavigationLinksClientAPI contains the set of methods on the ResourceNavigationLinksClient type. +type ResourceNavigationLinksClientAPI interface { + List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result network.ResourceNavigationLinksListResult, err error) +} + +var _ ResourceNavigationLinksClientAPI = (*network.ResourceNavigationLinksClient)(nil) + +// ServiceAssociationLinksClientAPI contains the set of methods on the ServiceAssociationLinksClient type. +type ServiceAssociationLinksClientAPI interface { + List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result network.ServiceAssociationLinksListResult, err error) +} + +var _ ServiceAssociationLinksClientAPI = (*network.ServiceAssociationLinksClient)(nil) + +// VirtualNetworkPeeringsClientAPI contains the set of methods on the VirtualNetworkPeeringsClient type. +type VirtualNetworkPeeringsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters network.VirtualNetworkPeering, syncRemoteAddressSpace network.SyncRemoteAddressSpace) (result network.VirtualNetworkPeeringsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result network.VirtualNetworkPeeringsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result network.VirtualNetworkPeering, err error) + List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkPeeringListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkPeeringListResultIterator, err error) +} + +var _ VirtualNetworkPeeringsClientAPI = (*network.VirtualNetworkPeeringsClient)(nil) + +// VirtualNetworkGatewaysClientAPI contains the set of methods on the VirtualNetworkGatewaysClient type. +type VirtualNetworkGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VirtualNetworkGateway) (result network.VirtualNetworkGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysDeleteFuture, err error) + DisconnectVirtualNetworkGatewayVpnConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request network.P2SVpnConnectionRequest) (result network.VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture, err error) + Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VpnClientParameters) (result network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) + GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VpnClientParameters) (result network.VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGateway, err error) + GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) + GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result network.VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) + GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) + GetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) + GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) + GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) + List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayListResultIterator, err error) + ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewayListConnectionsResultPage, err error) + ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewayListConnectionsResultIterator, err error) + Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result network.VirtualNetworkGatewaysResetFuture, err error) + ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) + SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams network.VpnClientIPsecParameters) (result network.VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) + StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *network.VpnPacketCaptureStartParameters) (result network.VirtualNetworkGatewaysStartPacketCaptureFuture, err error) + StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VpnPacketCaptureStopParameters) (result network.VirtualNetworkGatewaysStopPacketCaptureFuture, err error) + SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.String, err error) + UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.TagsObject) (result network.VirtualNetworkGatewaysUpdateTagsFuture, err error) + VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.VpnDeviceScriptParameters) (result network.String, err error) +} + +var _ VirtualNetworkGatewaysClientAPI = (*network.VirtualNetworkGatewaysClient)(nil) + +// VirtualNetworkGatewayConnectionsClientAPI contains the set of methods on the VirtualNetworkGatewayConnectionsClient type. +type VirtualNetworkGatewayConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.VirtualNetworkGatewayConnection) (result network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnection, err error) + GetIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnectionsGetIkeSasFuture, err error) + GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.ConnectionSharedKey, err error) + List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayConnectionListResultIterator, err error) + ResetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnectionsResetConnectionFuture, err error) + ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.ConnectionResetSharedKey) (result network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) + SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.ConnectionSharedKey) (result network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) + StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters *network.VpnPacketCaptureStartParameters) (result network.VirtualNetworkGatewayConnectionsStartPacketCaptureFuture, err error) + StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.VpnPacketCaptureStopParameters) (result network.VirtualNetworkGatewayConnectionsStopPacketCaptureFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.TagsObject) (result network.VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) +} + +var _ VirtualNetworkGatewayConnectionsClientAPI = (*network.VirtualNetworkGatewayConnectionsClient)(nil) + +// LocalNetworkGatewaysClientAPI contains the set of methods on the LocalNetworkGatewaysClient type. +type LocalNetworkGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters network.LocalNetworkGateway) (result network.LocalNetworkGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result network.LocalNetworkGatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result network.LocalNetworkGateway, err error) + List(ctx context.Context, resourceGroupName string) (result network.LocalNetworkGatewayListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.LocalNetworkGatewayListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters network.TagsObject) (result network.LocalNetworkGateway, err error) +} + +var _ LocalNetworkGatewaysClientAPI = (*network.LocalNetworkGatewaysClient)(nil) + +// VirtualNetworkGatewayNatRulesClientAPI contains the set of methods on the VirtualNetworkGatewayNatRulesClient type. +type VirtualNetworkGatewayNatRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters network.VirtualNetworkGatewayNatRule) (result network.VirtualNetworkGatewayNatRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (result network.VirtualNetworkGatewayNatRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (result network.VirtualNetworkGatewayNatRule, err error) + ListByVirtualNetworkGateway(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.ListVirtualNetworkGatewayNatRulesResultPage, err error) + ListByVirtualNetworkGatewayComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.ListVirtualNetworkGatewayNatRulesResultIterator, err error) +} + +var _ VirtualNetworkGatewayNatRulesClientAPI = (*network.VirtualNetworkGatewayNatRulesClient)(nil) + +// VirtualNetworkTapsClientAPI contains the set of methods on the VirtualNetworkTapsClient type. +type VirtualNetworkTapsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters network.VirtualNetworkTap) (result network.VirtualNetworkTapsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, tapName string) (result network.VirtualNetworkTapsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, tapName string) (result network.VirtualNetworkTap, err error) + ListAll(ctx context.Context) (result network.VirtualNetworkTapListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.VirtualNetworkTapListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkTapListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkTapListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters network.TagsObject) (result network.VirtualNetworkTap, err error) +} + +var _ VirtualNetworkTapsClientAPI = (*network.VirtualNetworkTapsClient)(nil) + +// VirtualRoutersClientAPI contains the set of methods on the VirtualRoutersClient type. +type VirtualRoutersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters network.VirtualRouter) (result network.VirtualRoutersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualRouterName string) (result network.VirtualRoutersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualRouterName string, expand string) (result network.VirtualRouter, err error) + List(ctx context.Context) (result network.VirtualRouterListResultPage, err error) + ListComplete(ctx context.Context) (result network.VirtualRouterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.VirtualRouterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.VirtualRouterListResultIterator, err error) +} + +var _ VirtualRoutersClientAPI = (*network.VirtualRoutersClient)(nil) + +// VirtualRouterPeeringsClientAPI contains the set of methods on the VirtualRouterPeeringsClient type. +type VirtualRouterPeeringsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters network.VirtualRouterPeering) (result network.VirtualRouterPeeringsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (result network.VirtualRouterPeeringsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (result network.VirtualRouterPeering, err error) + List(ctx context.Context, resourceGroupName string, virtualRouterName string) (result network.VirtualRouterPeeringListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualRouterName string) (result network.VirtualRouterPeeringListResultIterator, err error) +} + +var _ VirtualRouterPeeringsClientAPI = (*network.VirtualRouterPeeringsClient)(nil) + +// VirtualWansClientAPI contains the set of methods on the VirtualWansClient type. +type VirtualWansClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters network.VirtualWAN) (result network.VirtualWansCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualWANName string) (result network.VirtualWansDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualWANName string) (result network.VirtualWAN, err error) + List(ctx context.Context) (result network.ListVirtualWANsResultPage, err error) + ListComplete(ctx context.Context) (result network.ListVirtualWANsResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListVirtualWANsResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListVirtualWANsResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters network.TagsObject) (result network.VirtualWAN, err error) +} + +var _ VirtualWansClientAPI = (*network.VirtualWansClient)(nil) + +// VpnSitesClientAPI contains the set of methods on the VpnSitesClient type. +type VpnSitesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters network.VpnSite) (result network.VpnSitesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, vpnSiteName string) (result network.VpnSitesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, vpnSiteName string) (result network.VpnSite, err error) + List(ctx context.Context) (result network.ListVpnSitesResultPage, err error) + ListComplete(ctx context.Context) (result network.ListVpnSitesResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListVpnSitesResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListVpnSitesResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters network.TagsObject) (result network.VpnSite, err error) +} + +var _ VpnSitesClientAPI = (*network.VpnSitesClient)(nil) + +// VpnSiteLinksClientAPI contains the set of methods on the VpnSiteLinksClient type. +type VpnSiteLinksClientAPI interface { + Get(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteLinkName string) (result network.VpnSiteLink, err error) + ListByVpnSite(ctx context.Context, resourceGroupName string, vpnSiteName string) (result network.ListVpnSiteLinksResultPage, err error) + ListByVpnSiteComplete(ctx context.Context, resourceGroupName string, vpnSiteName string) (result network.ListVpnSiteLinksResultIterator, err error) +} + +var _ VpnSiteLinksClientAPI = (*network.VpnSiteLinksClient)(nil) + +// VpnSitesConfigurationClientAPI contains the set of methods on the VpnSitesConfigurationClient type. +type VpnSitesConfigurationClientAPI interface { + Download(ctx context.Context, resourceGroupName string, virtualWANName string, request network.GetVpnSitesConfigurationRequest) (result network.VpnSitesConfigurationDownloadFuture, err error) +} + +var _ VpnSitesConfigurationClientAPI = (*network.VpnSitesConfigurationClient)(nil) + +// VpnServerConfigurationsClientAPI contains the set of methods on the VpnServerConfigurationsClient type. +type VpnServerConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters network.VpnServerConfiguration) (result network.VpnServerConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result network.VpnServerConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result network.VpnServerConfiguration, err error) + List(ctx context.Context) (result network.ListVpnServerConfigurationsResultPage, err error) + ListComplete(ctx context.Context) (result network.ListVpnServerConfigurationsResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListVpnServerConfigurationsResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListVpnServerConfigurationsResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters network.TagsObject) (result network.VpnServerConfiguration, err error) +} + +var _ VpnServerConfigurationsClientAPI = (*network.VpnServerConfigurationsClient)(nil) + +// ConfigurationPolicyGroupsClientAPI contains the set of methods on the ConfigurationPolicyGroupsClient type. +type ConfigurationPolicyGroupsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string, vpnServerConfigurationPolicyGroupParameters network.VpnServerConfigurationPolicyGroup) (result network.ConfigurationPolicyGroupsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (result network.ConfigurationPolicyGroupsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, configurationPolicyGroupName string) (result network.VpnServerConfigurationPolicyGroup, err error) + ListByVpnServerConfiguration(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result network.ListVpnServerConfigurationPolicyGroupsResultPage, err error) + ListByVpnServerConfigurationComplete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result network.ListVpnServerConfigurationPolicyGroupsResultIterator, err error) +} + +var _ ConfigurationPolicyGroupsClientAPI = (*network.ConfigurationPolicyGroupsClient)(nil) + +// VirtualHubsClientAPI contains the set of methods on the VirtualHubsClient type. +type VirtualHubsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters network.VirtualHub) (result network.VirtualHubsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.VirtualHubsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.VirtualHub, err error) + GetEffectiveVirtualHubRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, effectiveRoutesParameters *network.EffectiveRoutesParameters) (result network.VirtualHubsGetEffectiveVirtualHubRoutesFuture, err error) + List(ctx context.Context) (result network.ListVirtualHubsResultPage, err error) + ListComplete(ctx context.Context) (result network.ListVirtualHubsResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListVirtualHubsResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListVirtualHubsResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters network.TagsObject) (result network.VirtualHub, err error) +} + +var _ VirtualHubsClientAPI = (*network.VirtualHubsClient)(nil) + +// HubVirtualNetworkConnectionsClientAPI contains the set of methods on the HubVirtualNetworkConnectionsClient type. +type HubVirtualNetworkConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, hubVirtualNetworkConnectionParameters network.HubVirtualNetworkConnection) (result network.HubVirtualNetworkConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result network.HubVirtualNetworkConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result network.HubVirtualNetworkConnection, err error) + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListHubVirtualNetworkConnectionsResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListHubVirtualNetworkConnectionsResultIterator, err error) +} + +var _ HubVirtualNetworkConnectionsClientAPI = (*network.HubVirtualNetworkConnectionsClient)(nil) + +// VpnGatewaysClientAPI contains the set of methods on the VpnGatewaysClient type. +type VpnGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters network.VpnGateway) (result network.VpnGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, gatewayName string) (result network.VpnGatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, gatewayName string) (result network.VpnGateway, err error) + List(ctx context.Context) (result network.ListVpnGatewaysResultPage, err error) + ListComplete(ctx context.Context) (result network.ListVpnGatewaysResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListVpnGatewaysResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListVpnGatewaysResultIterator, err error) + Reset(ctx context.Context, resourceGroupName string, gatewayName string) (result network.VpnGatewaysResetFuture, err error) + StartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, parameters *network.VpnGatewayPacketCaptureStartParameters) (result network.VpnGatewaysStartPacketCaptureFuture, err error) + StopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, parameters *network.VpnGatewayPacketCaptureStopParameters) (result network.VpnGatewaysStopPacketCaptureFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters network.TagsObject) (result network.VpnGatewaysUpdateTagsFuture, err error) +} + +var _ VpnGatewaysClientAPI = (*network.VpnGatewaysClient)(nil) + +// VpnLinkConnectionsClientAPI contains the set of methods on the VpnLinkConnectionsClient type. +type VpnLinkConnectionsClientAPI interface { + GetIkeSas(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result network.VpnLinkConnectionsGetIkeSasFuture, err error) + ListByVpnConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result network.ListVpnSiteLinkConnectionsResultPage, err error) + ListByVpnConnectionComplete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result network.ListVpnSiteLinkConnectionsResultIterator, err error) + ResetConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result network.VpnLinkConnectionsResetConnectionFuture, err error) +} + +var _ VpnLinkConnectionsClientAPI = (*network.VpnLinkConnectionsClient)(nil) + +// VpnConnectionsClientAPI contains the set of methods on the VpnConnectionsClient type. +type VpnConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters network.VpnConnection) (result network.VpnConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result network.VpnConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result network.VpnConnection, err error) + ListByVpnGateway(ctx context.Context, resourceGroupName string, gatewayName string) (result network.ListVpnConnectionsResultPage, err error) + ListByVpnGatewayComplete(ctx context.Context, resourceGroupName string, gatewayName string) (result network.ListVpnConnectionsResultIterator, err error) + StartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *network.VpnConnectionPacketCaptureStartParameters) (result network.VpnConnectionsStartPacketCaptureFuture, err error) + StopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *network.VpnConnectionPacketCaptureStopParameters) (result network.VpnConnectionsStopPacketCaptureFuture, err error) +} + +var _ VpnConnectionsClientAPI = (*network.VpnConnectionsClient)(nil) + +// VpnSiteLinkConnectionsClientAPI contains the set of methods on the VpnSiteLinkConnectionsClient type. +type VpnSiteLinkConnectionsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result network.VpnSiteLinkConnection, err error) +} + +var _ VpnSiteLinkConnectionsClientAPI = (*network.VpnSiteLinkConnectionsClient)(nil) + +// NatRulesClientAPI contains the set of methods on the NatRulesClient type. +type NatRulesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string, natRuleParameters network.VpnGatewayNatRule) (result network.NatRulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (result network.NatRulesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, gatewayName string, natRuleName string) (result network.VpnGatewayNatRule, err error) + ListByVpnGateway(ctx context.Context, resourceGroupName string, gatewayName string) (result network.ListVpnGatewayNatRulesResultPage, err error) + ListByVpnGatewayComplete(ctx context.Context, resourceGroupName string, gatewayName string) (result network.ListVpnGatewayNatRulesResultIterator, err error) +} + +var _ NatRulesClientAPI = (*network.NatRulesClient)(nil) + +// P2sVpnGatewaysClientAPI contains the set of methods on the P2sVpnGatewaysClient type. +type P2sVpnGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters network.P2SVpnGateway) (result network.P2sVpnGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, gatewayName string) (result network.P2sVpnGatewaysDeleteFuture, err error) + DisconnectP2sVpnConnections(ctx context.Context, resourceGroupName string, p2sVpnGatewayName string, request network.P2SVpnConnectionRequest) (result network.P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture, err error) + GenerateVpnProfile(ctx context.Context, resourceGroupName string, gatewayName string, parameters network.P2SVpnProfileParameters) (result network.P2sVpnGatewaysGenerateVpnProfileFuture, err error) + Get(ctx context.Context, resourceGroupName string, gatewayName string) (result network.P2SVpnGateway, err error) + GetP2sVpnConnectionHealth(ctx context.Context, resourceGroupName string, gatewayName string) (result network.P2sVpnGatewaysGetP2sVpnConnectionHealthFuture, err error) + GetP2sVpnConnectionHealthDetailed(ctx context.Context, resourceGroupName string, gatewayName string, request network.P2SVpnConnectionHealthRequest) (result network.P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture, err error) + List(ctx context.Context) (result network.ListP2SVpnGatewaysResultPage, err error) + ListComplete(ctx context.Context) (result network.ListP2SVpnGatewaysResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ListP2SVpnGatewaysResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.ListP2SVpnGatewaysResultIterator, err error) + Reset(ctx context.Context, resourceGroupName string, gatewayName string) (result network.P2SVpnGatewaysResetFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters network.TagsObject) (result network.P2sVpnGatewaysUpdateTagsFuture, err error) +} + +var _ P2sVpnGatewaysClientAPI = (*network.P2sVpnGatewaysClient)(nil) + +// VpnServerConfigurationsAssociatedWithVirtualWanClientAPI contains the set of methods on the VpnServerConfigurationsAssociatedWithVirtualWanClient type. +type VpnServerConfigurationsAssociatedWithVirtualWanClientAPI interface { + List(ctx context.Context, resourceGroupName string, virtualWANName string) (result network.VpnServerConfigurationsAssociatedWithVirtualWanListFuture, err error) +} + +var _ VpnServerConfigurationsAssociatedWithVirtualWanClientAPI = (*network.VpnServerConfigurationsAssociatedWithVirtualWanClient)(nil) + +// VirtualHubRouteTableV2sClientAPI contains the set of methods on the VirtualHubRouteTableV2sClient type. +type VirtualHubRouteTableV2sClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters network.VirtualHubRouteTableV2) (result network.VirtualHubRouteTableV2sCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result network.VirtualHubRouteTableV2sDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result network.VirtualHubRouteTableV2, err error) + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubRouteTableV2sResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubRouteTableV2sResultIterator, err error) +} + +var _ VirtualHubRouteTableV2sClientAPI = (*network.VirtualHubRouteTableV2sClient)(nil) + +// ExpressRouteGatewaysClientAPI contains the set of methods on the ExpressRouteGatewaysClient type. +type ExpressRouteGatewaysClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, putExpressRouteGatewayParameters network.ExpressRouteGateway) (result network.ExpressRouteGatewaysCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result network.ExpressRouteGatewaysDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result network.ExpressRouteGateway, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.ExpressRouteGatewayList, err error) + ListBySubscription(ctx context.Context) (result network.ExpressRouteGatewayList, err error) + UpdateTags(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, expressRouteGatewayParameters network.TagsObject) (result network.ExpressRouteGatewaysUpdateTagsFuture, err error) +} + +var _ ExpressRouteGatewaysClientAPI = (*network.ExpressRouteGatewaysClient)(nil) + +// ExpressRouteConnectionsClientAPI contains the set of methods on the ExpressRouteConnectionsClient type. +type ExpressRouteConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string, putExpressRouteConnectionParameters network.ExpressRouteConnection) (result network.ExpressRouteConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (result network.ExpressRouteConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, expressRouteGatewayName string, connectionName string) (result network.ExpressRouteConnection, err error) + List(ctx context.Context, resourceGroupName string, expressRouteGatewayName string) (result network.ExpressRouteConnectionList, err error) +} + +var _ ExpressRouteConnectionsClientAPI = (*network.ExpressRouteConnectionsClient)(nil) + +// VirtualHubBgpConnectionClientAPI contains the set of methods on the VirtualHubBgpConnectionClient type. +type VirtualHubBgpConnectionClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters network.BgpConnection) (result network.VirtualHubBgpConnectionCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result network.VirtualHubBgpConnectionDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result network.BgpConnection, err error) +} + +var _ VirtualHubBgpConnectionClientAPI = (*network.VirtualHubBgpConnectionClient)(nil) + +// VirtualHubBgpConnectionsClientAPI contains the set of methods on the VirtualHubBgpConnectionsClient type. +type VirtualHubBgpConnectionsClientAPI interface { + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubBgpConnectionResultsPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubBgpConnectionResultsIterator, err error) + ListAdvertisedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (result network.VirtualHubBgpConnectionsListAdvertisedRoutesFuture, err error) + ListLearnedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (result network.VirtualHubBgpConnectionsListLearnedRoutesFuture, err error) +} + +var _ VirtualHubBgpConnectionsClientAPI = (*network.VirtualHubBgpConnectionsClient)(nil) + +// VirtualHubIPConfigurationClientAPI contains the set of methods on the VirtualHubIPConfigurationClient type. +type VirtualHubIPConfigurationClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string, parameters network.HubIPConfiguration) (result network.VirtualHubIPConfigurationCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (result network.VirtualHubIPConfigurationDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (result network.HubIPConfiguration, err error) + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubIPConfigurationResultsPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListVirtualHubIPConfigurationResultsIterator, err error) +} + +var _ VirtualHubIPConfigurationClientAPI = (*network.VirtualHubIPConfigurationClient)(nil) + +// HubRouteTablesClientAPI contains the set of methods on the HubRouteTablesClient type. +type HubRouteTablesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, routeTableParameters network.HubRouteTable) (result network.HubRouteTablesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result network.HubRouteTablesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result network.HubRouteTable, err error) + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListHubRouteTablesResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListHubRouteTablesResultIterator, err error) +} + +var _ HubRouteTablesClientAPI = (*network.HubRouteTablesClient)(nil) + +// RoutingIntentClientAPI contains the set of methods on the RoutingIntentClient type. +type RoutingIntentClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters network.RoutingIntent) (result network.RoutingIntentCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (result network.RoutingIntentDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (result network.RoutingIntent, err error) + List(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListRoutingIntentResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result network.ListRoutingIntentResultIterator, err error) +} + +var _ RoutingIntentClientAPI = (*network.RoutingIntentClient)(nil) + +// WebApplicationFirewallPoliciesClientAPI contains the set of methods on the WebApplicationFirewallPoliciesClient type. +type WebApplicationFirewallPoliciesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters network.WebApplicationFirewallPolicy) (result network.WebApplicationFirewallPolicy, err error) + Delete(ctx context.Context, resourceGroupName string, policyName string) (result network.WebApplicationFirewallPoliciesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, policyName string) (result network.WebApplicationFirewallPolicy, err error) + List(ctx context.Context, resourceGroupName string) (result network.WebApplicationFirewallPolicyListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result network.WebApplicationFirewallPolicyListResultIterator, err error) + ListAll(ctx context.Context) (result network.WebApplicationFirewallPolicyListResultPage, err error) + ListAllComplete(ctx context.Context) (result network.WebApplicationFirewallPolicyListResultIterator, err error) +} + +var _ WebApplicationFirewallPoliciesClientAPI = (*network.WebApplicationFirewallPoliciesClient)(nil) diff --git a/services/network/mgmt/2021-08-01/network/operations.go b/services/network/mgmt/2021-08-01/network/operations.go new file mode 100644 index 000000000000..675cac56998a --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/operations.go @@ -0,0 +1,140 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the network Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all of the available Network Rest API operations. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Network/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/p2svpngateways.go b/services/network/mgmt/2021-08-01/network/p2svpngateways.go new file mode 100644 index 000000000000..8c8e673466a1 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/p2svpngateways.go @@ -0,0 +1,985 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// P2sVpnGatewaysClient is the network Client +type P2sVpnGatewaysClient struct { + BaseClient +} + +// NewP2sVpnGatewaysClient creates an instance of the P2sVpnGatewaysClient client. +func NewP2sVpnGatewaysClient(subscriptionID string) P2sVpnGatewaysClient { + return NewP2sVpnGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewP2sVpnGatewaysClientWithBaseURI creates an instance of the P2sVpnGatewaysClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewP2sVpnGatewaysClientWithBaseURI(baseURI string, subscriptionID string) P2sVpnGatewaysClient { + return P2sVpnGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +// gatewayName - the name of the gateway. +// p2SVpnGatewayParameters - parameters supplied to create or Update a virtual wan p2s vpn gateway. +func (client P2sVpnGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters P2SVpnGateway) (result P2sVpnGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, gatewayName, p2SVpnGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client P2sVpnGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters P2SVpnGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + p2SVpnGatewayParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", pathParameters), + autorest.WithJSON(p2SVpnGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) CreateOrUpdateSender(req *http.Request) (future P2sVpnGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result P2SVpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a virtual wan p2s vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +// gatewayName - the name of the gateway. +func (client P2sVpnGatewaysClient) Delete(ctx context.Context, resourceGroupName string, gatewayName string) (result P2sVpnGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client P2sVpnGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) DeleteSender(req *http.Request) (future P2sVpnGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisconnectP2sVpnConnections disconnect P2S vpn connections of the virtual wan P2SVpnGateway in the specified +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// p2sVpnGatewayName - the name of the P2S Vpn Gateway. +// request - the parameters are supplied to disconnect p2s vpn connections. +func (client P2sVpnGatewaysClient) DisconnectP2sVpnConnections(ctx context.Context, resourceGroupName string, p2sVpnGatewayName string, request P2SVpnConnectionRequest) (result P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.DisconnectP2sVpnConnections") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisconnectP2sVpnConnectionsPreparer(ctx, resourceGroupName, p2sVpnGatewayName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "DisconnectP2sVpnConnections", nil, "Failure preparing request") + return + } + + result, err = client.DisconnectP2sVpnConnectionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "DisconnectP2sVpnConnections", result.Response(), "Failure sending request") + return + } + + return +} + +// DisconnectP2sVpnConnectionsPreparer prepares the DisconnectP2sVpnConnections request. +func (client P2sVpnGatewaysClient) DisconnectP2sVpnConnectionsPreparer(ctx context.Context, resourceGroupName string, p2sVpnGatewayName string, request P2SVpnConnectionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "p2sVpnGatewayName": autorest.Encode("path", p2sVpnGatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/p2svpnGateways/{p2sVpnGatewayName}/disconnectP2sVpnConnections", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisconnectP2sVpnConnectionsSender sends the DisconnectP2sVpnConnections request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) DisconnectP2sVpnConnectionsSender(req *http.Request) (future P2sVpnGatewaysDisconnectP2sVpnConnectionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DisconnectP2sVpnConnectionsResponder handles the response to the DisconnectP2sVpnConnections request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) DisconnectP2sVpnConnectionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateVpnProfile generates VPN profile for P2S client of the P2SVpnGateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the P2SVpnGateway. +// parameters - parameters supplied to the generate P2SVpnGateway VPN client package operation. +func (client P2sVpnGatewaysClient) GenerateVpnProfile(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVpnProfileParameters) (result P2sVpnGatewaysGenerateVpnProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.GenerateVpnProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GenerateVpnProfilePreparer(ctx, resourceGroupName, gatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GenerateVpnProfile", nil, "Failure preparing request") + return + } + + result, err = client.GenerateVpnProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GenerateVpnProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateVpnProfilePreparer prepares the GenerateVpnProfile request. +func (client P2sVpnGatewaysClient) GenerateVpnProfilePreparer(ctx context.Context, resourceGroupName string, gatewayName string, parameters P2SVpnProfileParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/p2svpnGateways/{gatewayName}/generatevpnprofile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future P2sVpnGatewaysGenerateVpnProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GenerateVpnProfileResponder handles the response to the GenerateVpnProfile request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) GenerateVpnProfileResponder(resp *http.Response) (result VpnProfileResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get retrieves the details of a virtual wan p2s vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +// gatewayName - the name of the gateway. +func (client P2sVpnGatewaysClient) Get(ctx context.Context, resourceGroupName string, gatewayName string) (result P2SVpnGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client P2sVpnGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) GetResponder(resp *http.Response) (result P2SVpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetP2sVpnConnectionHealth gets the connection health of P2S clients of the virtual wan P2SVpnGateway in the +// specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the P2SVpnGateway. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealth(ctx context.Context, resourceGroupName string, gatewayName string) (result P2sVpnGatewaysGetP2sVpnConnectionHealthFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.GetP2sVpnConnectionHealth") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetP2sVpnConnectionHealthPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GetP2sVpnConnectionHealth", nil, "Failure preparing request") + return + } + + result, err = client.GetP2sVpnConnectionHealthSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GetP2sVpnConnectionHealth", result.Response(), "Failure sending request") + return + } + + return +} + +// GetP2sVpnConnectionHealthPreparer prepares the GetP2sVpnConnectionHealth request. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealth", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetP2sVpnConnectionHealthSender sends the GetP2sVpnConnectionHealth request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthSender(req *http.Request) (future P2sVpnGatewaysGetP2sVpnConnectionHealthFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetP2sVpnConnectionHealthResponder handles the response to the GetP2sVpnConnectionHealth request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthResponder(resp *http.Response) (result P2SVpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetP2sVpnConnectionHealthDetailed gets the sas url to get the connection health detail of P2S clients of the virtual +// wan P2SVpnGateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the P2SVpnGateway. +// request - request parameters supplied to get p2s vpn connections detailed health. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthDetailed(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVpnConnectionHealthRequest) (result P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.GetP2sVpnConnectionHealthDetailed") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetP2sVpnConnectionHealthDetailedPreparer(ctx, resourceGroupName, gatewayName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GetP2sVpnConnectionHealthDetailed", nil, "Failure preparing request") + return + } + + result, err = client.GetP2sVpnConnectionHealthDetailedSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "GetP2sVpnConnectionHealthDetailed", result.Response(), "Failure sending request") + return + } + + return +} + +// GetP2sVpnConnectionHealthDetailedPreparer prepares the GetP2sVpnConnectionHealthDetailed request. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthDetailedPreparer(ctx context.Context, resourceGroupName string, gatewayName string, request P2SVpnConnectionHealthRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/p2svpnGateways/{gatewayName}/getP2sVpnConnectionHealthDetailed", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetP2sVpnConnectionHealthDetailedSender sends the GetP2sVpnConnectionHealthDetailed request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthDetailedSender(req *http.Request) (future P2sVpnGatewaysGetP2sVpnConnectionHealthDetailedFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetP2sVpnConnectionHealthDetailedResponder handles the response to the GetP2sVpnConnectionHealthDetailed request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) GetP2sVpnConnectionHealthDetailedResponder(resp *http.Response) (result P2SVpnConnectionHealth, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the P2SVpnGateways in a subscription. +func (client P2sVpnGatewaysClient) List(ctx context.Context) (result ListP2SVpnGatewaysResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.List") + defer func() { + sc := -1 + if result.lpvgr.Response.Response != nil { + sc = result.lpvgr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lpvgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.lpvgr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.lpvgr.hasNextLink() && result.lpvgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client P2sVpnGatewaysClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/p2svpnGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) ListResponder(resp *http.Response) (result ListP2SVpnGatewaysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client P2sVpnGatewaysClient) listNextResults(ctx context.Context, lastResults ListP2SVpnGatewaysResult) (result ListP2SVpnGatewaysResult, err error) { + req, err := lastResults.listP2SVpnGatewaysResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client P2sVpnGatewaysClient) ListComplete(ctx context.Context) (result ListP2SVpnGatewaysResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the P2SVpnGateways in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +func (client P2sVpnGatewaysClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListP2SVpnGatewaysResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lpvgr.Response.Response != nil { + sc = result.lpvgr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lpvgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lpvgr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lpvgr.hasNextLink() && result.lpvgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client P2sVpnGatewaysClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) ListByResourceGroupResponder(resp *http.Response) (result ListP2SVpnGatewaysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client P2sVpnGatewaysClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListP2SVpnGatewaysResult) (result ListP2SVpnGatewaysResult, err error) { + req, err := lastResults.listP2SVpnGatewaysResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client P2sVpnGatewaysClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListP2SVpnGatewaysResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Reset resets the primary of the p2s vpn gateway in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +// gatewayName - the name of the gateway. +func (client P2sVpnGatewaysClient) Reset(ctx context.Context, resourceGroupName string, gatewayName string) (result P2SVpnGatewaysResetFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.Reset") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Reset", nil, "Failure preparing request") + return + } + + result, err = client.ResetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "Reset", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetPreparer prepares the Reset request. +func (client P2sVpnGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetSender sends the Reset request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) ResetSender(req *http.Request) (future P2SVpnGatewaysResetFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetResponder handles the response to the Reset request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) ResetResponder(resp *http.Response) (result P2SVpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates virtual wan p2s vpn gateway tags. +// Parameters: +// resourceGroupName - the resource group name of the P2SVpnGateway. +// gatewayName - the name of the gateway. +// p2SVpnGatewayParameters - parameters supplied to update a virtual wan p2s vpn gateway tags. +func (client P2sVpnGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters TagsObject) (result P2sVpnGatewaysUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/P2sVpnGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, gatewayName, p2SVpnGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.P2sVpnGatewaysClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client P2sVpnGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, gatewayName string, p2SVpnGatewayParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/p2svpnGateways/{gatewayName}", pathParameters), + autorest.WithJSON(p2SVpnGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client P2sVpnGatewaysClient) UpdateTagsSender(req *http.Request) (future P2sVpnGatewaysUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client P2sVpnGatewaysClient) UpdateTagsResponder(resp *http.Response) (result P2SVpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/packetcaptures.go b/services/network/mgmt/2021-08-01/network/packetcaptures.go new file mode 100644 index 000000000000..3e74bd4af098 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/packetcaptures.go @@ -0,0 +1,532 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PacketCapturesClient is the network Client +type PacketCapturesClient struct { + BaseClient +} + +// 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 using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient { + return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create and start a packet capture on the specified VM. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. +// parameters - parameters that define the create packet capture operation. +func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (result PacketCapturesCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.BytesToCapturePerPacket", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.BytesToCapturePerPacket", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.PacketCaptureParameters.BytesToCapturePerPacket", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.PacketCaptureParameters.TotalBytesPerSession", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.TotalBytesPerSession", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.PacketCaptureParameters.TotalBytesPerSession", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.PacketCaptureParameters.TimeLimitInSeconds", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.TimeLimitInSeconds", Name: validation.InclusiveMaximum, Rule: int64(18000), Chain: nil}, + {Target: "parameters.PacketCaptureParameters.TimeLimitInSeconds", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.PacketCapturesClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (*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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + 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{}).WithContext(ctx)) +} + +// 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) (future PacketCapturesCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result PacketCaptureResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. +func (client PacketCapturesClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PacketCapturesClient) DeletePreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// 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) (future PacketCapturesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a packet capture session by name. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. +func (client PacketCapturesClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PacketCapturesClient) GetPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + 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. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the Network Watcher resource. +// packetCaptureName - the name given to the packet capture session. +func (client PacketCapturesClient) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesGetStatusFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.GetStatus") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetStatusPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", nil, "Failure preparing request") + return + } + + result, err = client.GetStatusSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", result.Response(), "Failure sending request") + return + } + + return +} + +// GetStatusPreparer prepares the GetStatus request. +func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// 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) (future PacketCapturesGetStatusFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetStatusResponder handles the response to the GetStatus request. The method always +// closes the http.Response Body. +func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result PacketCaptureQueryStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all packet capture sessions within the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the Network Watcher resource. +func (client PacketCapturesClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PacketCapturesClient) ListPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Stop stops a specified packet capture session. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// packetCaptureName - the name of the packet capture session. +func (client PacketCapturesClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PacketCapturesClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client PacketCapturesClient) StopPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// 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) (future PacketCapturesStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// 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, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/network/mgmt/2021-08-01/network/peerexpressroutecircuitconnections.go b/services/network/mgmt/2021-08-01/network/peerexpressroutecircuitconnections.go new file mode 100644 index 000000000000..09c06f561610 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/peerexpressroutecircuitconnections.go @@ -0,0 +1,233 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PeerExpressRouteCircuitConnectionsClient is the network Client +type PeerExpressRouteCircuitConnectionsClient struct { + BaseClient +} + +// NewPeerExpressRouteCircuitConnectionsClient creates an instance of the PeerExpressRouteCircuitConnectionsClient +// client. +func NewPeerExpressRouteCircuitConnectionsClient(subscriptionID string) PeerExpressRouteCircuitConnectionsClient { + return NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPeerExpressRouteCircuitConnectionsClientWithBaseURI creates an instance of the +// PeerExpressRouteCircuitConnectionsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewPeerExpressRouteCircuitConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PeerExpressRouteCircuitConnectionsClient { + return PeerExpressRouteCircuitConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified Peer Express Route Circuit Connection from the specified express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the express route circuit. +// peeringName - the name of the peering. +// connectionName - the name of the peer express route circuit connection. +func (client PeerExpressRouteCircuitConnectionsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (result PeerExpressRouteCircuitConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PeerExpressRouteCircuitConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "connectionName": autorest.Encode("path", connectionName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PeerExpressRouteCircuitConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PeerExpressRouteCircuitConnectionsClient) GetResponder(resp *http.Response) (result PeerExpressRouteCircuitConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all global reach peer connections associated with a private peering in an express route circuit. +// Parameters: +// resourceGroupName - the name of the resource group. +// circuitName - the name of the circuit. +// peeringName - the name of the peering. +func (client PeerExpressRouteCircuitConnectionsClient) List(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result PeerExpressRouteCircuitConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionsClient.List") + defer func() { + sc := -1 + if result.percclr.Response.Response != nil { + sc = result.percclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, circuitName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.percclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.percclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.percclr.hasNextLink() && result.percclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PeerExpressRouteCircuitConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "circuitName": autorest.Encode("path", circuitName), + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/peerConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PeerExpressRouteCircuitConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PeerExpressRouteCircuitConnectionsClient) ListResponder(resp *http.Response) (result PeerExpressRouteCircuitConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PeerExpressRouteCircuitConnectionsClient) listNextResults(ctx context.Context, lastResults PeerExpressRouteCircuitConnectionListResult) (result PeerExpressRouteCircuitConnectionListResult, err error) { + req, err := lastResults.peerExpressRouteCircuitConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PeerExpressRouteCircuitConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PeerExpressRouteCircuitConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result PeerExpressRouteCircuitConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PeerExpressRouteCircuitConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, circuitName, peeringName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/privatednszonegroups.go b/services/network/mgmt/2021-08-01/network/privatednszonegroups.go new file mode 100644 index 000000000000..b0baed9f4b84 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/privatednszonegroups.go @@ -0,0 +1,393 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateDNSZoneGroupsClient is the network Client +type PrivateDNSZoneGroupsClient struct { + BaseClient +} + +// NewPrivateDNSZoneGroupsClient creates an instance of the PrivateDNSZoneGroupsClient client. +func NewPrivateDNSZoneGroupsClient(subscriptionID string) PrivateDNSZoneGroupsClient { + return NewPrivateDNSZoneGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateDNSZoneGroupsClientWithBaseURI creates an instance of the PrivateDNSZoneGroupsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateDNSZoneGroupsClientWithBaseURI(baseURI string, subscriptionID string) PrivateDNSZoneGroupsClient { + return PrivateDNSZoneGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a private dns zone group in the specified private endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +// privateDNSZoneGroupName - the name of the private dns zone group. +// parameters - parameters supplied to the create or update private dns zone group operation. +func (client PrivateDNSZoneGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup) (result PrivateDNSZoneGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateDNSZoneGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string, parameters PrivateDNSZoneGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateDnsZoneGroupName": autorest.Encode("path", privateDNSZoneGroupName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateDNSZoneGroupsClient) CreateOrUpdateSender(req *http.Request) (future PrivateDNSZoneGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateDNSZoneGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateDNSZoneGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private dns zone group. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +// privateDNSZoneGroupName - the name of the private dns zone group. +func (client PrivateDNSZoneGroupsClient) Delete(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (result PrivateDNSZoneGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateDNSZoneGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateDnsZoneGroupName": autorest.Encode("path", privateDNSZoneGroupName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateDNSZoneGroupsClient) DeleteSender(req *http.Request) (future PrivateDNSZoneGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateDNSZoneGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the private dns zone group resource by specified private dns zone group name. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +// privateDNSZoneGroupName - the name of the private dns zone group. +func (client PrivateDNSZoneGroupsClient) Get(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (result PrivateDNSZoneGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, privateEndpointName, privateDNSZoneGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateDNSZoneGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, privateEndpointName string, privateDNSZoneGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateDnsZoneGroupName": autorest.Encode("path", privateDNSZoneGroupName), + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups/{privateDnsZoneGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateDNSZoneGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateDNSZoneGroupsClient) GetResponder(resp *http.Response) (result PrivateDNSZoneGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all private dns zone groups in a private endpoint. +// Parameters: +// privateEndpointName - the name of the private endpoint. +// resourceGroupName - the name of the resource group. +func (client PrivateDNSZoneGroupsClient) List(ctx context.Context, privateEndpointName string, resourceGroupName string) (result PrivateDNSZoneGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupsClient.List") + defer func() { + sc := -1 + if result.pdzglr.Response.Response != nil { + sc = result.pdzglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, privateEndpointName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pdzglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "List", resp, "Failure sending request") + return + } + + result.pdzglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.pdzglr.hasNextLink() && result.pdzglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateDNSZoneGroupsClient) ListPreparer(ctx context.Context, privateEndpointName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}/privateDnsZoneGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateDNSZoneGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateDNSZoneGroupsClient) ListResponder(resp *http.Response) (result PrivateDNSZoneGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateDNSZoneGroupsClient) listNextResults(ctx context.Context, lastResults PrivateDNSZoneGroupListResult) (result PrivateDNSZoneGroupListResult, err error) { + req, err := lastResults.privateDNSZoneGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateDNSZoneGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateDNSZoneGroupsClient) ListComplete(ctx context.Context, privateEndpointName string, resourceGroupName string) (result PrivateDNSZoneGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateDNSZoneGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, privateEndpointName, resourceGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/privateendpoints.go b/services/network/mgmt/2021-08-01/network/privateendpoints.go new file mode 100644 index 000000000000..d42061efab6f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/privateendpoints.go @@ -0,0 +1,502 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointsClient is the network Client +type PrivateEndpointsClient struct { + BaseClient +} + +// NewPrivateEndpointsClient creates an instance of the PrivateEndpointsClient client. +func NewPrivateEndpointsClient(subscriptionID string) PrivateEndpointsClient { + return NewPrivateEndpointsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointsClientWithBaseURI creates an instance of the PrivateEndpointsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateEndpointsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointsClient { + return PrivateEndpointsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates an private endpoint in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +// parameters - parameters supplied to the create or update private endpoint operation. +func (client PrivateEndpointsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint) (result PrivateEndpointsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, privateEndpointName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, privateEndpointName string, parameters PrivateEndpoint) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +func (client PrivateEndpointsClient) Delete(ctx context.Context, resourceGroupName string, privateEndpointName string) (result PrivateEndpointsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, privateEndpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointsClient) DeletePreparer(ctx context.Context, resourceGroupName string, privateEndpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) DeleteSender(req *http.Request) (future PrivateEndpointsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private endpoint by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// privateEndpointName - the name of the private endpoint. +// expand - expands referenced resources. +func (client PrivateEndpointsClient) Get(ctx context.Context, resourceGroupName string, privateEndpointName string, expand string) (result PrivateEndpoint, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, privateEndpointName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointsClient) GetPreparer(ctx context.Context, resourceGroupName string, privateEndpointName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointName": autorest.Encode("path", privateEndpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) GetResponder(resp *http.Response) (result PrivateEndpoint, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all private endpoints in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client PrivateEndpointsClient) List(ctx context.Context, resourceGroupName string) (result PrivateEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.List") + defer func() { + sc := -1 + if result.pelr.Response.Response != nil { + sc = result.pelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "List", resp, "Failure sending request") + return + } + + result.pelr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "List", resp, "Failure responding to request") + return + } + if result.pelr.hasNextLink() && result.pelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) ListResponder(resp *http.Response) (result PrivateEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateEndpointsClient) listNextResults(ctx context.Context, lastResults PrivateEndpointListResult) (result PrivateEndpointListResult, err error) { + req, err := lastResults.privateEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointsClient) ListComplete(ctx context.Context, resourceGroupName string) (result PrivateEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListBySubscription gets all private endpoints in a subscription. +func (client PrivateEndpointsClient) ListBySubscription(ctx context.Context) (result PrivateEndpointListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.ListBySubscription") + defer func() { + sc := -1 + if result.pelr.Response.Response != nil { + sc = result.pelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.pelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.pelr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.pelr.hasNextLink() && result.pelr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PrivateEndpointsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client PrivateEndpointsClient) ListBySubscriptionResponder(resp *http.Response) (result PrivateEndpointListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client PrivateEndpointsClient) listBySubscriptionNextResults(ctx context.Context, lastResults PrivateEndpointListResult) (result PrivateEndpointListResult, err error) { + req, err := lastResults.privateEndpointListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateEndpointsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateEndpointsClient) ListBySubscriptionComplete(ctx context.Context) (result PrivateEndpointListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/privatelinkservices.go b/services/network/mgmt/2021-08-01/network/privatelinkservices.go new file mode 100644 index 000000000000..a7610b5b9eb3 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/privatelinkservices.go @@ -0,0 +1,1266 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkServicesClient is the network Client +type PrivateLinkServicesClient struct { + BaseClient +} + +// NewPrivateLinkServicesClient creates an instance of the PrivateLinkServicesClient client. +func NewPrivateLinkServicesClient(subscriptionID string) PrivateLinkServicesClient { + return NewPrivateLinkServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkServicesClientWithBaseURI creates an instance of the PrivateLinkServicesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkServicesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkServicesClient { + return PrivateLinkServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckPrivateLinkServiceVisibility checks whether the subscription is visible to private link service. +// Parameters: +// location - the location of the domain name. +// parameters - the request body of CheckPrivateLinkService API call. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibility(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest) (result PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CheckPrivateLinkServiceVisibility") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckPrivateLinkServiceVisibilityPreparer(ctx, location, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibility", nil, "Failure preparing request") + return + } + + result, err = client.CheckPrivateLinkServiceVisibilitySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibility", result.Response(), "Failure sending request") + return + } + + return +} + +// CheckPrivateLinkServiceVisibilityPreparer prepares the CheckPrivateLinkServiceVisibility request. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityPreparer(ctx context.Context, location string, parameters CheckPrivateLinkServiceVisibilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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}/providers/Microsoft.Network/locations/{location}/checkPrivateLinkServiceVisibility", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckPrivateLinkServiceVisibilitySender sends the CheckPrivateLinkServiceVisibility request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilitySender(req *http.Request) (future PrivateLinkServicesCheckPrivateLinkServiceVisibilityFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CheckPrivateLinkServiceVisibilityResponder handles the response to the CheckPrivateLinkServiceVisibility request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityResponder(resp *http.Response) (result PrivateLinkServiceVisibility, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CheckPrivateLinkServiceVisibilityByResourceGroup checks whether the subscription is visible to private link service +// in the specified resource group. +// Parameters: +// location - the location of the domain name. +// resourceGroupName - the name of the resource group. +// parameters - the request body of CheckPrivateLinkService API call. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroup(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest) (result PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CheckPrivateLinkServiceVisibilityByResourceGroup") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckPrivateLinkServiceVisibilityByResourceGroupPreparer(ctx, location, resourceGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibilityByResourceGroup", nil, "Failure preparing request") + return + } + + result, err = client.CheckPrivateLinkServiceVisibilityByResourceGroupSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CheckPrivateLinkServiceVisibilityByResourceGroup", result.Response(), "Failure sending request") + return + } + + return +} + +// CheckPrivateLinkServiceVisibilityByResourceGroupPreparer prepares the CheckPrivateLinkServiceVisibilityByResourceGroup request. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupPreparer(ctx context.Context, location string, resourceGroupName string, parameters CheckPrivateLinkServiceVisibilityRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/locations/{location}/checkPrivateLinkServiceVisibility", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckPrivateLinkServiceVisibilityByResourceGroupSender sends the CheckPrivateLinkServiceVisibilityByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupSender(req *http.Request) (future PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CheckPrivateLinkServiceVisibilityByResourceGroupResponder handles the response to the CheckPrivateLinkServiceVisibilityByResourceGroup request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) CheckPrivateLinkServiceVisibilityByResourceGroupResponder(resp *http.Response) (result PrivateLinkServiceVisibility, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates an private link service in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +// parameters - parameters supplied to the create or update private link service operation. +func (client PrivateLinkServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService) (result PrivateLinkServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateLinkServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, parameters PrivateLinkService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) CreateOrUpdateSender(req *http.Request) (future PrivateLinkServicesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateLinkService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified private link service. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +func (client PrivateLinkServicesClient) Delete(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateLinkServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateLinkServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) DeleteSender(req *http.Request) (future PrivateLinkServicesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DeletePrivateEndpointConnection delete private end point connection for a private link service in a subscription. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +// peConnectionName - the name of the private end point connection. +func (client PrivateLinkServicesClient) DeletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string) (result PrivateLinkServicesDeletePrivateEndpointConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.DeletePrivateEndpointConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePrivateEndpointConnectionPreparer(ctx, resourceGroupName, serviceName, peConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "DeletePrivateEndpointConnection", nil, "Failure preparing request") + return + } + + result, err = client.DeletePrivateEndpointConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "DeletePrivateEndpointConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePrivateEndpointConnectionPreparer prepares the DeletePrivateEndpointConnection request. +func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peConnectionName": autorest.Encode("path", peConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeletePrivateEndpointConnectionSender sends the DeletePrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionSender(req *http.Request) (future PrivateLinkServicesDeletePrivateEndpointConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeletePrivateEndpointConnectionResponder handles the response to the DeletePrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) DeletePrivateEndpointConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified private link service by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +// expand - expands referenced resources. +func (client PrivateLinkServicesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, expand string) (result PrivateLinkService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) GetResponder(resp *http.Response) (result PrivateLinkService, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetPrivateEndpointConnection get the specific private end point connection by specific private link service in the +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +// peConnectionName - the name of the private end point connection. +// expand - expands referenced resources. +func (client PrivateLinkServicesClient) GetPrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, expand string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.GetPrivateEndpointConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPrivateEndpointConnectionPreparer(ctx, resourceGroupName, serviceName, peConnectionName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "GetPrivateEndpointConnection", nil, "Failure preparing request") + return + } + + resp, err := client.GetPrivateEndpointConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "GetPrivateEndpointConnection", resp, "Failure sending request") + return + } + + result, err = client.GetPrivateEndpointConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "GetPrivateEndpointConnection", resp, "Failure responding to request") + return + } + + return +} + +// GetPrivateEndpointConnectionPreparer prepares the GetPrivateEndpointConnection request. +func (client PrivateLinkServicesClient) GetPrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peConnectionName": autorest.Encode("path", peConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetPrivateEndpointConnectionSender sends the GetPrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) GetPrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetPrivateEndpointConnectionResponder handles the response to the GetPrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) GetPrivateEndpointConnectionResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all private link services in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client PrivateLinkServicesClient) List(ctx context.Context, resourceGroupName string) (result PrivateLinkServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.List") + defer func() { + sc := -1 + if result.plslr.Response.Response != nil { + sc = result.plslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", resp, "Failure sending request") + return + } + + result.plslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "List", resp, "Failure responding to request") + return + } + if result.plslr.hasNextLink() && result.plslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkServicesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) ListResponder(resp *http.Response) (result PrivateLinkServiceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PrivateLinkServicesClient) listNextResults(ctx context.Context, lastResults PrivateLinkServiceListResult) (result PrivateLinkServiceListResult, err error) { + req, err := lastResults.privateLinkServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkServicesClient) ListComplete(ctx context.Context, resourceGroupName string) (result PrivateLinkServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAutoApprovedPrivateLinkServices returns all of the private link service ids that can be linked to a Private +// Endpoint with auto approved in this subscription in this region. +// Parameters: +// location - the location of the domain name. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServices(ctx context.Context, location string) (result AutoApprovedPrivateLinkServicesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices") + defer func() { + sc := -1 + if result.aaplsr.Response.Response != nil { + sc = result.aaplsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAutoApprovedPrivateLinkServicesNextResults + req, err := client.ListAutoApprovedPrivateLinkServicesPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", nil, "Failure preparing request") + return + } + + resp, err := client.ListAutoApprovedPrivateLinkServicesSender(req) + if err != nil { + result.aaplsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", resp, "Failure sending request") + return + } + + result.aaplsr, err = client.ListAutoApprovedPrivateLinkServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServices", resp, "Failure responding to request") + return + } + if result.aaplsr.hasNextLink() && result.aaplsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAutoApprovedPrivateLinkServicesPreparer prepares the ListAutoApprovedPrivateLinkServices request. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAutoApprovedPrivateLinkServicesSender sends the ListAutoApprovedPrivateLinkServices request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAutoApprovedPrivateLinkServicesResponder handles the response to the ListAutoApprovedPrivateLinkServices request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesResponder(resp *http.Response) (result AutoApprovedPrivateLinkServicesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAutoApprovedPrivateLinkServicesNextResults retrieves the next set of results, if any. +func (client PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesNextResults(ctx context.Context, lastResults AutoApprovedPrivateLinkServicesResult) (result AutoApprovedPrivateLinkServicesResult, err error) { + req, err := lastResults.autoApprovedPrivateLinkServicesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAutoApprovedPrivateLinkServicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAutoApprovedPrivateLinkServicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAutoApprovedPrivateLinkServicesComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesComplete(ctx context.Context, location string) (result AutoApprovedPrivateLinkServicesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServices") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAutoApprovedPrivateLinkServices(ctx, location) + return +} + +// ListAutoApprovedPrivateLinkServicesByResourceGroup returns all of the private link service ids that can be linked to +// a Private Endpoint with auto approved in this subscription in this region. +// Parameters: +// location - the location of the domain name. +// resourceGroupName - the name of the resource group. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroup(ctx context.Context, location string, resourceGroupName string) (result AutoApprovedPrivateLinkServicesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup") + defer func() { + sc := -1 + if result.aaplsr.Response.Response != nil { + sc = result.aaplsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAutoApprovedPrivateLinkServicesByResourceGroupNextResults + req, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer(ctx, location, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req) + if err != nil { + result.aaplsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", resp, "Failure sending request") + return + } + + result.aaplsr, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListAutoApprovedPrivateLinkServicesByResourceGroup", resp, "Failure responding to request") + return + } + if result.aaplsr.hasNextLink() && result.aaplsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer prepares the ListAutoApprovedPrivateLinkServicesByResourceGroup request. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupPreparer(ctx context.Context, location string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/locations/{location}/autoApprovedPrivateLinkServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAutoApprovedPrivateLinkServicesByResourceGroupSender sends the ListAutoApprovedPrivateLinkServicesByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAutoApprovedPrivateLinkServicesByResourceGroupResponder handles the response to the ListAutoApprovedPrivateLinkServicesByResourceGroup request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp *http.Response) (result AutoApprovedPrivateLinkServicesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAutoApprovedPrivateLinkServicesByResourceGroupNextResults retrieves the next set of results, if any. +func (client PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByResourceGroupNextResults(ctx context.Context, lastResults AutoApprovedPrivateLinkServicesResult) (result AutoApprovedPrivateLinkServicesResult, err error) { + req, err := lastResults.autoApprovedPrivateLinkServicesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAutoApprovedPrivateLinkServicesByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listAutoApprovedPrivateLinkServicesByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAutoApprovedPrivateLinkServicesByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkServicesClient) ListAutoApprovedPrivateLinkServicesByResourceGroupComplete(ctx context.Context, location string, resourceGroupName string) (result AutoApprovedPrivateLinkServicesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListAutoApprovedPrivateLinkServicesByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAutoApprovedPrivateLinkServicesByResourceGroup(ctx, location, resourceGroupName) + return +} + +// ListBySubscription gets all private link service in a subscription. +func (client PrivateLinkServicesClient) ListBySubscription(ctx context.Context) (result PrivateLinkServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.plslr.Response.Response != nil { + sc = result.plslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.plslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.plslr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.plslr.hasNextLink() && result.plslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client PrivateLinkServicesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateLinkServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) ListBySubscriptionResponder(resp *http.Response) (result PrivateLinkServiceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client PrivateLinkServicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults PrivateLinkServiceListResult) (result PrivateLinkServiceListResult, err error) { + req, err := lastResults.privateLinkServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkServicesClient) ListBySubscriptionComplete(ctx context.Context) (result PrivateLinkServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} + +// ListPrivateEndpointConnections gets all private end point connections for a specific private link service. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +func (client PrivateLinkServicesClient) ListPrivateEndpointConnections(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateEndpointConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListPrivateEndpointConnections") + defer func() { + sc := -1 + if result.peclr.Response.Response != nil { + sc = result.peclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listPrivateEndpointConnectionsNextResults + req, err := client.ListPrivateEndpointConnectionsPreparer(ctx, resourceGroupName, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListPrivateEndpointConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListPrivateEndpointConnectionsSender(req) + if err != nil { + result.peclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListPrivateEndpointConnections", resp, "Failure sending request") + return + } + + result.peclr, err = client.ListPrivateEndpointConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "ListPrivateEndpointConnections", resp, "Failure responding to request") + return + } + if result.peclr.hasNextLink() && result.peclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPrivateEndpointConnectionsPreparer prepares the ListPrivateEndpointConnections request. +func (client PrivateLinkServicesClient) ListPrivateEndpointConnectionsPreparer(ctx context.Context, resourceGroupName string, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListPrivateEndpointConnectionsSender sends the ListPrivateEndpointConnections request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) ListPrivateEndpointConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListPrivateEndpointConnectionsResponder handles the response to the ListPrivateEndpointConnections request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) ListPrivateEndpointConnectionsResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listPrivateEndpointConnectionsNextResults retrieves the next set of results, if any. +func (client PrivateLinkServicesClient) listPrivateEndpointConnectionsNextResults(ctx context.Context, lastResults PrivateEndpointConnectionListResult) (result PrivateEndpointConnectionListResult, err error) { + req, err := lastResults.privateEndpointConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listPrivateEndpointConnectionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListPrivateEndpointConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listPrivateEndpointConnectionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListPrivateEndpointConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "listPrivateEndpointConnectionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListPrivateEndpointConnectionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client PrivateLinkServicesClient) ListPrivateEndpointConnectionsComplete(ctx context.Context, resourceGroupName string, serviceName string) (result PrivateEndpointConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.ListPrivateEndpointConnections") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListPrivateEndpointConnections(ctx, resourceGroupName, serviceName) + return +} + +// UpdatePrivateEndpointConnection approve or reject private end point connection for a private link service in a +// subscription. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceName - the name of the private link service. +// peConnectionName - the name of the private end point connection. +// parameters - parameters supplied to approve or reject the private end point connection. +func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnection(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkServicesClient.UpdatePrivateEndpointConnection") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePrivateEndpointConnectionPreparer(ctx, resourceGroupName, serviceName, peConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", nil, "Failure preparing request") + return + } + + resp, err := client.UpdatePrivateEndpointConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", resp, "Failure sending request") + return + } + + result, err = client.UpdatePrivateEndpointConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PrivateLinkServicesClient", "UpdatePrivateEndpointConnection", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePrivateEndpointConnectionPreparer prepares the UpdatePrivateEndpointConnection request. +func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionPreparer(ctx context.Context, resourceGroupName string, serviceName string, peConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peConnectionName": autorest.Encode("path", peConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceName": autorest.Encode("path", serviceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Type = nil + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateLinkServices/{serviceName}/privateEndpointConnections/{peConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdatePrivateEndpointConnectionSender sends the UpdatePrivateEndpointConnection request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdatePrivateEndpointConnectionResponder handles the response to the UpdatePrivateEndpointConnection request. The method always +// closes the http.Response Body. +func (client PrivateLinkServicesClient) UpdatePrivateEndpointConnectionResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/profiles.go b/services/network/mgmt/2021-08-01/network/profiles.go new file mode 100644 index 000000000000..b8b34572aced --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/profiles.go @@ -0,0 +1,577 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ProfilesClient is the network Client +type ProfilesClient struct { + BaseClient +} + +// NewProfilesClient creates an instance of the ProfilesClient client. +func NewProfilesClient(subscriptionID string) ProfilesClient { + return NewProfilesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProfilesClientWithBaseURI creates an instance of the ProfilesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewProfilesClientWithBaseURI(baseURI string, subscriptionID string) ProfilesClient { + return ProfilesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkProfileName - the name of the network profile. +// parameters - parameters supplied to the create or update network profile operation. +func (client ProfilesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkProfileName string, parameters Profile) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ProfilesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkProfileName string, parameters Profile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkProfileName": autorest.Encode("path", networkProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ProfilesClient) CreateOrUpdateResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network profile. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkProfileName - the name of the NetworkProfile. +func (client ProfilesClient) Delete(ctx context.Context, resourceGroupName string, networkProfileName string) (result ProfilesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ProfilesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkProfileName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkProfileName": autorest.Encode("path", networkProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) DeleteSender(req *http.Request) (future ProfilesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ProfilesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network profile in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkProfileName - the name of the public IP prefix. +// expand - expands referenced resources. +func (client ProfilesClient) Get(ctx context.Context, resourceGroupName string, networkProfileName string, expand string) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkProfileName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProfilesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkProfileName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkProfileName": autorest.Encode("path", networkProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network profiles in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ProfilesClient) List(ctx context.Context, resourceGroupName string) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "List", resp, "Failure sending request") + return + } + + result.plr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "List", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProfilesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ProfilesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ProfilesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListComplete(ctx context.Context, resourceGroupName string) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the network profiles in a subscription. +func (client ProfilesClient) ListAll(ctx context.Context) (result ProfileListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListAll") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "ListAll", resp, "Failure sending request") + return + } + + result.plr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.plr.hasNextLink() && result.plr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client ProfilesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkProfiles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client ProfilesClient) ListAllResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client ProfilesClient) listAllNextResults(ctx context.Context, lastResults ProfileListResult) (result ProfileListResult, err error) { + req, err := lastResults.profileListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ProfilesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ProfilesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProfilesClient) ListAllComplete(ctx context.Context) (result ProfileListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates network profile tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkProfileName - the name of the network profile. +// parameters - parameters supplied to update network profile tags. +func (client ProfilesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkProfileName string, parameters TagsObject) (result Profile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ProfilesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ProfilesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkProfileName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkProfileName": autorest.Encode("path", networkProfileName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ProfilesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ProfilesClient) UpdateTagsResponder(resp *http.Response) (result Profile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/publicipaddresses.go b/services/network/mgmt/2021-08-01/network/publicipaddresses.go new file mode 100644 index 000000000000..952baf08a4c0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/publicipaddresses.go @@ -0,0 +1,1258 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PublicIPAddressesClient is the network Client +type PublicIPAddressesClient struct { + BaseClient +} + +// NewPublicIPAddressesClient creates an instance of the PublicIPAddressesClient client. +func NewPublicIPAddressesClient(subscriptionID string) PublicIPAddressesClient { + return NewPublicIPAddressesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPublicIPAddressesClientWithBaseURI creates an instance of the PublicIPAddressesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPAddressesClient { + return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a static or dynamic public IP address. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +// parameters - parameters supplied to the create or update public IP address operation. +func (client PublicIPAddressesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (result PublicIPAddressesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "parameters.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "parameters.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.PublicIPAddressesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, publicIPAddressName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPAddressesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified public IP address. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +func (client PublicIPAddressesClient) Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (result PublicIPAddressesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, publicIPAddressName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (future PublicIPAddressesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified public IP address in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +// expand - expands referenced resources. +func (client PublicIPAddressesClient) Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, publicIPAddressName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PublicIPAddressesClient) GetPreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCloudServicePublicIPAddress get the specified public IP address in a cloud service. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +// roleInstanceName - the role instance name. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the IP configuration. +// publicIPAddressName - the name of the public IP Address. +// expand - expands referenced resources. +func (client PublicIPAddressesClient) GetCloudServicePublicIPAddress(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.GetCloudServicePublicIPAddress") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCloudServicePublicIPAddressPreparer(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetCloudServicePublicIPAddress", nil, "Failure preparing request") + return + } + + resp, err := client.GetCloudServicePublicIPAddressSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetCloudServicePublicIPAddress", resp, "Failure sending request") + return + } + + result, err = client.GetCloudServicePublicIPAddressResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetCloudServicePublicIPAddress", resp, "Failure responding to request") + return + } + + return +} + +// GetCloudServicePublicIPAddressPreparer prepares the GetCloudServicePublicIPAddress request. +func (client PublicIPAddressesClient) GetCloudServicePublicIPAddressPreparer(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleInstanceName": autorest.Encode("path", roleInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCloudServicePublicIPAddressSender sends the GetCloudServicePublicIPAddress request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) GetCloudServicePublicIPAddressSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCloudServicePublicIPAddressResponder handles the response to the GetCloudServicePublicIPAddress request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) GetCloudServicePublicIPAddressResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVirtualMachineScaleSetPublicIPAddress get the specified public IP address in a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the name of the network interface. +// IPConfigurationName - the name of the IP configuration. +// publicIPAddressName - the name of the public IP Address. +// expand - expands referenced resources. +func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.GetVirtualMachineScaleSetPublicIPAddress") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetVirtualMachineScaleSetPublicIPAddress", nil, "Failure preparing request") + return + } + + resp, err := client.GetVirtualMachineScaleSetPublicIPAddressSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetVirtualMachineScaleSetPublicIPAddress", resp, "Failure sending request") + return + } + + result, err = client.GetVirtualMachineScaleSetPublicIPAddressResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetVirtualMachineScaleSetPublicIPAddress", resp, "Failure responding to request") + return + } + + return +} + +// GetVirtualMachineScaleSetPublicIPAddressPreparer prepares the GetVirtualMachineScaleSetPublicIPAddress request. +func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVirtualMachineScaleSetPublicIPAddressSender sends the GetVirtualMachineScaleSetPublicIPAddress request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetVirtualMachineScaleSetPublicIPAddressResponder handles the response to the GetVirtualMachineScaleSetPublicIPAddress request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all public IP addresses in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client PublicIPAddressesClient) List(ctx context.Context, resourceGroupName string) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.List") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PublicIPAddressesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListComplete(ctx context.Context, resourceGroupName string) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the public IP addresses in a subscription. +func (client PublicIPAddressesClient) ListAll(ctx context.Context) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListAll") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client PublicIPAddressesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listAllNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListAllComplete(ctx context.Context) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListCloudServicePublicIPAddresses gets information about all public IP addresses on a cloud service level. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +func (client PublicIPAddressesClient) ListCloudServicePublicIPAddresses(ctx context.Context, resourceGroupName string, cloudServiceName string) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListCloudServicePublicIPAddresses") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCloudServicePublicIPAddressesNextResults + req, err := client.ListCloudServicePublicIPAddressesPreparer(ctx, resourceGroupName, cloudServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServicePublicIPAddresses", nil, "Failure preparing request") + return + } + + resp, err := client.ListCloudServicePublicIPAddressesSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServicePublicIPAddresses", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListCloudServicePublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServicePublicIPAddresses", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCloudServicePublicIPAddressesPreparer prepares the ListCloudServicePublicIPAddresses request. +func (client PublicIPAddressesClient) ListCloudServicePublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, cloudServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCloudServicePublicIPAddressesSender sends the ListCloudServicePublicIPAddresses request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListCloudServicePublicIPAddressesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCloudServicePublicIPAddressesResponder handles the response to the ListCloudServicePublicIPAddresses request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListCloudServicePublicIPAddressesResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCloudServicePublicIPAddressesNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listCloudServicePublicIPAddressesNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServicePublicIPAddressesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCloudServicePublicIPAddressesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServicePublicIPAddressesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCloudServicePublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServicePublicIPAddressesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCloudServicePublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListCloudServicePublicIPAddressesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListCloudServicePublicIPAddresses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCloudServicePublicIPAddresses(ctx, resourceGroupName, cloudServiceName) + return +} + +// ListCloudServiceRoleInstancePublicIPAddresses gets information about all public IP addresses in a role instance IP +// configuration in a cloud service. +// Parameters: +// resourceGroupName - the name of the resource group. +// cloudServiceName - the name of the cloud service. +// roleInstanceName - the name of role instance. +// networkInterfaceName - the network interface name. +// IPConfigurationName - the IP configuration name. +func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddresses(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListCloudServiceRoleInstancePublicIPAddresses") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listCloudServiceRoleInstancePublicIPAddressesNextResults + req, err := client.ListCloudServiceRoleInstancePublicIPAddressesPreparer(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, IPConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServiceRoleInstancePublicIPAddresses", nil, "Failure preparing request") + return + } + + resp, err := client.ListCloudServiceRoleInstancePublicIPAddressesSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServiceRoleInstancePublicIPAddresses", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListCloudServiceRoleInstancePublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListCloudServiceRoleInstancePublicIPAddresses", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListCloudServiceRoleInstancePublicIPAddressesPreparer prepares the ListCloudServiceRoleInstancePublicIPAddresses request. +func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "cloudServiceName": autorest.Encode("path", cloudServiceName), + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleInstanceName": autorest.Encode("path", roleInstanceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCloudServiceRoleInstancePublicIPAddressesSender sends the ListCloudServiceRoleInstancePublicIPAddresses request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddressesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListCloudServiceRoleInstancePublicIPAddressesResponder handles the response to the ListCloudServiceRoleInstancePublicIPAddresses request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddressesResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listCloudServiceRoleInstancePublicIPAddressesNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddressesNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServiceRoleInstancePublicIPAddressesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListCloudServiceRoleInstancePublicIPAddressesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServiceRoleInstancePublicIPAddressesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListCloudServiceRoleInstancePublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listCloudServiceRoleInstancePublicIPAddressesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListCloudServiceRoleInstancePublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListCloudServiceRoleInstancePublicIPAddressesComplete(ctx context.Context, resourceGroupName string, cloudServiceName string, roleInstanceName string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListCloudServiceRoleInstancePublicIPAddresses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListCloudServiceRoleInstancePublicIPAddresses(ctx, resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, IPConfigurationName) + return +} + +// ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine +// scale set level. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListVirtualMachineScaleSetPublicIPAddresses") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listVirtualMachineScaleSetPublicIPAddressesNextResults + req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVirtualMachineScaleSetPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetPublicIPAddresses request. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVirtualMachineScaleSetPublicIPAddressesSender sends the ListVirtualMachineScaleSetPublicIPAddresses request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVirtualMachineScaleSetPublicIPAddressesResponder handles the response to the ListVirtualMachineScaleSetPublicIPAddresses request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVirtualMachineScaleSetPublicIPAddressesNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddressesNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVirtualMachineScaleSetPublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListVirtualMachineScaleSetPublicIPAddresses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVirtualMachineScaleSetPublicIPAddresses(ctx, resourceGroupName, virtualMachineScaleSetName) + return +} + +// ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP +// configuration in a virtual machine scale set. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualMachineScaleSetName - the name of the virtual machine scale set. +// virtualmachineIndex - the virtual machine index. +// networkInterfaceName - the network interface name. +// IPConfigurationName - the IP configuration name. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListVirtualMachineScaleSetVMPublicIPAddresses") + defer func() { + sc := -1 + if result.pialr.Response.Response != nil { + sc = result.pialr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listVirtualMachineScaleSetVMPublicIPAddressesNextResults + req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", nil, "Failure preparing request") + return + } + + resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req) + if err != nil { + result.pialr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure sending request") + return + } + + result.pialr, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure responding to request") + return + } + if result.pialr.hasNextLink() && result.pialr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListVirtualMachineScaleSetVMPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetVMPublicIPAddresses request. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigurationName": autorest.Encode("path", IPConfigurationName), + "networkInterfaceName": autorest.Encode("path", networkInterfaceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualmachineIndex": autorest.Encode("path", virtualmachineIndex), + "virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName), + } + + const APIVersion = "2018-10-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListVirtualMachineScaleSetVMPublicIPAddressesSender sends the ListVirtualMachineScaleSetVMPublicIPAddresses request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListVirtualMachineScaleSetVMPublicIPAddressesResponder handles the response to the ListVirtualMachineScaleSetVMPublicIPAddresses request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp *http.Response) (result PublicIPAddressListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listVirtualMachineScaleSetVMPublicIPAddressesNextResults retrieves the next set of results, if any. +func (client PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddressesNextResults(ctx context.Context, lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { + req, err := lastResults.publicIPAddressListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", resp, "Failure sending next results request") + } + result, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListVirtualMachineScaleSetVMPublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.ListVirtualMachineScaleSetVMPublicIPAddresses") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListVirtualMachineScaleSetVMPublicIPAddresses(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) + return +} + +// UpdateTags updates public IP address tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPAddressName - the name of the public IP address. +// parameters - parameters supplied to update public IP address tags. +func (client PublicIPAddressesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject) (result PublicIPAddress, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPAddressesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, publicIPAddressName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpAddressName": autorest.Encode("path", publicIPAddressName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPAddressesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client PublicIPAddressesClient) UpdateTagsResponder(resp *http.Response) (result PublicIPAddress, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/publicipprefixes.go b/services/network/mgmt/2021-08-01/network/publicipprefixes.go new file mode 100644 index 000000000000..5d7a29762114 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/publicipprefixes.go @@ -0,0 +1,581 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PublicIPPrefixesClient is the network Client +type PublicIPPrefixesClient struct { + BaseClient +} + +// NewPublicIPPrefixesClient creates an instance of the PublicIPPrefixesClient client. +func NewPublicIPPrefixesClient(subscriptionID string) PublicIPPrefixesClient { + return NewPublicIPPrefixesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPublicIPPrefixesClientWithBaseURI creates an instance of the PublicIPPrefixesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPublicIPPrefixesClientWithBaseURI(baseURI string, subscriptionID string) PublicIPPrefixesClient { + return PublicIPPrefixesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a static or dynamic public IP prefix. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPPrefixName - the name of the public IP prefix. +// parameters - parameters supplied to the create or update public IP prefix operation. +func (client PublicIPPrefixesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix) (result PublicIPPrefixesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, publicIPPrefixName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PublicIPPrefixesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters PublicIPPrefix) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpPrefixName": autorest.Encode("path", publicIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPPrefixesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) CreateOrUpdateResponder(resp *http.Response) (result PublicIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified public IP prefix. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPPrefixName - the name of the PublicIpPrefix. +func (client PublicIPPrefixesClient) Delete(ctx context.Context, resourceGroupName string, publicIPPrefixName string) (result PublicIPPrefixesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, publicIPPrefixName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PublicIPPrefixesClient) DeletePreparer(ctx context.Context, resourceGroupName string, publicIPPrefixName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpPrefixName": autorest.Encode("path", publicIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) DeleteSender(req *http.Request) (future PublicIPPrefixesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified public IP prefix in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPPrefixName - the name of the public IP prefix. +// expand - expands referenced resources. +func (client PublicIPPrefixesClient) Get(ctx context.Context, resourceGroupName string, publicIPPrefixName string, expand string) (result PublicIPPrefix, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, publicIPPrefixName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PublicIPPrefixesClient) GetPreparer(ctx context.Context, resourceGroupName string, publicIPPrefixName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpPrefixName": autorest.Encode("path", publicIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) GetResponder(resp *http.Response) (result PublicIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all public IP prefixes in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client PublicIPPrefixesClient) List(ctx context.Context, resourceGroupName string) (result PublicIPPrefixListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.List") + defer func() { + sc := -1 + if result.piplr.Response.Response != nil { + sc = result.piplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.piplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "List", resp, "Failure sending request") + return + } + + result.piplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "List", resp, "Failure responding to request") + return + } + if result.piplr.hasNextLink() && result.piplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PublicIPPrefixesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) ListResponder(resp *http.Response) (result PublicIPPrefixListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client PublicIPPrefixesClient) listNextResults(ctx context.Context, lastResults PublicIPPrefixListResult) (result PublicIPPrefixListResult, err error) { + req, err := lastResults.publicIPPrefixListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPPrefixesClient) ListComplete(ctx context.Context, resourceGroupName string) (result PublicIPPrefixListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the public IP prefixes in a subscription. +func (client PublicIPPrefixesClient) ListAll(ctx context.Context) (result PublicIPPrefixListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.ListAll") + defer func() { + sc := -1 + if result.piplr.Response.Response != nil { + sc = result.piplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.piplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "ListAll", resp, "Failure sending request") + return + } + + result.piplr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.piplr.hasNextLink() && result.piplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client PublicIPPrefixesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPPrefixes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) ListAllResponder(resp *http.Response) (result PublicIPPrefixListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client PublicIPPrefixesClient) listAllNextResults(ctx context.Context, lastResults PublicIPPrefixListResult) (result PublicIPPrefixListResult, err error) { + req, err := lastResults.publicIPPrefixListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client PublicIPPrefixesClient) ListAllComplete(ctx context.Context) (result PublicIPPrefixListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates public IP prefix tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// publicIPPrefixName - the name of the public IP prefix. +// parameters - parameters supplied to update public IP prefix tags. +func (client PublicIPPrefixesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters TagsObject) (result PublicIPPrefix, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PublicIPPrefixesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, publicIPPrefixName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.PublicIPPrefixesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client PublicIPPrefixesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, publicIPPrefixName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "publicIpPrefixName": autorest.Encode("path", publicIPPrefixName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIpPrefixName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client PublicIPPrefixesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client PublicIPPrefixesClient) UpdateTagsResponder(resp *http.Response) (result PublicIPPrefix, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/resourcenavigationlinks.go b/services/network/mgmt/2021-08-01/network/resourcenavigationlinks.go new file mode 100644 index 000000000000..ea9b569fd717 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/resourcenavigationlinks.go @@ -0,0 +1,110 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResourceNavigationLinksClient is the network Client +type ResourceNavigationLinksClient struct { + BaseClient +} + +// NewResourceNavigationLinksClient creates an instance of the ResourceNavigationLinksClient client. +func NewResourceNavigationLinksClient(subscriptionID string) ResourceNavigationLinksClient { + return NewResourceNavigationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourceNavigationLinksClientWithBaseURI creates an instance of the ResourceNavigationLinksClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewResourceNavigationLinksClientWithBaseURI(baseURI string, subscriptionID string) ResourceNavigationLinksClient { + return ResourceNavigationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of resource navigation links for a subnet. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +func (client ResourceNavigationLinksClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result ResourceNavigationLinksListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceNavigationLinksClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ResourceNavigationLinksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ResourceNavigationLinksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ResourceNavigationLinksClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourceNavigationLinksClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ResourceNavigationLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ResourceNavigationLinksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ResourceNavigationLinksClient) ListResponder(resp *http.Response) (result ResourceNavigationLinksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/routefilterrules.go b/services/network/mgmt/2021-08-01/network/routefilterrules.go new file mode 100644 index 000000000000..2f76f810a30f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/routefilterrules.go @@ -0,0 +1,403 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RouteFilterRulesClient is the network Client +type RouteFilterRulesClient struct { + BaseClient +} + +// NewRouteFilterRulesClient creates an instance of the RouteFilterRulesClient client. +func NewRouteFilterRulesClient(subscriptionID string) RouteFilterRulesClient { + return NewRouteFilterRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteFilterRulesClientWithBaseURI creates an instance of the RouteFilterRulesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string) RouteFilterRulesClient { + return RouteFilterRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route in the specified route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the route filter rule. +// routeFilterRuleParameters - parameters supplied to the create or update route filter rule operation. +func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (result RouteFilterRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: routeFilterRuleParameters, + Constraints: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.RouteFilterRulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + routeFilterRuleParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithJSON(routeFilterRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (future RouteFilterRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilterRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified rule from a route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the rule. +func (client RouteFilterRulesClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (future RouteFilterRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified rule from a route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// ruleName - the name of the rule. +func (client RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, ruleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteFilterRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "ruleName": autorest.Encode("path", ruleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) GetResponder(resp *http.Response) (result RouteFilterRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRouteFilter gets all RouteFilterRules in a route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +func (client RouteFilterRulesClient) ListByRouteFilter(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRulesClient.ListByRouteFilter") + defer func() { + sc := -1 + if result.rfrlr.Response.Response != nil { + sc = result.rfrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByRouteFilterNextResults + req, err := client.ListByRouteFilterPreparer(ctx, resourceGroupName, routeFilterName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRouteFilterSender(req) + if err != nil { + result.rfrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending request") + return + } + + result.rfrlr, err = client.ListByRouteFilterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to request") + return + } + if result.rfrlr.hasNextLink() && result.rfrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRouteFilterPreparer prepares the ListByRouteFilter request. +func (client RouteFilterRulesClient) ListByRouteFilterPreparer(ctx context.Context, resourceGroupName string, routeFilterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRouteFilterSender sends the ListByRouteFilter request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFilterRulesClient) ListByRouteFilterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRouteFilterResponder handles the response to the ListByRouteFilter request. The method always +// closes the http.Response Body. +func (client RouteFilterRulesClient) ListByRouteFilterResponder(resp *http.Response) (result RouteFilterRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRouteFilterNextResults retrieves the next set of results, if any. +func (client RouteFilterRulesClient) listByRouteFilterNextResults(ctx context.Context, lastResults RouteFilterRuleListResult) (result RouteFilterRuleListResult, err error) { + req, err := lastResults.routeFilterRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRouteFilterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRouteFilterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRouteFilterComplete enumerates all values, automatically crossing page boundaries as required. +func (client RouteFilterRulesClient) ListByRouteFilterComplete(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFilterRulesClient.ListByRouteFilter") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByRouteFilter(ctx, resourceGroupName, routeFilterName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/routefilters.go b/services/network/mgmt/2021-08-01/network/routefilters.go new file mode 100644 index 000000000000..b809ebd7944c --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/routefilters.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RouteFiltersClient is the network Client +type RouteFiltersClient struct { + BaseClient +} + +// NewRouteFiltersClient creates an instance of the RouteFiltersClient client. +func NewRouteFiltersClient(subscriptionID string) RouteFiltersClient { + return NewRouteFiltersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteFiltersClientWithBaseURI creates an instance of the RouteFiltersClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRouteFiltersClientWithBaseURI(baseURI string, subscriptionID string) RouteFiltersClient { + return RouteFiltersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route filter in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// routeFilterParameters - parameters supplied to the create or update route filter operation. +func (client RouteFiltersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter) (result RouteFiltersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, routeFilterParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + routeFilterParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithJSON(routeFilterParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (future RouteFiltersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) CreateOrUpdateResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +func (client RouteFiltersClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFiltersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeFilterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) DeleteSender(req *http.Request) (future RouteFiltersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// expand - expands referenced express route bgp peering resources. +func (client RouteFiltersClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteFiltersClient) GetPreparer(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) GetResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all route filters in a subscription. +func (client RouteFiltersClient) List(ctx context.Context) (result RouteFilterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.List") + defer func() { + sc := -1 + if result.rflr.Response.Response != nil { + sc = result.rflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending request") + return + } + + result.rflr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to request") + return + } + if result.rflr.hasNextLink() && result.rflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RouteFiltersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) ListResponder(resp *http.Response) (result RouteFilterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RouteFiltersClient) listNextResults(ctx context.Context, lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { + req, err := lastResults.routeFilterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RouteFiltersClient) ListComplete(ctx context.Context) (result RouteFilterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all route filters in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client RouteFiltersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RouteFilterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.rflr.Response.Response != nil { + sc = result.rflr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rflr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rflr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rflr.hasNextLink() && result.rflr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client RouteFiltersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) ListByResourceGroupResponder(resp *http.Response) (result RouteFilterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client RouteFiltersClient) listByResourceGroupNextResults(ctx context.Context, lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { + req, err := lastResults.routeFilterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client RouteFiltersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RouteFilterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates tags of a route filter. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeFilterName - the name of the route filter. +// parameters - parameters supplied to update route filter tags. +func (client RouteFiltersClient) UpdateTags(ctx context.Context, resourceGroupName string, routeFilterName string, parameters TagsObject) (result RouteFilter, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteFiltersClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeFilterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client RouteFiltersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, routeFilterName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeFilterName": autorest.Encode("path", routeFilterName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client RouteFiltersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client RouteFiltersClient) UpdateTagsResponder(resp *http.Response) (result RouteFilter, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/routes.go b/services/network/mgmt/2021-08-01/network/routes.go new file mode 100644 index 000000000000..f189aeebf85c --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/routes.go @@ -0,0 +1,392 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RoutesClient is the network Client +type RoutesClient struct { + BaseClient +} + +// NewRoutesClient creates an instance of the RoutesClient client. +func NewRoutesClient(subscriptionID string) RoutesClient { + return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient { + return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a route in the specified route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. +// routeParameters - parameters supplied to the create or update route operation. +func (client RoutesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result RoutesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, routeName, routeParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + routeParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithJSON(routeParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (future RoutesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route from a route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. +func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result RoutesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route from a route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// routeName - the name of the route. +func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, routeName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeName": autorest.Encode("path", routeName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all routes in a route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +func (client RoutesClient) List(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.List") + defer func() { + sc := -1 + if result.rlr.Response.Response != nil { + sc = result.rlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request") + return + } + + result.rlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request") + return + } + if result.rlr.hasNextLink() && result.rlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RoutesClient) ListPreparer(ctx context.Context, resourceGroupName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RoutesClient) listNextResults(ctx context.Context, lastResults RouteListResult) (result RouteListResult, err error) { + req, err := lastResults.routeListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoutesClient) ListComplete(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, routeTableName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/routetables.go b/services/network/mgmt/2021-08-01/network/routetables.go new file mode 100644 index 000000000000..f946c9041b03 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/routetables.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RouteTablesClient is the network Client +type RouteTablesClient struct { + BaseClient +} + +// NewRouteTablesClient creates an instance of the RouteTablesClient client. +func NewRouteTablesClient(subscriptionID string) RouteTablesClient { + return NewRouteTablesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRouteTablesClientWithBaseURI creates an instance of the RouteTablesClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) RouteTablesClient { + return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or updates a route table in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// parameters - parameters supplied to the create or update route table operation. +func (client RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTablesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (future RouteTablesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (result RouteTable, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +func (client RouteTablesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteTablesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) DeleteSender(req *http.Request) (future RouteTablesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified route table. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// expand - expands referenced resources. +func (client RouteTablesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RouteTablesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteTable, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all route tables in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client RouteTablesClient) List(ctx context.Context, resourceGroupName string) (result RouteTableListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.List") + defer func() { + sc := -1 + if result.rtlr.Response.Response != nil { + sc = result.rtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request") + return + } + + result.rtlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request") + return + } + if result.rtlr.hasNextLink() && result.rtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RouteTablesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) ListResponder(resp *http.Response) (result RouteTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RouteTablesClient) listNextResults(ctx context.Context, lastResults RouteTableListResult) (result RouteTableListResult, err error) { + req, err := lastResults.routeTableListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RouteTablesClient) ListComplete(ctx context.Context, resourceGroupName string) (result RouteTableListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all route tables in a subscription. +func (client RouteTablesClient) ListAll(ctx context.Context) (result RouteTableListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.ListAll") + defer func() { + sc := -1 + if result.rtlr.Response.Response != nil { + sc = result.rtlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.rtlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request") + return + } + + result.rtlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.rtlr.hasNextLink() && result.rtlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client RouteTablesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result RouteTableListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client RouteTablesClient) listAllNextResults(ctx context.Context, lastResults RouteTableListResult) (result RouteTableListResult, err error) { + req, err := lastResults.routeTableListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client RouteTablesClient) ListAllComplete(ctx context.Context) (result RouteTableListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates a route table tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// routeTableName - the name of the route table. +// parameters - parameters supplied to update route table tags. +func (client RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (result RouteTable, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RouteTablesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeTableName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client RouteTablesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client RouteTablesClient) UpdateTagsResponder(resp *http.Response) (result RouteTable, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/routingintent.go b/services/network/mgmt/2021-08-01/network/routingintent.go new file mode 100644 index 000000000000..2a3d7fdb8f73 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/routingintent.go @@ -0,0 +1,393 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// RoutingIntentClient is the network Client +type RoutingIntentClient struct { + BaseClient +} + +// NewRoutingIntentClient creates an instance of the RoutingIntentClient client. +func NewRoutingIntentClient(subscriptionID string) RoutingIntentClient { + return NewRoutingIntentClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoutingIntentClientWithBaseURI creates an instance of the RoutingIntentClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewRoutingIntentClientWithBaseURI(baseURI string, subscriptionID string) RoutingIntentClient { + return RoutingIntentClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. +// Parameters: +// resourceGroupName - the resource group name of the RoutingIntent. +// virtualHubName - the name of the VirtualHub. +// routingIntentName - the name of the per VirtualHub singleton Routing Intent resource. +// routingIntentParameters - parameters supplied to create or update RoutingIntent. +func (client RoutingIntentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent) (result RoutingIntentCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutingIntentClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoutingIntentClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routingIntentName": autorest.Encode("path", routingIntentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + routingIntentParameters.Etag = nil + routingIntentParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", pathParameters), + autorest.WithJSON(routingIntentParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client RoutingIntentClient) CreateOrUpdateSender(req *http.Request) (future RoutingIntentCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoutingIntentClient) CreateOrUpdateResponder(resp *http.Response) (result RoutingIntent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a RoutingIntent. +// Parameters: +// resourceGroupName - the resource group name of the RoutingIntent. +// virtualHubName - the name of the VirtualHub. +// routingIntentName - the name of the RoutingIntent. +func (client RoutingIntentClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (result RoutingIntentDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutingIntentClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, routingIntentName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoutingIntentClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routingIntentName": autorest.Encode("path", routingIntentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client RoutingIntentClient) DeleteSender(req *http.Request) (future RoutingIntentDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoutingIntentClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a RoutingIntent. +// Parameters: +// resourceGroupName - the resource group name of the RoutingIntent. +// virtualHubName - the name of the VirtualHub. +// routingIntentName - the name of the RoutingIntent. +func (client RoutingIntentClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (result RoutingIntent, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutingIntentClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, routingIntentName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoutingIntentClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routingIntentName": autorest.Encode("path", routingIntentName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client RoutingIntentClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoutingIntentClient) GetResponder(resp *http.Response) (result RoutingIntent, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the details of all RoutingIntent child resources of the VirtualHub. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client RoutingIntentClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListRoutingIntentResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutingIntentClient.List") + defer func() { + sc := -1 + if result.lrir.Response.Response != nil { + sc = result.lrir.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lrir.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "List", resp, "Failure sending request") + return + } + + result.lrir, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "List", resp, "Failure responding to request") + return + } + if result.lrir.hasNextLink() && result.lrir.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RoutingIntentClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoutingIntentClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoutingIntentClient) ListResponder(resp *http.Response) (result ListRoutingIntentResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RoutingIntentClient) listNextResults(ctx context.Context, lastResults ListRoutingIntentResult) (result ListRoutingIntentResult, err error) { + req, err := lastResults.listRoutingIntentResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.RoutingIntentClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.RoutingIntentClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.RoutingIntentClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoutingIntentClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListRoutingIntentResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoutingIntentClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/securitygroups.go b/services/network/mgmt/2021-08-01/network/securitygroups.go new file mode 100644 index 000000000000..fc059a966b0e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/securitygroups.go @@ -0,0 +1,580 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecurityGroupsClient is the network Client +type SecurityGroupsClient struct { + BaseClient +} + +// NewSecurityGroupsClient creates an instance of the SecurityGroupsClient client. +func NewSecurityGroupsClient(subscriptionID string) SecurityGroupsClient { + return NewSecurityGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityGroupsClientWithBaseURI creates an instance of the SecurityGroupsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) SecurityGroupsClient { + return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a network security group in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// parameters - parameters supplied to the create or update network security group operation. +func (client SecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroupsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future SecurityGroupsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) DeleteSender(req *http.Request) (future SecurityGroupsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// expand - expands referenced resources. +func (client SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result SecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network security groups in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client SecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result SecurityGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.List") + defer func() { + sc := -1 + if result.sglr.Response.Response != nil { + sc = result.sglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request") + return + } + + result.sglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request") + return + } + if result.sglr.hasNextLink() && result.sglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SecurityGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result SecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecurityGroupsClient) listNextResults(ctx context.Context, lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { + req, err := lastResults.securityGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityGroupsClient) ListComplete(ctx context.Context, resourceGroupName string) (result SecurityGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all network security groups in a subscription. +func (client SecurityGroupsClient) ListAll(ctx context.Context) (result SecurityGroupListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.ListAll") + defer func() { + sc := -1 + if result.sglr.Response.Response != nil { + sc = result.sglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.sglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request") + return + } + + result.sglr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.sglr.hasNextLink() && result.sglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client SecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result SecurityGroupListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client SecurityGroupsClient) listAllNextResults(ctx context.Context, lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { + req, err := lastResults.securityGroupListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityGroupsClient) ListAllComplete(ctx context.Context) (result SecurityGroupListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// UpdateTags updates a network security group tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// parameters - parameters supplied to update network security group tags. +func (client SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (result SecurityGroup, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityGroupsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityGroupsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SecurityGroupsClient) UpdateTagsResponder(resp *http.Response) (result SecurityGroup, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/securitypartnerproviders.go b/services/network/mgmt/2021-08-01/network/securitypartnerproviders.go new file mode 100644 index 000000000000..dd7f1dd0f17f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/securitypartnerproviders.go @@ -0,0 +1,577 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecurityPartnerProvidersClient is the network Client +type SecurityPartnerProvidersClient struct { + BaseClient +} + +// NewSecurityPartnerProvidersClient creates an instance of the SecurityPartnerProvidersClient client. +func NewSecurityPartnerProvidersClient(subscriptionID string) SecurityPartnerProvidersClient { + return NewSecurityPartnerProvidersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityPartnerProvidersClientWithBaseURI creates an instance of the SecurityPartnerProvidersClient client using +// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewSecurityPartnerProvidersClientWithBaseURI(baseURI string, subscriptionID string) SecurityPartnerProvidersClient { + return SecurityPartnerProvidersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Security Partner Provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// securityPartnerProviderName - the name of the Security Partner Provider. +// parameters - parameters supplied to the create or update Security Partner Provider operation. +func (client SecurityPartnerProvidersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider) (result SecurityPartnerProvidersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, securityPartnerProviderName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecurityPartnerProvidersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters SecurityPartnerProvider) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPartnerProviderName": autorest.Encode("path", securityPartnerProviderName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) CreateOrUpdateSender(req *http.Request) (future SecurityPartnerProvidersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityPartnerProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Security Partner Provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// securityPartnerProviderName - the name of the Security Partner Provider. +func (client SecurityPartnerProvidersClient) Delete(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (result SecurityPartnerProvidersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, securityPartnerProviderName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecurityPartnerProvidersClient) DeletePreparer(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPartnerProviderName": autorest.Encode("path", securityPartnerProviderName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) DeleteSender(req *http.Request) (future SecurityPartnerProvidersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Security Partner Provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// securityPartnerProviderName - the name of the Security Partner Provider. +func (client SecurityPartnerProvidersClient) Get(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (result SecurityPartnerProvider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, securityPartnerProviderName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityPartnerProvidersClient) GetPreparer(ctx context.Context, resourceGroupName string, securityPartnerProviderName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPartnerProviderName": autorest.Encode("path", securityPartnerProviderName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) GetResponder(resp *http.Response) (result SecurityPartnerProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the Security Partner Providers in a subscription. +func (client SecurityPartnerProvidersClient) List(ctx context.Context) (result SecurityPartnerProviderListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.List") + defer func() { + sc := -1 + if result.spplr.Response.Response != nil { + sc = result.spplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.spplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "List", resp, "Failure sending request") + return + } + + result.spplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "List", resp, "Failure responding to request") + return + } + if result.spplr.hasNextLink() && result.spplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SecurityPartnerProvidersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/securityPartnerProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) ListResponder(resp *http.Response) (result SecurityPartnerProviderListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecurityPartnerProvidersClient) listNextResults(ctx context.Context, lastResults SecurityPartnerProviderListResult) (result SecurityPartnerProviderListResult, err error) { + req, err := lastResults.securityPartnerProviderListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityPartnerProvidersClient) ListComplete(ctx context.Context) (result SecurityPartnerProviderListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all Security Partner Providers in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client SecurityPartnerProvidersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SecurityPartnerProviderListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.spplr.Response.Response != nil { + sc = result.spplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.spplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.spplr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.spplr.hasNextLink() && result.spplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SecurityPartnerProvidersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) ListByResourceGroupResponder(resp *http.Response) (result SecurityPartnerProviderListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SecurityPartnerProvidersClient) listByResourceGroupNextResults(ctx context.Context, lastResults SecurityPartnerProviderListResult) (result SecurityPartnerProviderListResult, err error) { + req, err := lastResults.securityPartnerProviderListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityPartnerProvidersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SecurityPartnerProviderListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates tags of a Security Partner Provider resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// securityPartnerProviderName - the name of the Security Partner Provider. +// parameters - parameters supplied to update Security Partner Provider tags. +func (client SecurityPartnerProvidersClient) UpdateTags(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters TagsObject) (result SecurityPartnerProvider, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityPartnerProvidersClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, securityPartnerProviderName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityPartnerProvidersClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SecurityPartnerProvidersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, securityPartnerProviderName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityPartnerProviderName": autorest.Encode("path", securityPartnerProviderName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/securityPartnerProviders/{securityPartnerProviderName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityPartnerProvidersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SecurityPartnerProvidersClient) UpdateTagsResponder(resp *http.Response) (result SecurityPartnerProvider, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/securityrules.go b/services/network/mgmt/2021-08-01/network/securityrules.go new file mode 100644 index 000000000000..6e75a8eefb3e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/securityrules.go @@ -0,0 +1,392 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SecurityRulesClient is the network Client +type SecurityRulesClient struct { + BaseClient +} + +// NewSecurityRulesClient creates an instance of the SecurityRulesClient client. +func NewSecurityRulesClient(subscriptionID string) SecurityRulesClient { + return NewSecurityRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSecurityRulesClientWithBaseURI creates an instance of the SecurityRulesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) SecurityRulesClient { + return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a security rule in the specified network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. +// securityRuleParameters - parameters supplied to the create or update network security rule operation. +func (client SecurityRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + securityRuleParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithJSON(securityRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (future SecurityRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (result SecurityRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified network security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. +func (client SecurityRulesClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) DeleteSender(req *http.Request) (future SecurityRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified network security rule. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +// securityRuleName - the name of the security rule. +func (client SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SecurityRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "securityRuleName": autorest.Encode("path", securityRuleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) GetResponder(resp *http.Response) (result SecurityRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all security rules in a network security group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkSecurityGroupName - the name of the network security group. +func (client SecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRulesClient.List") + defer func() { + sc := -1 + if result.srlr.Response.Response != nil { + sc = result.srlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.srlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request") + return + } + + result.srlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request") + return + } + if result.srlr.hasNextLink() && result.srlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SecurityRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SecurityRulesClient) ListResponder(resp *http.Response) (result SecurityRuleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SecurityRulesClient) listNextResults(ctx context.Context, lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { + req, err := lastResults.securityRuleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SecurityRulesClient) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SecurityRulesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkSecurityGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/serviceassociationlinks.go b/services/network/mgmt/2021-08-01/network/serviceassociationlinks.go new file mode 100644 index 000000000000..097a5f0e76d0 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/serviceassociationlinks.go @@ -0,0 +1,110 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceAssociationLinksClient is the network Client +type ServiceAssociationLinksClient struct { + BaseClient +} + +// NewServiceAssociationLinksClient creates an instance of the ServiceAssociationLinksClient client. +func NewServiceAssociationLinksClient(subscriptionID string) ServiceAssociationLinksClient { + return NewServiceAssociationLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceAssociationLinksClientWithBaseURI creates an instance of the ServiceAssociationLinksClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewServiceAssociationLinksClientWithBaseURI(baseURI string, subscriptionID string) ServiceAssociationLinksClient { + return ServiceAssociationLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of service association links for a subnet. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +func (client ServiceAssociationLinksClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result ServiceAssociationLinksListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceAssociationLinksClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceAssociationLinksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceAssociationLinksClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceAssociationLinksClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceAssociationLinksClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/ServiceAssociationLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceAssociationLinksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServiceAssociationLinksClient) ListResponder(resp *http.Response) (result ServiceAssociationLinksListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/serviceendpointpolicies.go b/services/network/mgmt/2021-08-01/network/serviceendpointpolicies.go new file mode 100644 index 000000000000..f894adbca990 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/serviceendpointpolicies.go @@ -0,0 +1,582 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceEndpointPoliciesClient is the network Client +type ServiceEndpointPoliciesClient struct { + BaseClient +} + +// NewServiceEndpointPoliciesClient creates an instance of the ServiceEndpointPoliciesClient client. +func NewServiceEndpointPoliciesClient(subscriptionID string) ServiceEndpointPoliciesClient { + return NewServiceEndpointPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceEndpointPoliciesClientWithBaseURI creates an instance of the ServiceEndpointPoliciesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewServiceEndpointPoliciesClientWithBaseURI(baseURI string, subscriptionID string) ServiceEndpointPoliciesClient { + return ServiceEndpointPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a service Endpoint Policies. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy. +// parameters - parameters supplied to the create or update service endpoint policy operation. +func (client ServiceEndpointPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy) (result ServiceEndpointPoliciesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceEndpointPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceEndpointPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters ServiceEndpointPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) CreateOrUpdateSender(req *http.Request) (future ServiceEndpointPoliciesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified service endpoint policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy. +func (client ServiceEndpointPoliciesClient) Delete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result ServiceEndpointPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceEndpointPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceEndpointPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) DeleteSender(req *http.Request) (future ServiceEndpointPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified service Endpoint Policies in a specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy. +// expand - expands referenced resources. +func (client ServiceEndpointPoliciesClient) Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, expand string) (result ServiceEndpointPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceEndpointPolicyName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceEndpointPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) GetResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the service endpoint policies in a subscription. +func (client ServiceEndpointPoliciesClient) List(ctx context.Context) (result ServiceEndpointPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.List") + defer func() { + sc := -1 + if result.seplr.Response.Response != nil { + sc = result.seplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.seplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", resp, "Failure sending request") + return + } + + result.seplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.seplr.hasNextLink() && result.seplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceEndpointPoliciesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ServiceEndpointPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) ListResponder(resp *http.Response) (result ServiceEndpointPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ServiceEndpointPoliciesClient) listNextResults(ctx context.Context, lastResults ServiceEndpointPolicyListResult) (result ServiceEndpointPolicyListResult, err error) { + req, err := lastResults.serviceEndpointPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceEndpointPoliciesClient) ListComplete(ctx context.Context) (result ServiceEndpointPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup gets all service endpoint Policies in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ServiceEndpointPoliciesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ServiceEndpointPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.seplr.Response.Response != nil { + sc = result.seplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.seplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.seplr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.seplr.hasNextLink() && result.seplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServiceEndpointPoliciesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceEndpointPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ServiceEndpointPoliciesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceEndpointPolicyListResult) (result ServiceEndpointPolicyListResult, err error) { + req, err := lastResults.serviceEndpointPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceEndpointPoliciesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ServiceEndpointPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates tags of a service endpoint policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy. +// parameters - parameters supplied to update service endpoint policy tags. +func (client ServiceEndpointPoliciesClient) UpdateTags(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject) (result ServiceEndpointPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPoliciesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, serviceEndpointPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPoliciesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ServiceEndpointPoliciesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPoliciesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPoliciesClient) UpdateTagsResponder(resp *http.Response) (result ServiceEndpointPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/serviceendpointpolicydefinitions.go b/services/network/mgmt/2021-08-01/network/serviceendpointpolicydefinitions.go new file mode 100644 index 000000000000..89eaa8bb537e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/serviceendpointpolicydefinitions.go @@ -0,0 +1,394 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceEndpointPolicyDefinitionsClient is the network Client +type ServiceEndpointPolicyDefinitionsClient struct { + BaseClient +} + +// NewServiceEndpointPolicyDefinitionsClient creates an instance of the ServiceEndpointPolicyDefinitionsClient client. +func NewServiceEndpointPolicyDefinitionsClient(subscriptionID string) ServiceEndpointPolicyDefinitionsClient { + return NewServiceEndpointPolicyDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceEndpointPolicyDefinitionsClientWithBaseURI creates an instance of the +// ServiceEndpointPolicyDefinitionsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewServiceEndpointPolicyDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) ServiceEndpointPolicyDefinitionsClient { + return ServiceEndpointPolicyDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a service endpoint policy definition in the specified service endpoint policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy. +// serviceEndpointPolicyDefinitionName - the name of the service endpoint policy definition name. +// serviceEndpointPolicyDefinitions - parameters supplied to the create or update service endpoint policy +// operation. +func (client ServiceEndpointPolicyDefinitionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition) (result ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName, serviceEndpointPolicyDefinitions) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ServiceEndpointPolicyDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string, serviceEndpointPolicyDefinitions ServiceEndpointPolicyDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyDefinitionName": autorest.Encode("path", serviceEndpointPolicyDefinitionName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + serviceEndpointPolicyDefinitions.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", pathParameters), + autorest.WithJSON(serviceEndpointPolicyDefinitions), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPolicyDefinitionsClient) CreateOrUpdateSender(req *http.Request) (future ServiceEndpointPolicyDefinitionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPolicyDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ServiceEndpointPolicyDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified ServiceEndpoint policy definitions. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the Service Endpoint Policy. +// serviceEndpointPolicyDefinitionName - the name of the service endpoint policy definition. +func (client ServiceEndpointPolicyDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (result ServiceEndpointPolicyDefinitionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ServiceEndpointPolicyDefinitionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyDefinitionName": autorest.Encode("path", serviceEndpointPolicyDefinitionName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPolicyDefinitionsClient) DeleteSender(req *http.Request) (future ServiceEndpointPolicyDefinitionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPolicyDefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get the specified service endpoint policy definitions from service endpoint policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy name. +// serviceEndpointPolicyDefinitionName - the name of the service endpoint policy definition name. +func (client ServiceEndpointPolicyDefinitionsClient) Get(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (result ServiceEndpointPolicyDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, serviceEndpointPolicyName, serviceEndpointPolicyDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServiceEndpointPolicyDefinitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string, serviceEndpointPolicyDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyDefinitionName": autorest.Encode("path", serviceEndpointPolicyDefinitionName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions/{serviceEndpointPolicyDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPolicyDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPolicyDefinitionsClient) GetResponder(resp *http.Response) (result ServiceEndpointPolicyDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByResourceGroup gets all service endpoint policy definitions in a service end point policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// serviceEndpointPolicyName - the name of the service endpoint policy name. +func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result ServiceEndpointPolicyDefinitionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.sepdlr.Response.Response != nil { + sc = result.sepdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, serviceEndpointPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.sepdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.sepdlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.sepdlr.hasNextLink() && result.sepdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "serviceEndpointPolicyName": autorest.Encode("path", serviceEndpointPolicyName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/serviceEndpointPolicies/{serviceEndpointPolicyName}/serviceEndpointPolicyDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ServiceEndpointPolicyDefinitionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ServiceEndpointPolicyDefinitionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ServiceEndpointPolicyDefinitionListResult) (result ServiceEndpointPolicyDefinitionListResult, err error) { + req, err := lastResults.serviceEndpointPolicyDefinitionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceEndpointPolicyDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceEndpointPolicyDefinitionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, serviceEndpointPolicyName string) (result ServiceEndpointPolicyDefinitionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceEndpointPolicyDefinitionsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, serviceEndpointPolicyName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/servicetaginformation.go b/services/network/mgmt/2021-08-01/network/servicetaginformation.go new file mode 100644 index 000000000000..43306797828f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/servicetaginformation.go @@ -0,0 +1,158 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceTagInformationClient is the network Client +type ServiceTagInformationClient struct { + BaseClient +} + +// NewServiceTagInformationClient creates an instance of the ServiceTagInformationClient client. +func NewServiceTagInformationClient(subscriptionID string) ServiceTagInformationClient { + return NewServiceTagInformationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceTagInformationClientWithBaseURI creates an instance of the ServiceTagInformationClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewServiceTagInformationClientWithBaseURI(baseURI string, subscriptionID string) ServiceTagInformationClient { + return ServiceTagInformationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of service tag information resources with pagination. +// Parameters: +// location - the location that will be used as a reference for cloud (not as a filter based on location, you +// will get the list of service tags with prefix details across all regions but limited to the cloud that your +// subscription belongs to). +// noAddressPrefixes - do not return address prefixes for the tag(s). +// tagName - return tag information for a particular tag. +func (client ServiceTagInformationClient) List(ctx context.Context, location string, noAddressPrefixes *bool, tagName string) (result ServiceTagInformationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationClient.List") + defer func() { + sc := -1 + if result.stilr.Response.Response != nil { + sc = result.stilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, noAddressPrefixes, tagName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.stilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "List", resp, "Failure sending request") + return + } + + result.stilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "List", resp, "Failure responding to request") + return + } + if result.stilr.hasNextLink() && result.stilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceTagInformationClient) ListPreparer(ctx context.Context, location string, noAddressPrefixes *bool, tagName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if noAddressPrefixes != nil { + queryParameters["noAddressPrefixes"] = autorest.Encode("query", *noAddressPrefixes) + } + if len(tagName) > 0 { + queryParameters["tagName"] = autorest.Encode("query", tagName) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTagDetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceTagInformationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServiceTagInformationClient) ListResponder(resp *http.Response) (result ServiceTagInformationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ServiceTagInformationClient) listNextResults(ctx context.Context, lastResults ServiceTagInformationListResult) (result ServiceTagInformationListResult, err error) { + req, err := lastResults.serviceTagInformationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceTagInformationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ServiceTagInformationClient) ListComplete(ctx context.Context, location string, noAddressPrefixes *bool, tagName string) (result ServiceTagInformationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagInformationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, noAddressPrefixes, tagName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/servicetags.go b/services/network/mgmt/2021-08-01/network/servicetags.go new file mode 100644 index 000000000000..7f04ce556e1b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/servicetags.go @@ -0,0 +1,107 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServiceTagsClient is the network Client +type ServiceTagsClient struct { + BaseClient +} + +// NewServiceTagsClient creates an instance of the ServiceTagsClient client. +func NewServiceTagsClient(subscriptionID string) ServiceTagsClient { + return NewServiceTagsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServiceTagsClientWithBaseURI creates an instance of the ServiceTagsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewServiceTagsClientWithBaseURI(baseURI string, subscriptionID string) ServiceTagsClient { + return ServiceTagsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets a list of service tag information resources. +// Parameters: +// location - the location that will be used as a reference for version (not as a filter based on location, you +// will get the list of service tags with prefix details across all regions but limited to the cloud that your +// subscription belongs to). +func (client ServiceTagsClient) List(ctx context.Context, location string) (result ServiceTagsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServiceTagsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceTagsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.ServiceTagsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.ServiceTagsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ServiceTagsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/serviceTags", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceTagsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ServiceTagsClient) ListResponder(resp *http.Response) (result ServiceTagsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/subnets.go b/services/network/mgmt/2021-08-01/network/subnets.go new file mode 100644 index 000000000000..fa4f18c83c7b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/subnets.go @@ -0,0 +1,564 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SubnetsClient is the network Client +type SubnetsClient struct { + BaseClient +} + +// NewSubnetsClient creates an instance of the SubnetsClient client. +func NewSubnetsClient(subscriptionID string) SubnetsClient { + return NewSubnetsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubnetsClientWithBaseURI creates an instance of the SubnetsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsClient { + return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a subnet in the specified virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// subnetParameters - parameters supplied to the create or update subnet operation. +func (client SubnetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (result SubnetsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + subnetParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithJSON(subnetParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (future SubnetsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result Subnet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified subnet. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +func (client SubnetsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result SubnetsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) DeleteSender(req *http.Request) (future SubnetsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified subnet by virtual network and resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// expand - expands referenced resources. +func (client SubnetsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubnetsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all subnets in a virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client SubnetsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result SubnetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SubnetsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SubnetsClient) listNextResults(ctx context.Context, lastResults SubnetListResult) (result SubnetListResult, err error) { + req, err := lastResults.subnetListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubnetsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result SubnetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualNetworkName) + return +} + +// PrepareNetworkPolicies prepares a subnet by applying network intent policies. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// prepareNetworkPoliciesRequestParameters - parameters supplied to prepare subnet by applying network intent +// policies. +func (client SubnetsClient) PrepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest) (result SubnetsPrepareNetworkPoliciesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.PrepareNetworkPolicies") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PrepareNetworkPoliciesPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "PrepareNetworkPolicies", nil, "Failure preparing request") + return + } + + result, err = client.PrepareNetworkPoliciesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "PrepareNetworkPolicies", result.Response(), "Failure sending request") + return + } + + return +} + +// PrepareNetworkPoliciesPreparer prepares the PrepareNetworkPolicies request. +func (client SubnetsClient) PrepareNetworkPoliciesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, prepareNetworkPoliciesRequestParameters PrepareNetworkPoliciesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-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/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/PrepareNetworkPolicies", pathParameters), + autorest.WithJSON(prepareNetworkPoliciesRequestParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PrepareNetworkPoliciesSender sends the PrepareNetworkPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) PrepareNetworkPoliciesSender(req *http.Request) (future SubnetsPrepareNetworkPoliciesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PrepareNetworkPoliciesResponder handles the response to the PrepareNetworkPolicies request. The method always +// closes the http.Response Body. +func (client SubnetsClient) PrepareNetworkPoliciesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// UnprepareNetworkPolicies unprepares a subnet by removing network intent policies. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// subnetName - the name of the subnet. +// unprepareNetworkPoliciesRequestParameters - parameters supplied to unprepare subnet to remove network intent +// policies. +func (client SubnetsClient) UnprepareNetworkPolicies(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest) (result SubnetsUnprepareNetworkPoliciesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubnetsClient.UnprepareNetworkPolicies") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UnprepareNetworkPoliciesPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "UnprepareNetworkPolicies", nil, "Failure preparing request") + return + } + + result, err = client.UnprepareNetworkPoliciesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.SubnetsClient", "UnprepareNetworkPolicies", result.Response(), "Failure sending request") + return + } + + return +} + +// UnprepareNetworkPoliciesPreparer prepares the UnprepareNetworkPolicies request. +func (client SubnetsClient) UnprepareNetworkPoliciesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, unprepareNetworkPoliciesRequestParameters UnprepareNetworkPoliciesRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subnetName": autorest.Encode("path", subnetName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-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/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies", pathParameters), + autorest.WithJSON(unprepareNetworkPoliciesRequestParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UnprepareNetworkPoliciesSender sends the UnprepareNetworkPolicies request. The method will close the +// http.Response Body if it receives an error. +func (client SubnetsClient) UnprepareNetworkPoliciesSender(req *http.Request) (future SubnetsUnprepareNetworkPoliciesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UnprepareNetworkPoliciesResponder handles the response to the UnprepareNetworkPolicies request. The method always +// closes the http.Response Body. +func (client SubnetsClient) UnprepareNetworkPoliciesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/network/mgmt/2021-08-01/network/usages.go b/services/network/mgmt/2021-08-01/network/usages.go new file mode 100644 index 000000000000..f3a9b82cc598 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/usages.go @@ -0,0 +1,154 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// UsagesClient is the network Client +type UsagesClient struct { + BaseClient +} + +// NewUsagesClient creates an instance of the UsagesClient client. +func NewUsagesClient(subscriptionID string) UsagesClient { + return NewUsagesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsagesClientWithBaseURI creates an instance of the UsagesClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesClient { + return UsagesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list network usages for a subscription. +// Parameters: +// location - the location where resource usage is queried. +func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.ulr.Response.Response != nil { + sc = result.ulr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._ ]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.UsagesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ulr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") + return + } + + result.ulr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") + return + } + if result.ulr.hasNextLink() && result.ulr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client UsagesClient) listNextResults(ctx context.Context, lastResults UsagesListResult) (result UsagesListResult, err error) { + req, err := lastResults.usagesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsagesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsagesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/network/mgmt/2021-08-01/network/version.go b/services/network/mgmt/2021-08-01/network/version.go new file mode 100644 index 000000000000..5f7329994a00 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/version.go @@ -0,0 +1,19 @@ +package network + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " network/2021-08-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/network/mgmt/2021-08-01/network/virtualappliances.go b/services/network/mgmt/2021-08-01/network/virtualappliances.go new file mode 100644 index 000000000000..fd8e6a55a7a2 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualappliances.go @@ -0,0 +1,593 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualAppliancesClient is the network Client +type VirtualAppliancesClient struct { + BaseClient +} + +// NewVirtualAppliancesClient creates an instance of the VirtualAppliancesClient client. +func NewVirtualAppliancesClient(subscriptionID string) VirtualAppliancesClient { + return NewVirtualAppliancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualAppliancesClientWithBaseURI creates an instance of the VirtualAppliancesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewVirtualAppliancesClientWithBaseURI(baseURI string, subscriptionID string) VirtualAppliancesClient { + return VirtualAppliancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Network Virtual Appliance. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of Network Virtual Appliance. +// parameters - parameters supplied to the create or update Network Virtual Appliance. +func (client VirtualAppliancesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance) (result VirtualAppliancesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualAppliancePropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualAppliancePropertiesFormat.VirtualApplianceAsn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualAppliancePropertiesFormat.VirtualApplianceAsn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualAppliancePropertiesFormat.VirtualApplianceAsn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualAppliancesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkVirtualApplianceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualAppliancesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters VirtualAppliance) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) CreateOrUpdateSender(req *http.Request) (future VirtualAppliancesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualAppliance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Network Virtual Appliance. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of Network Virtual Appliance. +func (client VirtualAppliancesClient) Delete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result VirtualAppliancesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkVirtualApplianceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualAppliancesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) DeleteSender(req *http.Request) (future VirtualAppliancesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Network Virtual Appliance. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of Network Virtual Appliance. +// expand - expands referenced resources. +func (client VirtualAppliancesClient) Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, expand string) (result VirtualAppliance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkVirtualApplianceName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualAppliancesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) GetResponder(resp *http.Response) (result VirtualAppliance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all Network Virtual Appliances in a subscription. +func (client VirtualAppliancesClient) List(ctx context.Context) (result VirtualApplianceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.List") + defer func() { + sc := -1 + if result.valr.Response.Response != nil { + sc = result.valr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.valr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "List", resp, "Failure sending request") + return + } + + result.valr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "List", resp, "Failure responding to request") + return + } + if result.valr.hasNextLink() && result.valr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualAppliancesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualAppliances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) ListResponder(resp *http.Response) (result VirtualApplianceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualAppliancesClient) listNextResults(ctx context.Context, lastResults VirtualApplianceListResult) (result VirtualApplianceListResult, err error) { + req, err := lastResults.virtualApplianceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualAppliancesClient) ListComplete(ctx context.Context) (result VirtualApplianceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all Network Virtual Appliances in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualAppliancesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualApplianceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.valr.Response.Response != nil { + sc = result.valr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.valr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.valr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.valr.hasNextLink() && result.valr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualAppliancesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualApplianceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualAppliancesClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualApplianceListResult) (result VirtualApplianceListResult, err error) { + req, err := lastResults.virtualApplianceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualAppliancesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualApplianceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates a Network Virtual Appliance. +// Parameters: +// resourceGroupName - the resource group name of Network Virtual Appliance. +// networkVirtualApplianceName - the name of Network Virtual Appliance being updated. +// parameters - parameters supplied to Update Network Virtual Appliance Tags. +func (client VirtualAppliancesClient) UpdateTags(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters TagsObject) (result VirtualAppliance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualAppliancesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkVirtualApplianceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualAppliancesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualAppliancesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualAppliancesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualAppliancesClient) UpdateTagsResponder(resp *http.Response) (result VirtualAppliance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualappliancesites.go b/services/network/mgmt/2021-08-01/network/virtualappliancesites.go new file mode 100644 index 000000000000..932a0a5f7fe3 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualappliancesites.go @@ -0,0 +1,394 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualApplianceSitesClient is the network Client +type VirtualApplianceSitesClient struct { + BaseClient +} + +// NewVirtualApplianceSitesClient creates an instance of the VirtualApplianceSitesClient client. +func NewVirtualApplianceSitesClient(subscriptionID string) VirtualApplianceSitesClient { + return NewVirtualApplianceSitesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualApplianceSitesClientWithBaseURI creates an instance of the VirtualApplianceSitesClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualApplianceSitesClientWithBaseURI(baseURI string, subscriptionID string) VirtualApplianceSitesClient { + return VirtualApplianceSitesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Network Virtual Appliance Site. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of the Network Virtual Appliance. +// siteName - the name of the site. +// parameters - parameters supplied to the create or update Network Virtual Appliance Site operation. +func (client VirtualApplianceSitesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite) (result VirtualApplianceSitesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSitesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkVirtualApplianceName, siteName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualApplianceSitesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string, parameters VirtualApplianceSite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSitesClient) CreateOrUpdateSender(req *http.Request) (future VirtualApplianceSitesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSitesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualApplianceSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified site from a Virtual Appliance. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of the Network Virtual Appliance. +// siteName - the name of the site. +func (client VirtualApplianceSitesClient) Delete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (result VirtualApplianceSitesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSitesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkVirtualApplianceName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualApplianceSitesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSitesClient) DeleteSender(req *http.Request) (future VirtualApplianceSitesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSitesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Virtual Appliance Site. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of the Network Virtual Appliance. +// siteName - the name of the site. +func (client VirtualApplianceSitesClient) Get(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (result VirtualApplianceSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSitesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkVirtualApplianceName, siteName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualApplianceSitesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string, siteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "siteName": autorest.Encode("path", siteName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites/{siteName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSitesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSitesClient) GetResponder(resp *http.Response) (result VirtualApplianceSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Network Virtual Appliance Sites in a Network Virtual Appliance resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkVirtualApplianceName - the name of the Network Virtual Appliance. +func (client VirtualApplianceSitesClient) List(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result VirtualApplianceSiteListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSitesClient.List") + defer func() { + sc := -1 + if result.vaslr.Response.Response != nil { + sc = result.vaslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, networkVirtualApplianceName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vaslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "List", resp, "Failure sending request") + return + } + + result.vaslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "List", resp, "Failure responding to request") + return + } + if result.vaslr.hasNextLink() && result.vaslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualApplianceSitesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "networkVirtualApplianceName": autorest.Encode("path", networkVirtualApplianceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkVirtualAppliances/{networkVirtualApplianceName}/virtualApplianceSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSitesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSitesClient) ListResponder(resp *http.Response) (result VirtualApplianceSiteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualApplianceSitesClient) listNextResults(ctx context.Context, lastResults VirtualApplianceSiteListResult) (result VirtualApplianceSiteListResult, err error) { + req, err := lastResults.virtualApplianceSiteListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSitesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualApplianceSitesClient) ListComplete(ctx context.Context, resourceGroupName string, networkVirtualApplianceName string) (result VirtualApplianceSiteListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSitesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, networkVirtualApplianceName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualapplianceskus.go b/services/network/mgmt/2021-08-01/network/virtualapplianceskus.go new file mode 100644 index 000000000000..7cb46dfa72b2 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualapplianceskus.go @@ -0,0 +1,219 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualApplianceSkusClient is the network Client +type VirtualApplianceSkusClient struct { + BaseClient +} + +// NewVirtualApplianceSkusClient creates an instance of the VirtualApplianceSkusClient client. +func NewVirtualApplianceSkusClient(subscriptionID string) VirtualApplianceSkusClient { + return NewVirtualApplianceSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualApplianceSkusClientWithBaseURI creates an instance of the VirtualApplianceSkusClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewVirtualApplianceSkusClientWithBaseURI(baseURI string, subscriptionID string) VirtualApplianceSkusClient { + return VirtualApplianceSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves a single available sku for network virtual appliance. +// Parameters: +// skuName - name of the Sku. +func (client VirtualApplianceSkusClient) Get(ctx context.Context, skuName string) (result VirtualApplianceSku, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, skuName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualApplianceSkusClient) GetPreparer(ctx context.Context, skuName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "skuName": autorest.Encode("path", skuName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus/{skuName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSkusClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSkusClient) GetResponder(resp *http.Response) (result VirtualApplianceSku, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all SKUs available for a virtual appliance. +func (client VirtualApplianceSkusClient) List(ctx context.Context) (result VirtualApplianceSkuListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkusClient.List") + defer func() { + sc := -1 + if result.vaslr.Response.Response != nil { + sc = result.vaslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vaslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "List", resp, "Failure sending request") + return + } + + result.vaslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "List", resp, "Failure responding to request") + return + } + if result.vaslr.hasNextLink() && result.vaslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualApplianceSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkVirtualApplianceSkus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualApplianceSkusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualApplianceSkusClient) ListResponder(resp *http.Response) (result VirtualApplianceSkuListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualApplianceSkusClient) listNextResults(ctx context.Context, lastResults VirtualApplianceSkuListResult) (result VirtualApplianceSkuListResult, err error) { + req, err := lastResults.virtualApplianceSkuListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualApplianceSkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualApplianceSkusClient) ListComplete(ctx context.Context) (result VirtualApplianceSkuListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualApplianceSkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualhubbgpconnection.go b/services/network/mgmt/2021-08-01/network/virtualhubbgpconnection.go new file mode 100644 index 000000000000..f46aaa5c60bc --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualhubbgpconnection.go @@ -0,0 +1,289 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualHubBgpConnectionClient is the network Client +type VirtualHubBgpConnectionClient struct { + BaseClient +} + +// NewVirtualHubBgpConnectionClient creates an instance of the VirtualHubBgpConnectionClient client. +func NewVirtualHubBgpConnectionClient(subscriptionID string) VirtualHubBgpConnectionClient { + return NewVirtualHubBgpConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualHubBgpConnectionClientWithBaseURI creates an instance of the VirtualHubBgpConnectionClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualHubBgpConnectionClientWithBaseURI(baseURI string, subscriptionID string) VirtualHubBgpConnectionClient { + return VirtualHubBgpConnectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing +// VirtualHubBgpConnection. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the connection. +// parameters - parameters of Bgp connection. +func (client VirtualHubBgpConnectionClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection) (result VirtualHubBgpConnectionCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BgpConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BgpConnectionProperties.PeerAsn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.BgpConnectionProperties.PeerAsn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.BgpConnectionProperties.PeerAsn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualHubBgpConnectionClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, connectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualHubBgpConnectionClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string, parameters BgpConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionClient) CreateOrUpdateSender(req *http.Request) (future VirtualHubBgpConnectionCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionClient) CreateOrUpdateResponder(resp *http.Response) (result BgpConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VirtualHubBgpConnection. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHubBgpConnection. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the connection. +func (client VirtualHubBgpConnectionClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result VirtualHubBgpConnectionDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualHubBgpConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionClient) DeleteSender(req *http.Request) (future VirtualHubBgpConnectionDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a Virtual Hub Bgp Connection. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// connectionName - the name of the connection. +func (client VirtualHubBgpConnectionClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (result BgpConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualHubBgpConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionClient) GetResponder(resp *http.Response) (result BgpConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualhubbgpconnections.go b/services/network/mgmt/2021-08-01/network/virtualhubbgpconnections.go new file mode 100644 index 000000000000..b6aae280990d --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualhubbgpconnections.go @@ -0,0 +1,312 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualHubBgpConnectionsClient is the network Client +type VirtualHubBgpConnectionsClient struct { + BaseClient +} + +// NewVirtualHubBgpConnectionsClient creates an instance of the VirtualHubBgpConnectionsClient client. +func NewVirtualHubBgpConnectionsClient(subscriptionID string) VirtualHubBgpConnectionsClient { + return NewVirtualHubBgpConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualHubBgpConnectionsClientWithBaseURI creates an instance of the VirtualHubBgpConnectionsClient client using +// a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewVirtualHubBgpConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualHubBgpConnectionsClient { + return VirtualHubBgpConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List retrieves the details of all VirtualHubBgpConnections. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client VirtualHubBgpConnectionsClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubBgpConnectionResultsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionsClient.List") + defer func() { + sc := -1 + if result.lvhbcr.Response.Response != nil { + sc = result.lvhbcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvhbcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.lvhbcr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.lvhbcr.hasNextLink() && result.lvhbcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualHubBgpConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/bgpConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionsClient) ListResponder(resp *http.Response) (result ListVirtualHubBgpConnectionResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualHubBgpConnectionsClient) listNextResults(ctx context.Context, lastResults ListVirtualHubBgpConnectionResults) (result ListVirtualHubBgpConnectionResults, err error) { + req, err := lastResults.listVirtualHubBgpConnectionResultsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualHubBgpConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubBgpConnectionResultsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} + +// ListAdvertisedRoutes retrieves a list of routes the virtual hub bgp connection is advertising to the specified peer. +// Parameters: +// resourceGroupName - the name of the resource group. +// hubName - the name of the virtual hub. +// connectionName - the name of the virtual hub bgp connection. +func (client VirtualHubBgpConnectionsClient) ListAdvertisedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (result VirtualHubBgpConnectionsListAdvertisedRoutesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionsClient.ListAdvertisedRoutes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAdvertisedRoutesPreparer(ctx, resourceGroupName, hubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "ListAdvertisedRoutes", nil, "Failure preparing request") + return + } + + result, err = client.ListAdvertisedRoutesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "ListAdvertisedRoutes", result.Response(), "Failure sending request") + return + } + + return +} + +// ListAdvertisedRoutesPreparer prepares the ListAdvertisedRoutes request. +func (client VirtualHubBgpConnectionsClient) ListAdvertisedRoutesPreparer(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/advertisedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAdvertisedRoutesSender sends the ListAdvertisedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionsClient) ListAdvertisedRoutesSender(req *http.Request) (future VirtualHubBgpConnectionsListAdvertisedRoutesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListAdvertisedRoutesResponder handles the response to the ListAdvertisedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionsClient) ListAdvertisedRoutesResponder(resp *http.Response) (result PeerRouteList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListLearnedRoutes retrieves a list of routes the virtual hub bgp connection has learned. +// Parameters: +// resourceGroupName - the name of the resource group. +// hubName - the name of the virtual hub. +// connectionName - the name of the virtual hub bgp connection. +func (client VirtualHubBgpConnectionsClient) ListLearnedRoutes(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (result VirtualHubBgpConnectionsListLearnedRoutesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubBgpConnectionsClient.ListLearnedRoutes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListLearnedRoutesPreparer(ctx, resourceGroupName, hubName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "ListLearnedRoutes", nil, "Failure preparing request") + return + } + + result, err = client.ListLearnedRoutesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubBgpConnectionsClient", "ListLearnedRoutes", result.Response(), "Failure sending request") + return + } + + return +} + +// ListLearnedRoutesPreparer prepares the ListLearnedRoutes request. +func (client VirtualHubBgpConnectionsClient) ListLearnedRoutesPreparer(ctx context.Context, resourceGroupName string, hubName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "hubName": autorest.Encode("path", hubName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{hubName}/bgpConnections/{connectionName}/learnedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListLearnedRoutesSender sends the ListLearnedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubBgpConnectionsClient) ListLearnedRoutesSender(req *http.Request) (future VirtualHubBgpConnectionsListLearnedRoutesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListLearnedRoutesResponder handles the response to the ListLearnedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualHubBgpConnectionsClient) ListLearnedRoutesResponder(resp *http.Response) (result PeerRouteList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualhubipconfiguration.go b/services/network/mgmt/2021-08-01/network/virtualhubipconfiguration.go new file mode 100644 index 000000000000..9d283a6e4fe9 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualhubipconfiguration.go @@ -0,0 +1,413 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualHubIPConfigurationClient is the network Client +type VirtualHubIPConfigurationClient struct { + BaseClient +} + +// NewVirtualHubIPConfigurationClient creates an instance of the VirtualHubIPConfigurationClient client. +func NewVirtualHubIPConfigurationClient(subscriptionID string) VirtualHubIPConfigurationClient { + return NewVirtualHubIPConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualHubIPConfigurationClientWithBaseURI creates an instance of the VirtualHubIPConfigurationClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewVirtualHubIPConfigurationClientWithBaseURI(baseURI string, subscriptionID string) VirtualHubIPConfigurationClient { + return VirtualHubIPConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing +// VirtualHubIpConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// IPConfigName - the name of the ipconfig. +// parameters - hub Ip Configuration parameters. +func (client VirtualHubIPConfigurationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string, parameters HubIPConfiguration) (result VirtualHubIPConfigurationCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubIPConfigurationClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "parameters.HubIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualHubIPConfigurationClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, IPConfigName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualHubIPConfigurationClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string, parameters HubIPConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigName": autorest.Encode("path", IPConfigName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubIPConfigurationClient) CreateOrUpdateSender(req *http.Request) (future VirtualHubIPConfigurationCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualHubIPConfigurationClient) CreateOrUpdateResponder(resp *http.Response) (result HubIPConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VirtualHubIpConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHubBgpConnection. +// virtualHubName - the name of the VirtualHub. +// IPConfigName - the name of the ipconfig. +func (client VirtualHubIPConfigurationClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (result VirtualHubIPConfigurationDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubIPConfigurationClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, IPConfigName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualHubIPConfigurationClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigName": autorest.Encode("path", IPConfigName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubIPConfigurationClient) DeleteSender(req *http.Request) (future VirtualHubIPConfigurationDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualHubIPConfigurationClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a Virtual Hub Ip configuration. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// IPConfigName - the name of the ipconfig. +func (client VirtualHubIPConfigurationClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (result HubIPConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubIPConfigurationClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, IPConfigName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualHubIPConfigurationClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, IPConfigName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ipConfigName": autorest.Encode("path", IPConfigName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations/{ipConfigName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubIPConfigurationClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualHubIPConfigurationClient) GetResponder(resp *http.Response) (result HubIPConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the details of all VirtualHubIpConfigurations. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client VirtualHubIPConfigurationClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubIPConfigurationResultsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubIPConfigurationClient.List") + defer func() { + sc := -1 + if result.lvhicr.Response.Response != nil { + sc = result.lvhicr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvhicr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "List", resp, "Failure sending request") + return + } + + result.lvhicr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "List", resp, "Failure responding to request") + return + } + if result.lvhicr.hasNextLink() && result.lvhicr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualHubIPConfigurationClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/ipConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubIPConfigurationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualHubIPConfigurationClient) ListResponder(resp *http.Response) (result ListVirtualHubIPConfigurationResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualHubIPConfigurationClient) listNextResults(ctx context.Context, lastResults ListVirtualHubIPConfigurationResults) (result ListVirtualHubIPConfigurationResults, err error) { + req, err := lastResults.listVirtualHubIPConfigurationResultsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubIPConfigurationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualHubIPConfigurationClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubIPConfigurationResultsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubIPConfigurationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualhubroutetablev2s.go b/services/network/mgmt/2021-08-01/network/virtualhubroutetablev2s.go new file mode 100644 index 000000000000..85d1612d3dda --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualhubroutetablev2s.go @@ -0,0 +1,394 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualHubRouteTableV2sClient is the network Client +type VirtualHubRouteTableV2sClient struct { + BaseClient +} + +// NewVirtualHubRouteTableV2sClient creates an instance of the VirtualHubRouteTableV2sClient client. +func NewVirtualHubRouteTableV2sClient(subscriptionID string) VirtualHubRouteTableV2sClient { + return NewVirtualHubRouteTableV2sClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualHubRouteTableV2sClientWithBaseURI creates an instance of the VirtualHubRouteTableV2sClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualHubRouteTableV2sClientWithBaseURI(baseURI string, subscriptionID string) VirtualHubRouteTableV2sClient { + return VirtualHubRouteTableV2sClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing +// VirtualHubRouteTableV2. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the VirtualHubRouteTableV2. +// virtualHubRouteTableV2Parameters - parameters supplied to create or update VirtualHubRouteTableV2. +func (client VirtualHubRouteTableV2sClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2) (result VirtualHubRouteTableV2sCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubRouteTableV2sClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, routeTableName, virtualHubRouteTableV2Parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualHubRouteTableV2sClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string, virtualHubRouteTableV2Parameters VirtualHubRouteTableV2) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + virtualHubRouteTableV2Parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", pathParameters), + autorest.WithJSON(virtualHubRouteTableV2Parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubRouteTableV2sClient) CreateOrUpdateSender(req *http.Request) (future VirtualHubRouteTableV2sCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualHubRouteTableV2sClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualHubRouteTableV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VirtualHubRouteTableV2. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHubRouteTableV2. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the VirtualHubRouteTableV2. +func (client VirtualHubRouteTableV2sClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result VirtualHubRouteTableV2sDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubRouteTableV2sClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualHubRouteTableV2sClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubRouteTableV2sClient) DeleteSender(req *http.Request) (future VirtualHubRouteTableV2sDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualHubRouteTableV2sClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a VirtualHubRouteTableV2. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHubRouteTableV2. +// virtualHubName - the name of the VirtualHub. +// routeTableName - the name of the VirtualHubRouteTableV2. +func (client VirtualHubRouteTableV2sClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (result VirtualHubRouteTableV2, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubRouteTableV2sClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName, routeTableName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualHubRouteTableV2sClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, routeTableName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "routeTableName": autorest.Encode("path", routeTableName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables/{routeTableName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubRouteTableV2sClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualHubRouteTableV2sClient) GetResponder(resp *http.Response) (result VirtualHubRouteTableV2, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List retrieves the details of all VirtualHubRouteTableV2s. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client VirtualHubRouteTableV2sClient) List(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubRouteTableV2sResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubRouteTableV2sClient.List") + defer func() { + sc := -1 + if result.lvhrtvr.Response.Response != nil { + sc = result.lvhrtvr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvhrtvr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "List", resp, "Failure sending request") + return + } + + result.lvhrtvr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "List", resp, "Failure responding to request") + return + } + if result.lvhrtvr.hasNextLink() && result.lvhrtvr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualHubRouteTableV2sClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routeTables", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubRouteTableV2sClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualHubRouteTableV2sClient) ListResponder(resp *http.Response) (result ListVirtualHubRouteTableV2sResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualHubRouteTableV2sClient) listNextResults(ctx context.Context, lastResults ListVirtualHubRouteTableV2sResult) (result ListVirtualHubRouteTableV2sResult, err error) { + req, err := lastResults.listVirtualHubRouteTableV2sResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubRouteTableV2sClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualHubRouteTableV2sClient) ListComplete(ctx context.Context, resourceGroupName string, virtualHubName string) (result ListVirtualHubRouteTableV2sResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubRouteTableV2sClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualHubName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualhubs.go b/services/network/mgmt/2021-08-01/network/virtualhubs.go new file mode 100644 index 000000000000..8bae5f0ca7c5 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualhubs.go @@ -0,0 +1,674 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualHubsClient is the network Client +type VirtualHubsClient struct { + BaseClient +} + +// NewVirtualHubsClient creates an instance of the VirtualHubsClient client. +func NewVirtualHubsClient(subscriptionID string) VirtualHubsClient { + return NewVirtualHubsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualHubsClientWithBaseURI creates an instance of the VirtualHubsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualHubsClientWithBaseURI(baseURI string, subscriptionID string) VirtualHubsClient { + return VirtualHubsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// virtualHubParameters - parameters supplied to create or update VirtualHub. +func (client VirtualHubsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub) (result VirtualHubsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: virtualHubParameters, + Constraints: []validation.Constraint{{Target: "virtualHubParameters.VirtualHubProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualHubParameters.VirtualHubProperties.VirtualRouterAsn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualHubParameters.VirtualHubProperties.VirtualRouterAsn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "virtualHubParameters.VirtualHubProperties.VirtualRouterAsn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualHubsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualHubName, virtualHubParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualHubsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters VirtualHub) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + virtualHubParameters.Etag = nil + virtualHubParameters.Kind = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", pathParameters), + autorest.WithJSON(virtualHubParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) CreateOrUpdateSender(req *http.Request) (future VirtualHubsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualHub, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VirtualHub. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client VirtualHubsClient) Delete(ctx context.Context, resourceGroupName string, virtualHubName string) (result VirtualHubsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualHubsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) DeleteSender(req *http.Request) (future VirtualHubsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a VirtualHub. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +func (client VirtualHubsClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string) (result VirtualHub, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualHubName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualHubsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualHubName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) GetResponder(resp *http.Response) (result VirtualHub, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetEffectiveVirtualHubRoutes gets the effective routes configured for the Virtual Hub resource or the specified +// resource . +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// effectiveRoutesParameters - parameters supplied to get the effective routes for a specific resource. +func (client VirtualHubsClient) GetEffectiveVirtualHubRoutes(ctx context.Context, resourceGroupName string, virtualHubName string, effectiveRoutesParameters *EffectiveRoutesParameters) (result VirtualHubsGetEffectiveVirtualHubRoutesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.GetEffectiveVirtualHubRoutes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetEffectiveVirtualHubRoutesPreparer(ctx, resourceGroupName, virtualHubName, effectiveRoutesParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "GetEffectiveVirtualHubRoutes", nil, "Failure preparing request") + return + } + + result, err = client.GetEffectiveVirtualHubRoutesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "GetEffectiveVirtualHubRoutes", result.Response(), "Failure sending request") + return + } + + return +} + +// GetEffectiveVirtualHubRoutesPreparer prepares the GetEffectiveVirtualHubRoutes request. +func (client VirtualHubsClient) GetEffectiveVirtualHubRoutesPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, effectiveRoutesParameters *EffectiveRoutesParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-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/virtualHubs/{virtualHubName}/effectiveRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if effectiveRoutesParameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(effectiveRoutesParameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetEffectiveVirtualHubRoutesSender sends the GetEffectiveVirtualHubRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) GetEffectiveVirtualHubRoutesSender(req *http.Request) (future VirtualHubsGetEffectiveVirtualHubRoutesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetEffectiveVirtualHubRoutesResponder handles the response to the GetEffectiveVirtualHubRoutes request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) GetEffectiveVirtualHubRoutesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// List lists all the VirtualHubs in a subscription. +func (client VirtualHubsClient) List(ctx context.Context) (result ListVirtualHubsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.List") + defer func() { + sc := -1 + if result.lvhr.Response.Response != nil { + sc = result.lvhr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvhr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "List", resp, "Failure sending request") + return + } + + result.lvhr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "List", resp, "Failure responding to request") + return + } + if result.lvhr.hasNextLink() && result.lvhr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualHubsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) ListResponder(resp *http.Response) (result ListVirtualHubsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualHubsClient) listNextResults(ctx context.Context, lastResults ListVirtualHubsResult) (result ListVirtualHubsResult, err error) { + req, err := lastResults.listVirtualHubsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualHubsClient) ListComplete(ctx context.Context) (result ListVirtualHubsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the VirtualHubs in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +func (client VirtualHubsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListVirtualHubsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lvhr.Response.Response != nil { + sc = result.lvhr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lvhr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lvhr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lvhr.hasNextLink() && result.lvhr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualHubsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) ListByResourceGroupResponder(resp *http.Response) (result ListVirtualHubsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualHubsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListVirtualHubsResult) (result ListVirtualHubsResult, err error) { + req, err := lastResults.listVirtualHubsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualHubsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListVirtualHubsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates VirtualHub tags. +// Parameters: +// resourceGroupName - the resource group name of the VirtualHub. +// virtualHubName - the name of the VirtualHub. +// virtualHubParameters - parameters supplied to update VirtualHub tags. +func (client VirtualHubsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters TagsObject) (result VirtualHub, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualHubsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualHubName, virtualHubParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualHubsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualHubsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualHubName string, virtualHubParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualHubName": autorest.Encode("path", virtualHubName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}", pathParameters), + autorest.WithJSON(virtualHubParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualHubsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualHubsClient) UpdateTagsResponder(resp *http.Response) (result VirtualHub, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworkgatewayconnections.go b/services/network/mgmt/2021-08-01/network/virtualnetworkgatewayconnections.go new file mode 100644 index 000000000000..578c03827347 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworkgatewayconnections.go @@ -0,0 +1,1095 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkGatewayConnectionsClient is the network Client +type VirtualNetworkGatewayConnectionsClient struct { + BaseClient +} + +// NewVirtualNetworkGatewayConnectionsClient creates an instance of the VirtualNetworkGatewayConnectionsClient client. +func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string) VirtualNetworkGatewayConnectionsClient { + return NewVirtualNetworkGatewayConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkGatewayConnectionsClientWithBaseURI creates an instance of the +// VirtualNetworkGatewayConnectionsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayConnectionsClient { + return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +// parameters - parameters supplied to the create or update virtual network gateway connection operation. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway1.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.VirtualNetworkGateway2.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network Gateway connection. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network gateway connection by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetIkeSas lists IKE Security Associations for the virtual network gateway connection in the specified resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. +func (client VirtualNetworkGatewayConnectionsClient) GetIkeSas(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsGetIkeSasFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.GetIkeSas") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetIkeSasPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetIkeSas", nil, "Failure preparing request") + return + } + + result, err = client.GetIkeSasSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetIkeSas", result.Response(), "Failure sending request") + return + } + + return +} + +// GetIkeSasPreparer prepares the GetIkeSas request. +func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/getikesas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIkeSasSender sends the GetIkeSas request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasSender(req *http.Request) (future VirtualNetworkGatewayConnectionsGetIkeSasFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetIkeSasResponder handles the response to the GetIkeSas request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) GetIkeSasResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetSharedKey the Get VirtualNetworkGatewayConnectionSharedKey operation retrieves information about the specified +// virtual network gateway connection shared key through Network resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection shared key name. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.GetSharedKey") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request") + return + } + + resp, err := client.GetSharedKeySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure sending request") + return + } + + result, err = client.GetSharedKeyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", resp, "Failure responding to request") + return + } + + return +} + +// GetSharedKeyPreparer prepares the GetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSharedKeySender sends the GetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetSharedKeyResponder handles the response to the GetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List VirtualNetworkGatewayConnections operation retrieves all the virtual network gateways connections +// created. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualNetworkGatewayConnectionsClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.List") + defer func() { + sc := -1 + if result.vngclr.Response.Response != nil { + sc = result.vngclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vngclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.vngclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.vngclr.hasNextLink() && result.vngclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewayConnectionsClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { + req, err := lastResults.virtualNetworkGatewayConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkGatewayConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ResetConnection resets the virtual network gateway connection specified. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. +func (client VirtualNetworkGatewayConnectionsClient) ResetConnection(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsResetConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.ResetConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetConnectionPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetConnection", nil, "Failure preparing request") + return + } + + result, err = client.ResetConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetConnectionPreparer prepares the ResetConnection request. +func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/resetconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetConnectionSender sends the ResetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionSender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetConnectionResponder handles the response to the ResetConnection request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) ResetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway +// connection shared key for passed virtual network gateway connection in the specified resource group through Network +// resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection reset shared key Name. +// parameters - parameters supplied to the begin reset virtual network gateway connection shared key operation +// through network resource provider. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (result VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.ResetSharedKey") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: int64(128), Chain: nil}, + {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", err.Error()) + } + + req, err := client.ResetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request") + return + } + + result, err = client.ResetSharedKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetSharedKeyPreparer prepares the ResetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-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/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetSharedKeySender sends the ResetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(resp *http.Response) (result ConnectionResetSharedKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection +// shared key for passed virtual network gateway connection in the specified resource group through Network resource +// provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the virtual network gateway connection name. +// parameters - parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation +// throughNetwork resource provider. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (result VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.SetSharedKey") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", err.Error()) + } + + req, err := client.SetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request") + return + } + + result, err = client.SetSharedKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", result.Response(), "Failure sending request") + return + } + + return +} + +// SetSharedKeyPreparer prepares the SetSharedKey request. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetSharedKeySender sends the SetSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp *http.Response) (result ConnectionSharedKey, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartPacketCapture starts packet capture on virtual network gateway connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +// parameters - virtual network gateway packet capture parameters supplied to start packet capture on gateway +// connection. +func (client VirtualNetworkGatewayConnectionsClient) StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters *VpnPacketCaptureStartParameters) (result VirtualNetworkGatewayConnectionsStartPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.StartPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StartPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StartPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StartPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPacketCapturePreparer prepares the StartPacketCapture request. +func (client VirtualNetworkGatewayConnectionsClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters *VpnPacketCaptureStartParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-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/connections/{virtualNetworkGatewayConnectionName}/startPacketCapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) StartPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewayConnectionsStartPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopPacketCapture stops packet capture on virtual network gateway connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway Connection. +// parameters - virtual network gateway packet capture parameters supplied to stop packet capture on gateway +// connection. +func (client VirtualNetworkGatewayConnectionsClient) StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnPacketCaptureStopParameters) (result VirtualNetworkGatewayConnectionsStopPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.StopPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StopPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StopPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "StopPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPacketCapturePreparer prepares the StopPacketCapture request. +func (client VirtualNetworkGatewayConnectionsClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnPacketCaptureStopParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-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/connections/{virtualNetworkGatewayConnectionName}/stopPacketCapture", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) StopPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewayConnectionsStopPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates a virtual network gateway connection tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection. +// parameters - parameters supplied to update virtual network gateway connection tags. +func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayConnectionsClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGatewayConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworkgatewaynatrules.go b/services/network/mgmt/2021-08-01/network/virtualnetworkgatewaynatrules.go new file mode 100644 index 000000000000..fd083dab12fe --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworkgatewaynatrules.go @@ -0,0 +1,395 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkGatewayNatRulesClient is the network Client +type VirtualNetworkGatewayNatRulesClient struct { + BaseClient +} + +// NewVirtualNetworkGatewayNatRulesClient creates an instance of the VirtualNetworkGatewayNatRulesClient client. +func NewVirtualNetworkGatewayNatRulesClient(subscriptionID string) VirtualNetworkGatewayNatRulesClient { + return NewVirtualNetworkGatewayNatRulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkGatewayNatRulesClientWithBaseURI creates an instance of the VirtualNetworkGatewayNatRulesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewVirtualNetworkGatewayNatRulesClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewayNatRulesClient { + return VirtualNetworkGatewayNatRulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the +// existing nat rules. +// Parameters: +// resourceGroupName - the resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +// natRuleParameters - parameters supplied to create or Update a Nat Rule. +func (client VirtualNetworkGatewayNatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule) (result VirtualNetworkGatewayNatRulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayNatRulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkGatewayNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string, natRuleParameters VirtualNetworkGatewayNatRule) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + natRuleParameters.Etag = nil + natRuleParameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithJSON(natRuleParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayNatRulesClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayNatRulesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayNatRulesClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGatewayNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a nat rule. +// Parameters: +// resourceGroupName - the resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +func (client VirtualNetworkGatewayNatRulesClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (result VirtualNetworkGatewayNatRulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayNatRulesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkGatewayNatRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayNatRulesClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayNatRulesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayNatRulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a nat rule. +// Parameters: +// resourceGroupName - the resource group name of the Virtual Network Gateway. +// virtualNetworkGatewayName - the name of the gateway. +// natRuleName - the name of the nat rule. +func (client VirtualNetworkGatewayNatRulesClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (result VirtualNetworkGatewayNatRule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayNatRulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, natRuleName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkGatewayNatRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, natRuleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "natRuleName": autorest.Encode("path", natRuleName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayNatRulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayNatRulesClient) GetResponder(resp *http.Response) (result VirtualNetworkGatewayNatRule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVirtualNetworkGateway retrieves all nat rules for a particular virtual network gateway. +// Parameters: +// resourceGroupName - the resource group name of the virtual network gateway. +// virtualNetworkGatewayName - the name of the gateway. +func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGateway(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result ListVirtualNetworkGatewayNatRulesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayNatRulesClient.ListByVirtualNetworkGateway") + defer func() { + sc := -1 + if result.lvngnrr.Response.Response != nil { + sc = result.lvngnrr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVirtualNetworkGatewayNextResults + req, err := client.ListByVirtualNetworkGatewayPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "ListByVirtualNetworkGateway", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVirtualNetworkGatewaySender(req) + if err != nil { + result.lvngnrr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "ListByVirtualNetworkGateway", resp, "Failure sending request") + return + } + + result.lvngnrr, err = client.ListByVirtualNetworkGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "ListByVirtualNetworkGateway", resp, "Failure responding to request") + return + } + if result.lvngnrr.hasNextLink() && result.lvngnrr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVirtualNetworkGatewayPreparer prepares the ListByVirtualNetworkGateway request. +func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGatewayPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVirtualNetworkGatewaySender sends the ListByVirtualNetworkGateway request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVirtualNetworkGatewayResponder handles the response to the ListByVirtualNetworkGateway request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGatewayResponder(resp *http.Response) (result ListVirtualNetworkGatewayNatRulesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVirtualNetworkGatewayNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayNextResults(ctx context.Context, lastResults ListVirtualNetworkGatewayNatRulesResult) (result ListVirtualNetworkGatewayNatRulesResult, err error) { + req, err := lastResults.listVirtualNetworkGatewayNatRulesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "listByVirtualNetworkGatewayNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVirtualNetworkGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "listByVirtualNetworkGatewayNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVirtualNetworkGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayNatRulesClient", "listByVirtualNetworkGatewayNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVirtualNetworkGatewayComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkGatewayNatRulesClient) ListByVirtualNetworkGatewayComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result ListVirtualNetworkGatewayNatRulesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewayNatRulesClient.ListByVirtualNetworkGateway") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVirtualNetworkGateway(ctx, resourceGroupName, virtualNetworkGatewayName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworkgateways.go b/services/network/mgmt/2021-08-01/network/virtualnetworkgateways.go new file mode 100644 index 000000000000..2943d5e9a6f6 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworkgateways.go @@ -0,0 +1,1910 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkGatewaysClient is the network Client +type VirtualNetworkGatewaysClient struct { + BaseClient +} + +// NewVirtualNetworkGatewaysClient creates an instance of the VirtualNetworkGatewaysClient client. +func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient { + return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the VirtualNetworkGatewaysClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient { + return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a virtual network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to create or update virtual network gateway operation. +func (client VirtualNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualNetworkGatewayPropertiesFormat.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewaysClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DisconnectVirtualNetworkGatewayVpnConnections disconnect vpn connections of virtual network gateway in the specified +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// request - the parameters are supplied to disconnect vpn connections. +func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVpnConnectionRequest) (result VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.DisconnectVirtualNetworkGatewayVpnConnections") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DisconnectVirtualNetworkGatewayVpnConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "DisconnectVirtualNetworkGatewayVpnConnections", nil, "Failure preparing request") + return + } + + result, err = client.DisconnectVirtualNetworkGatewayVpnConnectionsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "DisconnectVirtualNetworkGatewayVpnConnections", result.Response(), "Failure sending request") + return + } + + return +} + +// DisconnectVirtualNetworkGatewayVpnConnectionsPreparer prepares the DisconnectVirtualNetworkGatewayVpnConnections request. +func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, request P2SVpnConnectionRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/disconnectVirtualNetworkGatewayVpnConnections", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DisconnectVirtualNetworkGatewayVpnConnectionsSender sends the DisconnectVirtualNetworkGatewayVpnConnections request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsSender(req *http.Request) (future VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVpnConnectionsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DisconnectVirtualNetworkGatewayVpnConnectionsResponder handles the response to the DisconnectVirtualNetworkGatewayVpnConnections request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) DisconnectVirtualNetworkGatewayVpnConnectionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Generatevpnclientpackage generates VPN client package for P2S client of the virtual network gateway in the specified +// resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to the generate virtual network gateway VPN client package operation. +func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Generatevpnclientpackage") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GeneratevpnclientpackagePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", nil, "Failure preparing request") + return + } + + result, err = client.GeneratevpnclientpackageSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", result.Response(), "Failure sending request") + return + } + + return +} + +// GeneratevpnclientpackagePreparer prepares the Generatevpnclientpackage request. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GenerateVpnProfile generates VPN profile for P2S client of the virtual network gateway in the specified resource +// group. Used for IKEV2 and radius based authentication. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to the generate virtual network gateway VPN client package operation. +func (client VirtualNetworkGatewaysClient) GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GenerateVpnProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GenerateVpnProfilePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", nil, "Failure preparing request") + return + } + + result, err = client.GenerateVpnProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GenerateVpnProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// GenerateVpnProfilePreparer prepares the GenerateVpnProfile request. +func (client VirtualNetworkGatewaysClient) GenerateVpnProfilePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateVpnProfileSender sends the GenerateVpnProfile request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GenerateVpnProfileSender(req *http.Request) (future VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GenerateVpnProfileResponder handles the response to the GenerateVpnProfile request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GenerateVpnProfileResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the specified virtual network gateway by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAdvertisedRoutes this operation retrieves a list of routes the virtual network gateway is advertising to the +// specified peer. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// peer - the IP address of the peer. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetAdvertisedRoutes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAdvertisedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", nil, "Failure preparing request") + return + } + + result, err = client.GetAdvertisedRoutesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetAdvertisedRoutes", result.Response(), "Failure sending request") + return + } + + return +} + +// GetAdvertisedRoutesPreparer prepares the GetAdvertisedRoutes request. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "peer": autorest.Encode("query", peer), + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAdvertisedRoutesSender sends the GetAdvertisedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetAdvertisedRoutesResponder handles the response to the GetAdvertisedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetAdvertisedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetBgpPeerStatus the GetBgpPeerStatus operation retrieves the status of all BGP peers. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// peer - the IP address of the peer to retrieve the status of. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetBgpPeerStatus") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetBgpPeerStatusPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, peer) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", nil, "Failure preparing request") + return + } + + result, err = client.GetBgpPeerStatusSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetBgpPeerStatus", result.Response(), "Failure sending request") + return + } + + return +} + +// GetBgpPeerStatusPreparer prepares the GetBgpPeerStatus request. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(peer) > 0 { + queryParameters["peer"] = autorest.Encode("query", peer) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetBgpPeerStatusSender sends the GetBgpPeerStatus request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusSender(req *http.Request) (future VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetBgpPeerStatusResponder handles the response to the GetBgpPeerStatus request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetBgpPeerStatusResponder(resp *http.Response) (result BgpPeerStatusListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetLearnedRoutes this operation retrieves a list of routes the virtual network gateway has learned, including routes +// learned from BGP peers. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetLearnedRoutes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetLearnedRoutesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", nil, "Failure preparing request") + return + } + + result, err = client.GetLearnedRoutesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetLearnedRoutes", result.Response(), "Failure sending request") + return + } + + return +} + +// GetLearnedRoutesPreparer prepares the GetLearnedRoutes request. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetLearnedRoutesSender sends the GetLearnedRoutes request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesSender(req *http.Request) (future VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetLearnedRoutesResponder handles the response to the GetLearnedRoutes request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetLearnedRoutesResponder(resp *http.Response) (result GatewayRouteListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVpnclientConnectionHealth get VPN client connection health detail per P2S client connection of the virtual +// network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealth(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientConnectionHealth") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVpnclientConnectionHealthPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", nil, "Failure preparing request") + return + } + + result, err = client.GetVpnclientConnectionHealthSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientConnectionHealth", result.Response(), "Failure sending request") + return + } + + return +} + +// GetVpnclientConnectionHealthPreparer prepares the GetVpnclientConnectionHealth request. +func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getVpnClientConnectionHealth", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVpnclientConnectionHealthSender sends the GetVpnclientConnectionHealth request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetVpnclientConnectionHealthResponder handles the response to the GetVpnclientConnectionHealth request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetVpnclientConnectionHealthResponder(resp *http.Response) (result VpnClientConnectionHealthDetailListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVpnclientIpsecParameters the Get VpnclientIpsecParameters operation retrieves information about the vpnclient +// ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource +// provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the virtual network gateway name. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnclientIpsecParameters") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", nil, "Failure preparing request") + return + } + + result, err = client.GetVpnclientIpsecParametersSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnclientIpsecParameters", result.Response(), "Failure sending request") + return + } + + return +} + +// GetVpnclientIpsecParametersPreparer prepares the GetVpnclientIpsecParameters request. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVpnclientIpsecParametersSender sends the GetVpnclientIpsecParameters request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnclientIpsecParametersFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetVpnclientIpsecParametersResponder handles the response to the GetVpnclientIpsecParameters request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVpnProfilePackageURL gets pre-generated VPN profile for P2S client of the virtual network gateway in the +// specified resource group. The profile needs to be generated first using generateVpnProfile. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.GetVpnProfilePackageURL") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetVpnProfilePackageURLPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", nil, "Failure preparing request") + return + } + + result, err = client.GetVpnProfilePackageURLSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "GetVpnProfilePackageURL", result.Response(), "Failure sending request") + return + } + + return +} + +// GetVpnProfilePackageURLPreparer prepares the GetVpnProfilePackageURL request. +func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVpnProfilePackageURLSender sends the GetVpnProfilePackageURL request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLSender(req *http.Request) (future VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetVpnProfilePackageURLResponder handles the response to the GetVpnProfilePackageURL request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) GetVpnProfilePackageURLResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual network gateways by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List") + defer func() { + sc := -1 + if result.vnglr.Response.Response != nil { + sc = result.vnglr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vnglr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.vnglr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.vnglr.hasNextLink() && result.vnglr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewaysClient) listNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, err error) { + req, err := lastResults.virtualNetworkGatewayListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListConnections gets all the connections in a virtual network gateway. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections") + defer func() { + sc := -1 + if result.vnglcr.Response.Response != nil { + sc = result.vnglcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listConnectionsNextResults + req, err := client.ListConnectionsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", nil, "Failure preparing request") + return + } + + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.vnglcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure sending request") + return + } + + result.vnglcr, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ListConnections", resp, "Failure responding to request") + return + } + if result.vnglcr.hasNextLink() && result.vnglcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListConnectionsPreparer prepares the ListConnections request. +func (client VirtualNetworkGatewaysClient) ListConnectionsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListConnectionsSender sends the ListConnections request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ListConnectionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListConnectionsResponder handles the response to the ListConnections request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ListConnectionsResponder(resp *http.Response) (result VirtualNetworkGatewayListConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listConnectionsNextResults retrieves the next set of results, if any. +func (client VirtualNetworkGatewaysClient) listConnectionsNextResults(ctx context.Context, lastResults VirtualNetworkGatewayListConnectionsResult) (result VirtualNetworkGatewayListConnectionsResult, err error) { + req, err := lastResults.virtualNetworkGatewayListConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListConnectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListConnectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "listConnectionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListConnectionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkGatewaysClient) ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewayListConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ListConnections") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListConnections(ctx, resourceGroupName, virtualNetworkGatewayName) + return +} + +// Reset resets the primary of the virtual network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// gatewayVip - virtual network gateway vip address supplied to the begin reset of the active-active feature +// enabled gateway. +func (client VirtualNetworkGatewaysClient) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result VirtualNetworkGatewaysResetFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Reset") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, gatewayVip) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", nil, "Failure preparing request") + return + } + + result, err = client.ResetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Reset", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetPreparer prepares the Reset request. +func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(gatewayVip) > 0 { + queryParameters["gatewayVip"] = autorest.Encode("query", gatewayVip) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetSender sends the Reset request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetResponder handles the response to the Reset request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ResetVpnClientSharedKey resets the VPN client shared key of the virtual network gateway in the specified resource +// group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.ResetVpnClientSharedKey") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetVpnClientSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", nil, "Failure preparing request") + return + } + + result, err = client.ResetVpnClientSharedKeySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "ResetVpnClientSharedKey", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetVpnClientSharedKeyPreparer prepares the ResetVpnClientSharedKey request. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/resetvpnclientsharedkey", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetVpnClientSharedKeySender sends the ResetVpnClientSharedKey request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeySender(req *http.Request) (future VirtualNetworkGatewaysResetVpnClientSharedKeyFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetVpnClientSharedKeyResponder handles the response to the ResetVpnClientSharedKey request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) ResetVpnClientSharedKeyResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// SetVpnclientIpsecParameters the Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S +// client of virtual network gateway in the specified resource group through Network resource provider. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// vpnclientIpsecParams - parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network +// Gateway P2S client operation through Network resource provider. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParameters(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (result VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SetVpnclientIpsecParameters") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vpnclientIpsecParams, + Constraints: []validation.Constraint{{Target: "vpnclientIpsecParams.SaLifeTimeSeconds", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "vpnclientIpsecParams.SaDataSizeKilobytes", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", err.Error()) + } + + req, err := client.SetVpnclientIpsecParametersPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", nil, "Failure preparing request") + return + } + + result, err = client.SetVpnclientIpsecParametersSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SetVpnclientIpsecParameters", result.Response(), "Failure sending request") + return + } + + return +} + +// SetVpnclientIpsecParametersPreparer prepares the SetVpnclientIpsecParameters request. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, vpnclientIpsecParams VpnClientIPsecParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters", pathParameters), + autorest.WithJSON(vpnclientIpsecParams), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetVpnclientIpsecParametersSender sends the SetVpnclientIpsecParameters request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersSender(req *http.Request) (future VirtualNetworkGatewaysSetVpnclientIpsecParametersFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SetVpnclientIpsecParametersResponder handles the response to the SetVpnclientIpsecParameters request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) SetVpnclientIpsecParametersResponder(resp *http.Response) (result VpnClientIPsecParameters, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartPacketCapture starts packet capture on virtual network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - virtual network gateway packet capture parameters supplied to start packet capture on gateway. +func (client VirtualNetworkGatewaysClient) StartPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (result VirtualNetworkGatewaysStartPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StartPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StartPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StartPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPacketCapturePreparer prepares the StartPacketCapture request. +func (client VirtualNetworkGatewaysClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters *VpnPacketCaptureStartParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/startPacketCapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) StartPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStartPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopPacketCapture stops packet capture on virtual network gateway in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - virtual network gateway packet capture parameters supplied to stop packet capture on gateway. +func (client VirtualNetworkGatewaysClient) StopPacketCapture(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (result VirtualNetworkGatewaysStopPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.StopPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StopPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "StopPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPacketCapturePreparer prepares the StopPacketCapture request. +func (client VirtualNetworkGatewaysClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnPacketCaptureStopParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-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/virtualNetworkGateways/{virtualNetworkGatewayName}/stopPacketCapture", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) StopPacketCaptureSender(req *http.Request) (future VirtualNetworkGatewaysStopPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SupportedVpnDevices gets a xml format representation for supported vpn devices. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +func (client VirtualNetworkGatewaysClient) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.SupportedVpnDevices") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SupportedVpnDevicesPreparer(ctx, resourceGroupName, virtualNetworkGatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", nil, "Failure preparing request") + return + } + + resp, err := client.SupportedVpnDevicesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure sending request") + return + } + + result, err = client.SupportedVpnDevicesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "SupportedVpnDevices", resp, "Failure responding to request") + return + } + + return +} + +// SupportedVpnDevicesPreparer prepares the SupportedVpnDevices request. +func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SupportedVpnDevicesSender sends the SupportedVpnDevices request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SupportedVpnDevicesResponder handles the response to the SupportedVpnDevices request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) SupportedVpnDevicesResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates a virtual network gateway tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayName - the name of the virtual network gateway. +// parameters - parameters supplied to update virtual network gateway tags. +func (client VirtualNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (result VirtualNetworkGatewaysUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayName": autorest.Encode("path", virtualNetworkGatewayName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewaysUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// VpnDeviceConfigurationScript gets a xml format representation for vpn device configuration script. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkGatewayConnectionName - the name of the virtual network gateway connection for which the +// configuration script is generated. +// parameters - parameters supplied to the generate vpn device script operation. +func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (result String, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.VpnDeviceConfigurationScript") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.VpnDeviceConfigurationScriptPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", nil, "Failure preparing request") + return + } + + resp, err := client.VpnDeviceConfigurationScriptSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure sending request") + return + } + + result, err = client.VpnDeviceConfigurationScriptResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "VpnDeviceConfigurationScript", resp, "Failure responding to request") + return + } + + return +} + +// VpnDeviceConfigurationScriptPreparer prepares the VpnDeviceConfigurationScript request. +func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VpnDeviceScriptParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName), + } + + const APIVersion = "2021-08-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/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VpnDeviceConfigurationScriptSender sends the VpnDeviceConfigurationScript request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// VpnDeviceConfigurationScriptResponder handles the response to the VpnDeviceConfigurationScript request. The method always +// closes the http.Response Body. +func (client VirtualNetworkGatewaysClient) VpnDeviceConfigurationScriptResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworkpeerings.go b/services/network/mgmt/2021-08-01/network/virtualnetworkpeerings.go new file mode 100644 index 000000000000..f556b1fd8234 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworkpeerings.go @@ -0,0 +1,411 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkPeeringsClient is the network Client +type VirtualNetworkPeeringsClient struct { + BaseClient +} + +// NewVirtualNetworkPeeringsClient creates an instance of the VirtualNetworkPeeringsClient client. +func NewVirtualNetworkPeeringsClient(subscriptionID string) VirtualNetworkPeeringsClient { + return NewVirtualNetworkPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkPeeringsClientWithBaseURI creates an instance of the VirtualNetworkPeeringsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkPeeringsClient { + return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a peering in the specified virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the peering. +// virtualNetworkPeeringParameters - parameters supplied to the create or update virtual network peering +// operation. +// syncRemoteAddressSpace - parameter indicates the intention to sync the peering with the current address +// space on the remote vNet after it's updated. +func (client VirtualNetworkPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, syncRemoteAddressSpace SyncRemoteAddressSpace) (result VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: virtualNetworkPeeringParameters, + Constraints: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteBgpCommunities", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteBgpCommunities.VirtualNetworkCommunity", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteVirtualNetworkEncryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "virtualNetworkPeeringParameters.VirtualNetworkPeeringPropertiesFormat.RemoteVirtualNetworkEncryption.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkPeeringsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, syncRemoteAddressSpace) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, syncRemoteAddressSpace SyncRemoteAddressSpace) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(string(syncRemoteAddressSpace)) > 0 { + queryParameters["syncRemoteAddressSpace"] = autorest.Encode("query", syncRemoteAddressSpace) + } + + virtualNetworkPeeringParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithJSON(virtualNetworkPeeringParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkPeeringsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the virtual network peering. +func (client VirtualNetworkPeeringsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeeringsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (future VirtualNetworkPeeringsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// virtualNetworkPeeringName - the name of the virtual network peering. +func (client VirtualNetworkPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + "virtualNetworkPeeringName": autorest.Encode("path", virtualNetworkPeeringName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (result VirtualNetworkPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual network peerings in a virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client VirtualNetworkPeeringsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringsClient.List") + defer func() { + sc := -1 + if result.vnplr.Response.Response != nil { + sc = result.vnplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vnplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request") + return + } + + result.vnplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request") + return + } + if result.vnplr.hasNextLink() && result.vnplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworkPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (result VirtualNetworkPeeringListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworkPeeringsClient) listNextResults(ctx context.Context, lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) { + req, err := lastResults.virtualNetworkPeeringListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkPeeringsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualNetworkName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworks.go b/services/network/mgmt/2021-08-01/network/virtualnetworks.go new file mode 100644 index 000000000000..9febb3dec5d5 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworks.go @@ -0,0 +1,788 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworksClient is the network Client +type VirtualNetworksClient struct { + BaseClient +} + +// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. +func NewVirtualNetworksClient(subscriptionID string) VirtualNetworksClient { + return NewVirtualNetworksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworksClientWithBaseURI creates an instance of the VirtualNetworksClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworksClient { + return VirtualNetworksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckIPAddressAvailability checks whether a private IP address is available for use. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// IPAddress - the private IP address to be verified. +func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CheckIPAddressAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckIPAddressAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckIPAddressAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "ipAddress": autorest.Encode("query", IPAddress), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckIPAddressAvailabilityResponder handles the response to the CheckIPAddressAvailability request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *http.Response) (result IPAddressAvailabilityResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a virtual network in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to the create or update virtual network operation. +func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.BgpCommunities.VirtualNetworkCommunity", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.VirtualNetworkPropertiesFormat.Encryption", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkPropertiesFormat.Encryption.Enabled", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworksClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworksDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified virtual network by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// expand - expands referenced resources. +func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all virtual networks in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") + defer func() { + sc := -1 + if result.vnlr.Response.Response != nil { + sc = result.vnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") + return + } + if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.virtualNetworkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all virtual networks in a subscription. +func (client VirtualNetworksClient) ListAll(ctx context.Context) (result VirtualNetworkListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") + defer func() { + sc := -1 + if result.vnlr.Response.Response != nil { + sc = result.vnlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vnlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") + return + } + + result.vnlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") + return + } + if result.vnlr.hasNextLink() && result.vnlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (result VirtualNetworkListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { + req, err := lastResults.virtualNetworkListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListAllComplete(ctx context.Context) (result VirtualNetworkListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListUsage lists usage stats. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +func (client VirtualNetworksClient) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") + defer func() { + sc := -1 + if result.vnlur.Response.Response != nil { + sc = result.vnlur.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listUsageNextResults + req, err := client.ListUsagePreparer(ctx, resourceGroupName, virtualNetworkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing request") + return + } + + resp, err := client.ListUsageSender(req) + if err != nil { + result.vnlur.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending request") + return + } + + result.vnlur, err = client.ListUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to request") + return + } + if result.vnlur.hasNextLink() && result.vnlur.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListUsagePreparer prepares the ListUsage request. +func (client VirtualNetworksClient) ListUsagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListUsageSender sends the ListUsage request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) ListUsageSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListUsageResponder handles the response to the ListUsage request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) ListUsageResponder(resp *http.Response) (result VirtualNetworkListUsageResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listUsageNextResults retrieves the next set of results, if any. +func (client VirtualNetworksClient) listUsageNextResults(ctx context.Context, lastResults VirtualNetworkListUsageResult) (result VirtualNetworkListUsageResult, err error) { + req, err := lastResults.virtualNetworkListUsageResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListUsageSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure sending next results request") + } + result, err = client.ListUsageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListUsageComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworksClient) ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.ListUsage") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListUsage(ctx, resourceGroupName, virtualNetworkName) + return +} + +// UpdateTags updates a virtual network tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualNetworkName - the name of the virtual network. +// parameters - parameters supplied to update virtual network tags. +func (client VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (result VirtualNetwork, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworksClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualNetworkName": autorest.Encode("path", virtualNetworkName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworksClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualNetworksClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetwork, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualnetworktaps.go b/services/network/mgmt/2021-08-01/network/virtualnetworktaps.go new file mode 100644 index 000000000000..7d6bc121f9e8 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualnetworktaps.go @@ -0,0 +1,613 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualNetworkTapsClient is the network Client +type VirtualNetworkTapsClient struct { + BaseClient +} + +// NewVirtualNetworkTapsClient creates an instance of the VirtualNetworkTapsClient client. +func NewVirtualNetworkTapsClient(subscriptionID string) VirtualNetworkTapsClient { + return NewVirtualNetworkTapsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualNetworkTapsClientWithBaseURI creates an instance of the VirtualNetworkTapsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewVirtualNetworkTapsClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkTapsClient { + return VirtualNetworkTapsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Virtual Network Tap. +// Parameters: +// resourceGroupName - the name of the resource group. +// tapName - the name of the virtual network tap. +// parameters - parameters supplied to the create or update virtual network tap operation. +func (client VirtualNetworkTapsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (result VirtualNetworkTapsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationNetworkInterfaceIPConfiguration.InterfaceIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}, + }}, + {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, + }}, + {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.ServicePublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + {Target: "parameters.VirtualNetworkTapPropertiesFormat.DestinationLoadBalancerFrontEndIPConfiguration.FrontendIPConfigurationPropertiesFormat.PublicIPAddress.PublicIPAddressPropertiesFormat.LinkedPublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}, + }}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualNetworkTapsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, tapName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualNetworkTapsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, tapName string, parameters VirtualNetworkTap) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapName": autorest.Encode("path", tapName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkTapsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkTap, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified virtual network tap. +// Parameters: +// resourceGroupName - the name of the resource group. +// tapName - the name of the virtual network tap. +func (client VirtualNetworkTapsClient) Delete(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTapsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, tapName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualNetworkTapsClient) DeletePreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapName": autorest.Encode("path", tapName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) DeleteSender(req *http.Request) (future VirtualNetworkTapsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets information about the specified virtual network tap. +// Parameters: +// resourceGroupName - the name of the resource group. +// tapName - the name of virtual network tap. +func (client VirtualNetworkTapsClient) Get(ctx context.Context, resourceGroupName string, tapName string) (result VirtualNetworkTap, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, tapName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualNetworkTapsClient) GetPreparer(ctx context.Context, resourceGroupName string, tapName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapName": autorest.Encode("path", tapName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) GetResponder(resp *http.Response) (result VirtualNetworkTap, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAll gets all the VirtualNetworkTaps in a subscription. +func (client VirtualNetworkTapsClient) ListAll(ctx context.Context) (result VirtualNetworkTapListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll") + defer func() { + sc := -1 + if result.vntlr.Response.Response != nil { + sc = result.vntlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.vntlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure sending request") + return + } + + result.vntlr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListAll", resp, "Failure responding to request") + return + } + if result.vntlr.hasNextLink() && result.vntlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client VirtualNetworkTapsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) ListAllResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client VirtualNetworkTapsClient) listAllNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) { + req, err := lastResults.virtualNetworkTapListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkTapsClient) ListAllComplete(ctx context.Context) (result VirtualNetworkTapListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} + +// ListByResourceGroup gets all the VirtualNetworkTaps in a subscription. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualNetworkTapsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.vntlr.Response.Response != nil { + sc = result.vntlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.vntlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vntlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.vntlr.hasNextLink() && result.vntlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualNetworkTapsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualNetworkTapListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualNetworkTapsClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualNetworkTapListResult) (result VirtualNetworkTapListResult, err error) { + req, err := lastResults.virtualNetworkTapListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualNetworkTapsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkTapListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates an VirtualNetworkTap tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// tapName - the name of the tap. +// tapParameters - parameters supplied to update VirtualNetworkTap tags. +func (client VirtualNetworkTapsClient) UpdateTags(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (result VirtualNetworkTap, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkTapsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, tapName, tapParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkTapsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualNetworkTapsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, tapName string, tapParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "tapName": autorest.Encode("path", tapName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkTaps/{tapName}", pathParameters), + autorest.WithJSON(tapParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualNetworkTapsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualNetworkTapsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkTap, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualrouterpeerings.go b/services/network/mgmt/2021-08-01/network/virtualrouterpeerings.go new file mode 100644 index 000000000000..4ed695c16f96 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualrouterpeerings.go @@ -0,0 +1,406 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualRouterPeeringsClient is the network Client +type VirtualRouterPeeringsClient struct { + BaseClient +} + +// NewVirtualRouterPeeringsClient creates an instance of the VirtualRouterPeeringsClient client. +func NewVirtualRouterPeeringsClient(subscriptionID string) VirtualRouterPeeringsClient { + return NewVirtualRouterPeeringsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualRouterPeeringsClientWithBaseURI creates an instance of the VirtualRouterPeeringsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVirtualRouterPeeringsClientWithBaseURI(baseURI string, subscriptionID string) VirtualRouterPeeringsClient { + return VirtualRouterPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Virtual Router Peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +// peeringName - the name of the Virtual Router Peering. +// parameters - parameters supplied to the create or update Virtual Router Peering operation. +func (client VirtualRouterPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering) (result VirtualRouterPeeringsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualRouterPeeringProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualRouterPeeringProperties.PeerAsn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualRouterPeeringProperties.PeerAsn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualRouterPeeringProperties.PeerAsn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualRouterPeeringsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualRouterName, peeringName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualRouterPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string, parameters VirtualRouterPeering) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRouterPeeringsClient) CreateOrUpdateSender(req *http.Request) (future VirtualRouterPeeringsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualRouterPeeringsClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualRouterPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified peering from a Virtual Router. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +// peeringName - the name of the peering. +func (client VirtualRouterPeeringsClient) Delete(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (result VirtualRouterPeeringsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualRouterName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualRouterPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRouterPeeringsClient) DeleteSender(req *http.Request) (future VirtualRouterPeeringsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualRouterPeeringsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Virtual Router Peering. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +// peeringName - the name of the Virtual Router Peering. +func (client VirtualRouterPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (result VirtualRouterPeering, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualRouterName, peeringName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualRouterPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualRouterName string, peeringName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "peeringName": autorest.Encode("path", peeringName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings/{peeringName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRouterPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualRouterPeeringsClient) GetResponder(resp *http.Response) (result VirtualRouterPeering, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all Virtual Router Peerings in a Virtual Router resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +func (client VirtualRouterPeeringsClient) List(ctx context.Context, resourceGroupName string, virtualRouterName string) (result VirtualRouterPeeringListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringsClient.List") + defer func() { + sc := -1 + if result.vrplr.Response.Response != nil { + sc = result.vrplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, virtualRouterName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vrplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "List", resp, "Failure sending request") + return + } + + result.vrplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "List", resp, "Failure responding to request") + return + } + if result.vrplr.hasNextLink() && result.vrplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualRouterPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualRouterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}/peerings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRouterPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualRouterPeeringsClient) ListResponder(resp *http.Response) (result VirtualRouterPeeringListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualRouterPeeringsClient) listNextResults(ctx context.Context, lastResults VirtualRouterPeeringListResult) (result VirtualRouterPeeringListResult, err error) { + req, err := lastResults.virtualRouterPeeringListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRouterPeeringsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualRouterPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualRouterName string) (result VirtualRouterPeeringListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRouterPeeringsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, virtualRouterName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualrouters.go b/services/network/mgmt/2021-08-01/network/virtualrouters.go new file mode 100644 index 000000000000..a4da32dbc582 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualrouters.go @@ -0,0 +1,513 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualRoutersClient is the network Client +type VirtualRoutersClient struct { + BaseClient +} + +// NewVirtualRoutersClient creates an instance of the VirtualRoutersClient client. +func NewVirtualRoutersClient(subscriptionID string) VirtualRoutersClient { + return NewVirtualRoutersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualRoutersClientWithBaseURI creates an instance of the VirtualRoutersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualRoutersClientWithBaseURI(baseURI string, subscriptionID string) VirtualRoutersClient { + return VirtualRoutersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the specified Virtual Router. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +// parameters - parameters supplied to the create or update Virtual Router. +func (client VirtualRoutersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter) (result VirtualRoutersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.VirtualRouterPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualRouterPropertiesFormat.VirtualRouterAsn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.VirtualRouterPropertiesFormat.VirtualRouterAsn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "parameters.VirtualRouterPropertiesFormat.VirtualRouterAsn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VirtualRoutersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualRouterName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualRoutersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualRouterName string, parameters VirtualRouter) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRoutersClient) CreateOrUpdateSender(req *http.Request) (future VirtualRoutersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualRoutersClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualRouter, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified Virtual Router. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +func (client VirtualRoutersClient) Delete(ctx context.Context, resourceGroupName string, virtualRouterName string) (result VirtualRoutersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualRouterName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualRoutersClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualRouterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRoutersClient) DeleteSender(req *http.Request) (future VirtualRoutersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualRoutersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified Virtual Router. +// Parameters: +// resourceGroupName - the name of the resource group. +// virtualRouterName - the name of the Virtual Router. +// expand - expands referenced resources. +func (client VirtualRoutersClient) Get(ctx context.Context, resourceGroupName string, virtualRouterName string, expand string) (result VirtualRouter, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualRouterName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualRoutersClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualRouterName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualRouterName": autorest.Encode("path", virtualRouterName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters/{virtualRouterName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRoutersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualRoutersClient) GetResponder(resp *http.Response) (result VirtualRouter, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all the Virtual Routers in a subscription. +func (client VirtualRoutersClient) List(ctx context.Context) (result VirtualRouterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.List") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "List", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "List", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualRoutersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualRouters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRoutersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualRoutersClient) ListResponder(resp *http.Response) (result VirtualRouterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualRoutersClient) listNextResults(ctx context.Context, lastResults VirtualRouterListResult) (result VirtualRouterListResult, err error) { + req, err := lastResults.virtualRouterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualRoutersClient) ListComplete(ctx context.Context) (result VirtualRouterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all Virtual Routers in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client VirtualRoutersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result VirtualRouterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.vrlr.Response.Response != nil { + sc = result.vrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.vrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.vrlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.vrlr.hasNextLink() && result.vrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualRoutersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualRouters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualRoutersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualRoutersClient) ListByResourceGroupResponder(resp *http.Response) (result VirtualRouterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualRoutersClient) listByResourceGroupNextResults(ctx context.Context, lastResults VirtualRouterListResult) (result VirtualRouterListResult, err error) { + req, err := lastResults.virtualRouterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualRoutersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualRoutersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result VirtualRouterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualRoutersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/virtualwans.go b/services/network/mgmt/2021-08-01/network/virtualwans.go new file mode 100644 index 000000000000..cf2385c7948f --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/virtualwans.go @@ -0,0 +1,576 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VirtualWansClient is the network Client +type VirtualWansClient struct { + BaseClient +} + +// NewVirtualWansClient creates an instance of the VirtualWansClient client. +func NewVirtualWansClient(subscriptionID string) VirtualWansClient { + return NewVirtualWansClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVirtualWansClientWithBaseURI creates an instance of the VirtualWansClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVirtualWansClientWithBaseURI(baseURI string, subscriptionID string) VirtualWansClient { + return VirtualWansClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. +// Parameters: +// resourceGroupName - the resource group name of the VirtualWan. +// virtualWANName - the name of the VirtualWAN being created or updated. +// wANParameters - parameters supplied to create or update VirtualWAN. +func (client VirtualWansClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters VirtualWAN) (result VirtualWansCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualWANName, wANParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VirtualWansClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters VirtualWAN) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "VirtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + wANParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", pathParameters), + autorest.WithJSON(wANParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) CreateOrUpdateSender(req *http.Request) (future VirtualWansCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualWAN, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VirtualWAN. +// Parameters: +// resourceGroupName - the resource group name of the VirtualWan. +// virtualWANName - the name of the VirtualWAN being deleted. +func (client VirtualWansClient) Delete(ctx context.Context, resourceGroupName string, virtualWANName string) (result VirtualWansDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, virtualWANName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VirtualWansClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "VirtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) DeleteSender(req *http.Request) (future VirtualWansDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a VirtualWAN. +// Parameters: +// resourceGroupName - the resource group name of the VirtualWan. +// virtualWANName - the name of the VirtualWAN being retrieved. +func (client VirtualWansClient) Get(ctx context.Context, resourceGroupName string, virtualWANName string) (result VirtualWAN, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, virtualWANName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VirtualWansClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "VirtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) GetResponder(resp *http.Response) (result VirtualWAN, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the VirtualWANs in a subscription. +func (client VirtualWansClient) List(ctx context.Context) (result ListVirtualWANsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.List") + defer func() { + sc := -1 + if result.lvwnr.Response.Response != nil { + sc = result.lvwnr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvwnr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "List", resp, "Failure sending request") + return + } + + result.lvwnr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "List", resp, "Failure responding to request") + return + } + if result.lvwnr.hasNextLink() && result.lvwnr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VirtualWansClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualWans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) ListResponder(resp *http.Response) (result ListVirtualWANsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VirtualWansClient) listNextResults(ctx context.Context, lastResults ListVirtualWANsResult) (result ListVirtualWANsResult, err error) { + req, err := lastResults.listVirtualWANsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualWansClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualWansClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualWansClient) ListComplete(ctx context.Context) (result ListVirtualWANsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the VirtualWANs in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the VirtualWan. +func (client VirtualWansClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListVirtualWANsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lvwnr.Response.Response != nil { + sc = result.lvwnr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lvwnr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lvwnr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lvwnr.hasNextLink() && result.lvwnr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VirtualWansClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) ListByResourceGroupResponder(resp *http.Response) (result ListVirtualWANsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VirtualWansClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListVirtualWANsResult) (result ListVirtualWANsResult, err error) { + req, err := lastResults.listVirtualWANsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VirtualWansClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VirtualWansClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VirtualWansClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListVirtualWANsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates a VirtualWAN tags. +// Parameters: +// resourceGroupName - the resource group name of the VirtualWan. +// virtualWANName - the name of the VirtualWAN being updated. +// wANParameters - parameters supplied to Update VirtualWAN tags. +func (client VirtualWansClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters TagsObject) (result VirtualWAN, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VirtualWansClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualWANName, wANParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualWansClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VirtualWansClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualWANName string, wANParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "VirtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{VirtualWANName}", pathParameters), + autorest.WithJSON(wANParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VirtualWansClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VirtualWansClient) UpdateTagsResponder(resp *http.Response) (result VirtualWAN, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnconnections.go b/services/network/mgmt/2021-08-01/network/vpnconnections.go new file mode 100644 index 000000000000..bfa051bca448 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnconnections.go @@ -0,0 +1,568 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnConnectionsClient is the network Client +type VpnConnectionsClient struct { + BaseClient +} + +// NewVpnConnectionsClient creates an instance of the VpnConnectionsClient client. +func NewVpnConnectionsClient(subscriptionID string) VpnConnectionsClient { + return NewVpnConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnConnectionsClientWithBaseURI creates an instance of the VpnConnectionsClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVpnConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VpnConnectionsClient { + return VpnConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing +// connection. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// connectionName - the name of the connection. +// vpnConnectionParameters - parameters supplied to create or Update a VPN Connection. +func (client VpnConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VpnConnection) (result VpnConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, gatewayName, connectionName, vpnConnectionParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VpnConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, vpnConnectionParameters VpnConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vpnConnectionParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), + autorest.WithJSON(vpnConnectionParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VpnConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result VpnConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a vpn connection. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// connectionName - the name of the connection. +func (client VpnConnectionsClient) Delete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result VpnConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, gatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VpnConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) DeleteSender(req *http.Request) (future VpnConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a vpn connection. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// connectionName - the name of the vpn connection. +func (client VpnConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result VpnConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) GetResponder(resp *http.Response) (result VpnConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVpnGateway retrieves all vpn connections for a particular virtual wan vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +func (client VpnConnectionsClient) ListByVpnGateway(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.ListByVpnGateway") + defer func() { + sc := -1 + if result.lvcr.Response.Response != nil { + sc = result.lvcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVpnGatewayNextResults + req, err := client.ListByVpnGatewayPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVpnGatewaySender(req) + if err != nil { + result.lvcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", resp, "Failure sending request") + return + } + + result.lvcr, err = client.ListByVpnGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "ListByVpnGateway", resp, "Failure responding to request") + return + } + if result.lvcr.hasNextLink() && result.lvcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVpnGatewayPreparer prepares the ListByVpnGateway request. +func (client VpnConnectionsClient) ListByVpnGatewayPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVpnGatewaySender sends the ListByVpnGateway request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) ListByVpnGatewaySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVpnGatewayResponder handles the response to the ListByVpnGateway request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) ListByVpnGatewayResponder(resp *http.Response) (result ListVpnConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVpnGatewayNextResults retrieves the next set of results, if any. +func (client VpnConnectionsClient) listByVpnGatewayNextResults(ctx context.Context, lastResults ListVpnConnectionsResult) (result ListVpnConnectionsResult, err error) { + req, err := lastResults.listVpnConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVpnGatewaySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVpnGatewayResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "listByVpnGatewayNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVpnGatewayComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnConnectionsClient) ListByVpnGatewayComplete(ctx context.Context, resourceGroupName string, gatewayName string) (result ListVpnConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.ListByVpnGateway") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVpnGateway(ctx, resourceGroupName, gatewayName) + return +} + +// StartPacketCapture starts packet capture on Vpn connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the gateway. +// vpnConnectionName - the name of the vpn connection. +// parameters - vpn Connection packet capture parameters supplied to start packet capture on gateway +// connection. +func (client VpnConnectionsClient) StartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStartParameters) (result VpnConnectionsStartPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.StartPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, gatewayName, vpnConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StartPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StartPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StartPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPacketCapturePreparer prepares the StartPacketCapture request. +func (client VpnConnectionsClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStartParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnConnectionName": autorest.Encode("path", vpnConnectionName), + } + + const APIVersion = "2021-08-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/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/startpacketcapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) StartPacketCaptureSender(req *http.Request) (future VpnConnectionsStartPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopPacketCapture stops packet capture on Vpn connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the gateway. +// vpnConnectionName - the name of the vpn connection. +// parameters - vpn Connection packet capture parameters supplied to stop packet capture on gateway connection. +func (client VpnConnectionsClient) StopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStopParameters) (result VpnConnectionsStopPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnConnectionsClient.StopPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, gatewayName, vpnConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StopPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StopPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnConnectionsClient", "StopPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPacketCapturePreparer prepares the StopPacketCapture request. +func (client VpnConnectionsClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnConnectionName string, parameters *VpnConnectionPacketCaptureStopParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnConnectionName": autorest.Encode("path", vpnConnectionName), + } + + const APIVersion = "2021-08-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/vpnGateways/{gatewayName}/vpnConnections/{vpnConnectionName}/stoppacketcapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VpnConnectionsClient) StopPacketCaptureSender(req *http.Request) (future VpnConnectionsStopPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always +// closes the http.Response Body. +func (client VpnConnectionsClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpngateways.go b/services/network/mgmt/2021-08-01/network/vpngateways.go new file mode 100644 index 000000000000..ea9d2837eccb --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpngateways.go @@ -0,0 +1,842 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnGatewaysClient is the network Client +type VpnGatewaysClient struct { + BaseClient +} + +// NewVpnGatewaysClient creates an instance of the VpnGatewaysClient client. +func NewVpnGatewaysClient(subscriptionID string) VpnGatewaysClient { + return NewVpnGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnGatewaysClientWithBaseURI creates an instance of the VpnGatewaysClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVpnGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VpnGatewaysClient { + return VpnGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// vpnGatewayParameters - parameters supplied to create or Update a virtual wan vpn gateway. +func (client VpnGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VpnGateway) (result VpnGatewaysCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vpnGatewayParameters, + Constraints: []validation.Constraint{{Target: "vpnGatewayParameters.VpnGatewayProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnGatewayParameters.VpnGatewayProperties.BgpSettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnGatewayParameters.VpnGatewayProperties.BgpSettings.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnGatewayParameters.VpnGatewayProperties.BgpSettings.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "vpnGatewayParameters.VpnGatewayProperties.BgpSettings.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VpnGatewaysClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, gatewayName, vpnGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VpnGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters VpnGateway) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vpnGatewayParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", pathParameters), + autorest.WithJSON(vpnGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VpnGatewaysCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a virtual wan vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +func (client VpnGatewaysClient) Delete(ctx context.Context, resourceGroupName string, gatewayName string) (result VpnGatewaysDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VpnGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) DeleteSender(req *http.Request) (future VpnGatewaysDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a virtual wan vpn gateway. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +func (client VpnGatewaysClient) Get(ctx context.Context, resourceGroupName string, gatewayName string) (result VpnGateway, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) GetResponder(resp *http.Response) (result VpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the VpnGateways in a subscription. +func (client VpnGatewaysClient) List(ctx context.Context) (result ListVpnGatewaysResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.List") + defer func() { + sc := -1 + if result.lvgr.Response.Response != nil { + sc = result.lvgr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "List", resp, "Failure sending request") + return + } + + result.lvgr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "List", resp, "Failure responding to request") + return + } + if result.lvgr.hasNextLink() && result.lvgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VpnGatewaysClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) ListResponder(resp *http.Response) (result ListVpnGatewaysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VpnGatewaysClient) listNextResults(ctx context.Context, lastResults ListVpnGatewaysResult) (result ListVpnGatewaysResult, err error) { + req, err := lastResults.listVpnGatewaysResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnGatewaysClient) ListComplete(ctx context.Context) (result ListVpnGatewaysResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the VpnGateways in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +func (client VpnGatewaysClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListVpnGatewaysResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lvgr.Response.Response != nil { + sc = result.lvgr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lvgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lvgr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lvgr.hasNextLink() && result.lvgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VpnGatewaysClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) ListByResourceGroupResponder(resp *http.Response) (result ListVpnGatewaysResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VpnGatewaysClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListVpnGatewaysResult) (result ListVpnGatewaysResult, err error) { + req, err := lastResults.listVpnGatewaysResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnGatewaysClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListVpnGatewaysResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Reset resets the primary of the vpn gateway in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +func (client VpnGatewaysClient) Reset(ctx context.Context, resourceGroupName string, gatewayName string) (result VpnGatewaysResetFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.Reset") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetPreparer(ctx, resourceGroupName, gatewayName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Reset", nil, "Failure preparing request") + return + } + + result, err = client.ResetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "Reset", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetPreparer prepares the Reset request. +func (client VpnGatewaysClient) ResetPreparer(ctx context.Context, resourceGroupName string, gatewayName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/reset", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetSender sends the Reset request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) ResetSender(req *http.Request) (future VpnGatewaysResetFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetResponder handles the response to the Reset request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) ResetResponder(resp *http.Response) (result VpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StartPacketCapture starts packet capture on vpn gateway in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// parameters - vpn gateway packet capture parameters supplied to start packet capture on vpn gateway. +func (client VpnGatewaysClient) StartPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, parameters *VpnGatewayPacketCaptureStartParameters) (result VpnGatewaysStartPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.StartPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StartPacketCapturePreparer(ctx, resourceGroupName, gatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "StartPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StartPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "StartPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPacketCapturePreparer prepares the StartPacketCapture request. +func (client VpnGatewaysClient) StartPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, parameters *VpnGatewayPacketCaptureStartParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/vpnGateways/{gatewayName}/startpacketcapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartPacketCaptureSender sends the StartPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) StartPacketCaptureSender(req *http.Request) (future VpnGatewaysStartPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartPacketCaptureResponder handles the response to the StartPacketCapture request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) StartPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// StopPacketCapture stops packet capture on vpn gateway in the specified resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// parameters - vpn gateway packet capture parameters supplied to stop packet capture on vpn gateway. +func (client VpnGatewaysClient) StopPacketCapture(ctx context.Context, resourceGroupName string, gatewayName string, parameters *VpnGatewayPacketCaptureStopParameters) (result VpnGatewaysStopPacketCaptureFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.StopPacketCapture") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.StopPacketCapturePreparer(ctx, resourceGroupName, gatewayName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "StopPacketCapture", nil, "Failure preparing request") + return + } + + result, err = client.StopPacketCaptureSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "StopPacketCapture", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPacketCapturePreparer prepares the StopPacketCapture request. +func (client VpnGatewaysClient) StopPacketCapturePreparer(ctx context.Context, resourceGroupName string, gatewayName string, parameters *VpnGatewayPacketCaptureStopParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-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/vpnGateways/{gatewayName}/stoppacketcapture", pathParameters), + autorest.WithQueryParameters(queryParameters)) + if parameters != nil { + preparer = autorest.DecoratePreparer(preparer, + autorest.WithJSON(parameters)) + } + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopPacketCaptureSender sends the StopPacketCapture request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) StopPacketCaptureSender(req *http.Request) (future VpnGatewaysStopPacketCaptureFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopPacketCaptureResponder handles the response to the StopPacketCapture request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) StopPacketCaptureResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates virtual wan vpn gateway tags. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// vpnGatewayParameters - parameters supplied to update a virtual wan vpn gateway tags. +func (client VpnGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject) (result VpnGatewaysUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnGatewaysClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, gatewayName, vpnGatewayParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnGatewaysClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VpnGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, gatewayName string, vpnGatewayParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}", pathParameters), + autorest.WithJSON(vpnGatewayParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VpnGatewaysClient) UpdateTagsSender(req *http.Request) (future VpnGatewaysUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VpnGatewaysClient) UpdateTagsResponder(resp *http.Response) (result VpnGateway, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnlinkconnections.go b/services/network/mgmt/2021-08-01/network/vpnlinkconnections.go new file mode 100644 index 000000000000..f84a1b158e0e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnlinkconnections.go @@ -0,0 +1,317 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnLinkConnectionsClient is the network Client +type VpnLinkConnectionsClient struct { + BaseClient +} + +// NewVpnLinkConnectionsClient creates an instance of the VpnLinkConnectionsClient client. +func NewVpnLinkConnectionsClient(subscriptionID string) VpnLinkConnectionsClient { + return NewVpnLinkConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnLinkConnectionsClientWithBaseURI creates an instance of the VpnLinkConnectionsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewVpnLinkConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VpnLinkConnectionsClient { + return VpnLinkConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetIkeSas lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the gateway. +// connectionName - the name of the vpn connection. +// linkConnectionName - the name of the vpn link connection. +func (client VpnLinkConnectionsClient) GetIkeSas(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result VpnLinkConnectionsGetIkeSasFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnLinkConnectionsClient.GetIkeSas") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetIkeSasPreparer(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "GetIkeSas", nil, "Failure preparing request") + return + } + + result, err = client.GetIkeSasSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "GetIkeSas", result.Response(), "Failure sending request") + return + } + + return +} + +// GetIkeSasPreparer prepares the GetIkeSas request. +func (client VpnLinkConnectionsClient) GetIkeSasPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "linkConnectionName": autorest.Encode("path", linkConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/getikesas", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetIkeSasSender sends the GetIkeSas request. The method will close the +// http.Response Body if it receives an error. +func (client VpnLinkConnectionsClient) GetIkeSasSender(req *http.Request) (future VpnLinkConnectionsGetIkeSasFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetIkeSasResponder handles the response to the GetIkeSas request. The method always +// closes the http.Response Body. +func (client VpnLinkConnectionsClient) GetIkeSasResponder(resp *http.Response) (result String, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVpnConnection retrieves all vpn site link connections for a particular virtual wan vpn gateway vpn connection. +// Parameters: +// resourceGroupName - the resource group name of the vpn gateway. +// gatewayName - the name of the gateway. +// connectionName - the name of the vpn connection. +func (client VpnLinkConnectionsClient) ListByVpnConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result ListVpnSiteLinkConnectionsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnLinkConnectionsClient.ListByVpnConnection") + defer func() { + sc := -1 + if result.lvslcr.Response.Response != nil { + sc = result.lvslcr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVpnConnectionNextResults + req, err := client.ListByVpnConnectionPreparer(ctx, resourceGroupName, gatewayName, connectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "ListByVpnConnection", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVpnConnectionSender(req) + if err != nil { + result.lvslcr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "ListByVpnConnection", resp, "Failure sending request") + return + } + + result.lvslcr, err = client.ListByVpnConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "ListByVpnConnection", resp, "Failure responding to request") + return + } + if result.lvslcr.hasNextLink() && result.lvslcr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVpnConnectionPreparer prepares the ListByVpnConnection request. +func (client VpnLinkConnectionsClient) ListByVpnConnectionPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVpnConnectionSender sends the ListByVpnConnection request. The method will close the +// http.Response Body if it receives an error. +func (client VpnLinkConnectionsClient) ListByVpnConnectionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVpnConnectionResponder handles the response to the ListByVpnConnection request. The method always +// closes the http.Response Body. +func (client VpnLinkConnectionsClient) ListByVpnConnectionResponder(resp *http.Response) (result ListVpnSiteLinkConnectionsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVpnConnectionNextResults retrieves the next set of results, if any. +func (client VpnLinkConnectionsClient) listByVpnConnectionNextResults(ctx context.Context, lastResults ListVpnSiteLinkConnectionsResult) (result ListVpnSiteLinkConnectionsResult, err error) { + req, err := lastResults.listVpnSiteLinkConnectionsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "listByVpnConnectionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVpnConnectionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "listByVpnConnectionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVpnConnectionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "listByVpnConnectionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVpnConnectionComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnLinkConnectionsClient) ListByVpnConnectionComplete(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string) (result ListVpnSiteLinkConnectionsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnLinkConnectionsClient.ListByVpnConnection") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVpnConnection(ctx, resourceGroupName, gatewayName, connectionName) + return +} + +// ResetConnection resets the VpnLink connection specified. +// Parameters: +// resourceGroupName - the name of the resource group. +// gatewayName - the name of the gateway. +// connectionName - the name of the vpn connection. +// linkConnectionName - the name of the vpn link connection. +func (client VpnLinkConnectionsClient) ResetConnection(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result VpnLinkConnectionsResetConnectionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnLinkConnectionsClient.ResetConnection") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResetConnectionPreparer(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "ResetConnection", nil, "Failure preparing request") + return + } + + result, err = client.ResetConnectionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnLinkConnectionsClient", "ResetConnection", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetConnectionPreparer prepares the ResetConnection request. +func (client VpnLinkConnectionsClient) ResetConnectionPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "linkConnectionName": autorest.Encode("path", linkConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}/resetconnection", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetConnectionSender sends the ResetConnection request. The method will close the +// http.Response Body if it receives an error. +func (client VpnLinkConnectionsClient) ResetConnectionSender(req *http.Request) (future VpnLinkConnectionsResetConnectionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetConnectionResponder handles the response to the ResetConnection request. The method always +// closes the http.Response Body. +func (client VpnLinkConnectionsClient) ResetConnectionResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnserverconfigurations.go b/services/network/mgmt/2021-08-01/network/vpnserverconfigurations.go new file mode 100644 index 000000000000..14784a641112 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnserverconfigurations.go @@ -0,0 +1,578 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnServerConfigurationsClient is the network Client +type VpnServerConfigurationsClient struct { + BaseClient +} + +// NewVpnServerConfigurationsClient creates an instance of the VpnServerConfigurationsClient client. +func NewVpnServerConfigurationsClient(subscriptionID string) VpnServerConfigurationsClient { + return NewVpnServerConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnServerConfigurationsClientWithBaseURI creates an instance of the VpnServerConfigurationsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVpnServerConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) VpnServerConfigurationsClient { + return VpnServerConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VpnServerConfiguration resource if it doesn't exist else updates the existing +// VpnServerConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration being created or updated. +// vpnServerConfigurationParameters - parameters supplied to create or update VpnServerConfiguration. +func (client VpnServerConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VpnServerConfiguration) (result VpnServerConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VpnServerConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters VpnServerConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vpnServerConfigurationParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", pathParameters), + autorest.WithJSON(vpnServerConfigurationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future VpnServerConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result VpnServerConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VpnServerConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration being deleted. +func (client VpnServerConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result VpnServerConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, vpnServerConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VpnServerConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) DeleteSender(req *http.Request) (future VpnServerConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a VpnServerConfiguration. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration being retrieved. +func (client VpnServerConfigurationsClient) Get(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (result VpnServerConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vpnServerConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnServerConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) GetResponder(resp *http.Response) (result VpnServerConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the VpnServerConfigurations in a subscription. +func (client VpnServerConfigurationsClient) List(ctx context.Context) (result ListVpnServerConfigurationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.List") + defer func() { + sc := -1 + if result.lvscr.Response.Response != nil { + sc = result.lvscr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvscr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.lvscr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.lvscr.hasNextLink() && result.lvscr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VpnServerConfigurationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnServerConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) ListResponder(resp *http.Response) (result ListVpnServerConfigurationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VpnServerConfigurationsClient) listNextResults(ctx context.Context, lastResults ListVpnServerConfigurationsResult) (result ListVpnServerConfigurationsResult, err error) { + req, err := lastResults.listVpnServerConfigurationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnServerConfigurationsClient) ListComplete(ctx context.Context) (result ListVpnServerConfigurationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the vpnServerConfigurations in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +func (client VpnServerConfigurationsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListVpnServerConfigurationsResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lvscr.Response.Response != nil { + sc = result.lvscr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lvscr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lvscr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lvscr.hasNextLink() && result.lvscr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VpnServerConfigurationsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) ListByResourceGroupResponder(resp *http.Response) (result ListVpnServerConfigurationsResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VpnServerConfigurationsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListVpnServerConfigurationsResult) (result ListVpnServerConfigurationsResult, err error) { + req, err := lastResults.listVpnServerConfigurationsResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnServerConfigurationsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListVpnServerConfigurationsResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates VpnServerConfiguration tags. +// Parameters: +// resourceGroupName - the resource group name of the VpnServerConfiguration. +// vpnServerConfigurationName - the name of the VpnServerConfiguration being updated. +// vpnServerConfigurationParameters - parameters supplied to update VpnServerConfiguration tags. +func (client VpnServerConfigurationsClient) UpdateTags(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject) (result VpnServerConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, vpnServerConfigurationName, vpnServerConfigurationParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VpnServerConfigurationsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, vpnServerConfigurationName string, vpnServerConfigurationParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnServerConfigurationName": autorest.Encode("path", vpnServerConfigurationName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnServerConfigurations/{vpnServerConfigurationName}", pathParameters), + autorest.WithJSON(vpnServerConfigurationParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsClient) UpdateTagsResponder(resp *http.Response) (result VpnServerConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go b/services/network/mgmt/2021-08-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go new file mode 100644 index 000000000000..21176b057549 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnserverconfigurationsassociatedwithvirtualwan.go @@ -0,0 +1,112 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnServerConfigurationsAssociatedWithVirtualWanClient is the network Client +type VpnServerConfigurationsAssociatedWithVirtualWanClient struct { + BaseClient +} + +// NewVpnServerConfigurationsAssociatedWithVirtualWanClient creates an instance of the +// VpnServerConfigurationsAssociatedWithVirtualWanClient client. +func NewVpnServerConfigurationsAssociatedWithVirtualWanClient(subscriptionID string) VpnServerConfigurationsAssociatedWithVirtualWanClient { + return NewVpnServerConfigurationsAssociatedWithVirtualWanClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnServerConfigurationsAssociatedWithVirtualWanClientWithBaseURI creates an instance of the +// VpnServerConfigurationsAssociatedWithVirtualWanClient client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVpnServerConfigurationsAssociatedWithVirtualWanClientWithBaseURI(baseURI string, subscriptionID string) VpnServerConfigurationsAssociatedWithVirtualWanClient { + return VpnServerConfigurationsAssociatedWithVirtualWanClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN whose associated VpnServerConfigurations is needed. +func (client VpnServerConfigurationsAssociatedWithVirtualWanClient) List(ctx context.Context, resourceGroupName string, virtualWANName string) (result VpnServerConfigurationsAssociatedWithVirtualWanListFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnServerConfigurationsAssociatedWithVirtualWanClient.List") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName, virtualWANName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanClient", "List", nil, "Failure preparing request") + return + } + + result, err = client.ListSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnServerConfigurationsAssociatedWithVirtualWanClient", "List", result.Response(), "Failure sending request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VpnServerConfigurationsAssociatedWithVirtualWanClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualWANName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualWans/{virtualWANName}/vpnServerConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VpnServerConfigurationsAssociatedWithVirtualWanClient) ListSender(req *http.Request) (future VpnServerConfigurationsAssociatedWithVirtualWanListFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VpnServerConfigurationsAssociatedWithVirtualWanClient) ListResponder(resp *http.Response) (result VpnServerConfigurationsResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnsitelinkconnections.go b/services/network/mgmt/2021-08-01/network/vpnsitelinkconnections.go new file mode 100644 index 000000000000..b4b1695a678b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnsitelinkconnections.go @@ -0,0 +1,112 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnSiteLinkConnectionsClient is the network Client +type VpnSiteLinkConnectionsClient struct { + BaseClient +} + +// NewVpnSiteLinkConnectionsClient creates an instance of the VpnSiteLinkConnectionsClient client. +func NewVpnSiteLinkConnectionsClient(subscriptionID string) VpnSiteLinkConnectionsClient { + return NewVpnSiteLinkConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnSiteLinkConnectionsClientWithBaseURI creates an instance of the VpnSiteLinkConnectionsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVpnSiteLinkConnectionsClientWithBaseURI(baseURI string, subscriptionID string) VpnSiteLinkConnectionsClient { + return VpnSiteLinkConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves the details of a vpn site link connection. +// Parameters: +// resourceGroupName - the resource group name of the VpnGateway. +// gatewayName - the name of the gateway. +// connectionName - the name of the vpn connection. +// linkConnectionName - the name of the vpn connection. +func (client VpnSiteLinkConnectionsClient) Get(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (result VpnSiteLinkConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSiteLinkConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, gatewayName, connectionName, linkConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinkConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnSiteLinkConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, gatewayName string, connectionName string, linkConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "connectionName": autorest.Encode("path", connectionName), + "gatewayName": autorest.Encode("path", gatewayName), + "linkConnectionName": autorest.Encode("path", linkConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}/vpnLinkConnections/{linkConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSiteLinkConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnSiteLinkConnectionsClient) GetResponder(resp *http.Response) (result VpnSiteLinkConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnsitelinks.go b/services/network/mgmt/2021-08-01/network/vpnsitelinks.go new file mode 100644 index 000000000000..284ac1665d37 --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnsitelinks.go @@ -0,0 +1,227 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnSiteLinksClient is the network Client +type VpnSiteLinksClient struct { + BaseClient +} + +// NewVpnSiteLinksClient creates an instance of the VpnSiteLinksClient client. +func NewVpnSiteLinksClient(subscriptionID string) VpnSiteLinksClient { + return NewVpnSiteLinksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnSiteLinksClientWithBaseURI creates an instance of the VpnSiteLinksClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVpnSiteLinksClientWithBaseURI(baseURI string, subscriptionID string) VpnSiteLinksClient { + return VpnSiteLinksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get retrieves the details of a VPN site link. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite. +// vpnSiteLinkName - the name of the VpnSiteLink being retrieved. +func (client VpnSiteLinksClient) Get(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteLinkName string) (result VpnSiteLink, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSiteLinksClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vpnSiteName, vpnSiteLinkName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnSiteLinksClient) GetPreparer(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteLinkName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteLinkName": autorest.Encode("path", vpnSiteLinkName), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks/{vpnSiteLinkName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSiteLinksClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnSiteLinksClient) GetResponder(resp *http.Response) (result VpnSiteLink, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByVpnSite lists all the vpnSiteLinks in a resource group for a vpn site. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite. +func (client VpnSiteLinksClient) ListByVpnSite(ctx context.Context, resourceGroupName string, vpnSiteName string) (result ListVpnSiteLinksResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSiteLinksClient.ListByVpnSite") + defer func() { + sc := -1 + if result.lvslr.Response.Response != nil { + sc = result.lvslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByVpnSiteNextResults + req, err := client.ListByVpnSitePreparer(ctx, resourceGroupName, vpnSiteName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "ListByVpnSite", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVpnSiteSender(req) + if err != nil { + result.lvslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "ListByVpnSite", resp, "Failure sending request") + return + } + + result.lvslr, err = client.ListByVpnSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "ListByVpnSite", resp, "Failure responding to request") + return + } + if result.lvslr.hasNextLink() && result.lvslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByVpnSitePreparer prepares the ListByVpnSite request. +func (client VpnSiteLinksClient) ListByVpnSitePreparer(ctx context.Context, resourceGroupName string, vpnSiteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}/vpnSiteLinks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVpnSiteSender sends the ListByVpnSite request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSiteLinksClient) ListByVpnSiteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVpnSiteResponder handles the response to the ListByVpnSite request. The method always +// closes the http.Response Body. +func (client VpnSiteLinksClient) ListByVpnSiteResponder(resp *http.Response) (result ListVpnSiteLinksResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByVpnSiteNextResults retrieves the next set of results, if any. +func (client VpnSiteLinksClient) listByVpnSiteNextResults(ctx context.Context, lastResults ListVpnSiteLinksResult) (result ListVpnSiteLinksResult, err error) { + req, err := lastResults.listVpnSiteLinksResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "listByVpnSiteNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByVpnSiteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "listByVpnSiteNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByVpnSiteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSiteLinksClient", "listByVpnSiteNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByVpnSiteComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnSiteLinksClient) ListByVpnSiteComplete(ctx context.Context, resourceGroupName string, vpnSiteName string) (result ListVpnSiteLinksResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSiteLinksClient.ListByVpnSite") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByVpnSite(ctx, resourceGroupName, vpnSiteName) + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnsites.go b/services/network/mgmt/2021-08-01/network/vpnsites.go new file mode 100644 index 000000000000..4524ca65ab0c --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnsites.go @@ -0,0 +1,590 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnSitesClient is the network Client +type VpnSitesClient struct { + BaseClient +} + +// NewVpnSitesClient creates an instance of the VpnSitesClient client. +func NewVpnSitesClient(subscriptionID string) VpnSitesClient { + return NewVpnSitesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnSitesClientWithBaseURI creates an instance of the VpnSitesClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewVpnSitesClientWithBaseURI(baseURI string, subscriptionID string) VpnSitesClient { + return VpnSitesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite being created or updated. +// vpnSiteParameters - parameters supplied to create or update VpnSite. +func (client VpnSitesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VpnSite) (result VpnSitesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: vpnSiteParameters, + Constraints: []validation.Constraint{{Target: "vpnSiteParameters.VpnSiteProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnSiteParameters.VpnSiteProperties.BgpProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnSiteParameters.VpnSiteProperties.BgpProperties.Asn", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "vpnSiteParameters.VpnSiteProperties.BgpProperties.Asn", Name: validation.InclusiveMaximum, Rule: int64(4294967295), Chain: nil}, + {Target: "vpnSiteParameters.VpnSiteProperties.BgpProperties.Asn", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.VpnSitesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client VpnSitesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VpnSite) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + vpnSiteParameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", pathParameters), + autorest.WithJSON(vpnSiteParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) CreateOrUpdateSender(req *http.Request) (future VpnSitesCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) CreateOrUpdateResponder(resp *http.Response) (result VpnSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes a VpnSite. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite being deleted. +func (client VpnSitesClient) Delete(ctx context.Context, resourceGroupName string, vpnSiteName string) (result VpnSitesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, vpnSiteName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client VpnSitesClient) DeletePreparer(ctx context.Context, resourceGroupName string, vpnSiteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) DeleteSender(req *http.Request) (future VpnSitesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieves the details of a VPN site. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite being retrieved. +func (client VpnSitesClient) Get(ctx context.Context, resourceGroupName string, vpnSiteName string) (result VpnSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, vpnSiteName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client VpnSitesClient) GetPreparer(ctx context.Context, resourceGroupName string, vpnSiteName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) GetResponder(resp *http.Response) (result VpnSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all the VpnSites in a subscription. +func (client VpnSitesClient) List(ctx context.Context) (result ListVpnSitesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.List") + defer func() { + sc := -1 + if result.lvsr.Response.Response != nil { + sc = result.lvsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.lvsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "List", resp, "Failure sending request") + return + } + + result.lvsr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "List", resp, "Failure responding to request") + return + } + if result.lvsr.hasNextLink() && result.lvsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client VpnSitesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/vpnSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) ListResponder(resp *http.Response) (result ListVpnSitesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client VpnSitesClient) listNextResults(ctx context.Context, lastResults ListVpnSitesResult) (result ListVpnSitesResult, err error) { + req, err := lastResults.listVpnSitesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnSitesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnSitesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnSitesClient) ListComplete(ctx context.Context) (result ListVpnSitesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup lists all the vpnSites in a resource group. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +func (client VpnSitesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ListVpnSitesResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.lvsr.Response.Response != nil { + sc = result.lvsr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.lvsr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.lvsr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.lvsr.hasNextLink() && result.lvsr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client VpnSitesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) ListByResourceGroupResponder(resp *http.Response) (result ListVpnSitesResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client VpnSitesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ListVpnSitesResult) (result ListVpnSitesResult, err error) { + req, err := lastResults.listVpnSitesResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.VpnSitesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.VpnSitesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client VpnSitesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ListVpnSitesResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags updates VpnSite tags. +// Parameters: +// resourceGroupName - the resource group name of the VpnSite. +// vpnSiteName - the name of the VpnSite being updated. +// vpnSiteParameters - parameters supplied to update VpnSite tags. +func (client VpnSitesClient) UpdateTags(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters TagsObject) (result VpnSite, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client VpnSitesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vpnSiteName": autorest.Encode("path", vpnSiteName), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/vpnSites/{vpnSiteName}", pathParameters), + autorest.WithJSON(vpnSiteParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client VpnSitesClient) UpdateTagsResponder(resp *http.Response) (result VpnSite, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/vpnsitesconfiguration.go b/services/network/mgmt/2021-08-01/network/vpnsitesconfiguration.go new file mode 100644 index 000000000000..1cc56fb2eccf --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/vpnsitesconfiguration.go @@ -0,0 +1,120 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// VpnSitesConfigurationClient is the network Client +type VpnSitesConfigurationClient struct { + BaseClient +} + +// NewVpnSitesConfigurationClient creates an instance of the VpnSitesConfigurationClient client. +func NewVpnSitesConfigurationClient(subscriptionID string) VpnSitesConfigurationClient { + return NewVpnSitesConfigurationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewVpnSitesConfigurationClientWithBaseURI creates an instance of the VpnSitesConfigurationClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewVpnSitesConfigurationClientWithBaseURI(baseURI string, subscriptionID string) VpnSitesConfigurationClient { + return VpnSitesConfigurationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Download gives the sas-url to download the configurations for vpn-sites in a resource group. +// Parameters: +// resourceGroupName - the resource group name. +// virtualWANName - the name of the VirtualWAN for which configuration of all vpn-sites is needed. +// request - parameters supplied to download vpn-sites configuration. +func (client VpnSitesConfigurationClient) Download(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVpnSitesConfigurationRequest) (result VpnSitesConfigurationDownloadFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesConfigurationClient.Download") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: request, + Constraints: []validation.Constraint{{Target: "request.OutputBlobSasURL", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.VpnSitesConfigurationClient", "Download", err.Error()) + } + + req, err := client.DownloadPreparer(ctx, resourceGroupName, virtualWANName, request) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesConfigurationClient", "Download", nil, "Failure preparing request") + return + } + + result, err = client.DownloadSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VpnSitesConfigurationClient", "Download", result.Response(), "Failure sending request") + return + } + + return +} + +// DownloadPreparer prepares the Download request. +func (client VpnSitesConfigurationClient) DownloadPreparer(ctx context.Context, resourceGroupName string, virtualWANName string, request GetVpnSitesConfigurationRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "virtualWANName": autorest.Encode("path", virtualWANName), + } + + const APIVersion = "2021-08-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/virtualWans/{virtualWANName}/vpnConfiguration", pathParameters), + autorest.WithJSON(request), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DownloadSender sends the Download request. The method will close the +// http.Response Body if it receives an error. +func (client VpnSitesConfigurationClient) DownloadSender(req *http.Request) (future VpnSitesConfigurationDownloadFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DownloadResponder handles the response to the Download request. The method always +// closes the http.Response Body. +func (client VpnSitesConfigurationClient) DownloadResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/network/mgmt/2021-08-01/network/watchers.go b/services/network/mgmt/2021-08-01/network/watchers.go new file mode 100644 index 000000000000..abdca8fdd90b --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/watchers.go @@ -0,0 +1,1568 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WatchersClient is the network Client +type WatchersClient struct { + BaseClient +} + +// NewWatchersClient creates an instance of the WatchersClient client. +func NewWatchersClient(subscriptionID string) WatchersClient { + return NewWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatchersClientWithBaseURI creates an instance of the WatchersClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWatchersClientWithBaseURI(baseURI string, subscriptionID string) WatchersClient { + return WatchersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckConnectivity verifies the possibility of establishing a direct TCP connection from a virtual machine to a given +// endpoint including another VM or an arbitrary remote server. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that determine how the connectivity check will be performed. +func (client WatchersClient) CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (result WatchersCheckConnectivityFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CheckConnectivity") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.Source", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Source.ResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Source.Port", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Source.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "parameters.Source.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "parameters.Destination", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.Destination.Port", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.Destination.Port", Name: validation.InclusiveMaximum, Rule: int64(65535), Chain: nil}, + {Target: "parameters.Destination.Port", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("network.WatchersClient", "CheckConnectivity", err.Error()) + } + + req, err := client.CheckConnectivityPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", nil, "Failure preparing request") + return + } + + result, err = client.CheckConnectivitySender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CheckConnectivity", result.Response(), "Failure sending request") + return + } + + return +} + +// CheckConnectivityPreparer prepares the CheckConnectivity request. +func (client WatchersClient) CheckConnectivityPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConnectivityParameters) (*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 = "2021-08-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}/connectivityCheck", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckConnectivitySender sends the CheckConnectivity request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) CheckConnectivitySender(req *http.Request) (future WatchersCheckConnectivityFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CheckConnectivityResponder handles the response to the CheckConnectivity request. The method always +// closes the http.Response Body. +func (client WatchersClient) CheckConnectivityResponder(resp *http.Response) (result ConnectivityInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate creates or updates a network watcher in the specified resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the network watcher resource. +func (client WatchersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatchersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters Watcher) (*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 = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + 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{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatchersClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + 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. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +func (client WatchersClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result WatchersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WatchersClient) DeletePreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) DeleteSender(req *http.Request) (future WatchersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the specified network watcher by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +func (client WatchersClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatchersClient) GetPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAzureReachabilityReport nOTE: This feature is currently in preview and still being tested for stability. Gets the +// relative latency score for internet service providers from a specified location to Azure regions. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that determine Azure reachability report configuration. +func (client WatchersClient) GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (result WatchersGetAzureReachabilityReportFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetAzureReachabilityReport") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ProviderLocation", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ProviderLocation.Country", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.StartTime", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.EndTime", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.WatchersClient", "GetAzureReachabilityReport", err.Error()) + } + + req, err := client.GetAzureReachabilityReportPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", nil, "Failure preparing request") + return + } + + result, err = client.GetAzureReachabilityReportSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetAzureReachabilityReport", result.Response(), "Failure sending request") + return + } + + return +} + +// GetAzureReachabilityReportPreparer prepares the GetAzureReachabilityReport request. +func (client WatchersClient) GetAzureReachabilityReportPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AzureReachabilityReportParameters) (*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 = "2021-08-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}/azureReachabilityReport", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAzureReachabilityReportSender sends the GetAzureReachabilityReport request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetAzureReachabilityReportSender(req *http.Request) (future WatchersGetAzureReachabilityReportFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetAzureReachabilityReportResponder handles the response to the GetAzureReachabilityReport request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetAzureReachabilityReportResponder(resp *http.Response) (result AzureReachabilityReport, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetFlowLogStatus queries status of flow log and traffic analytics (optional) on a specified resource. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define a resource to query flow log and traffic analytics (optional) status. +func (client WatchersClient) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (result WatchersGetFlowLogStatusFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetFlowLogStatus") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "GetFlowLogStatus", err.Error()) + } + + req, err := client.GetFlowLogStatusPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", nil, "Failure preparing request") + return + } + + result, err = client.GetFlowLogStatusSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetFlowLogStatus", result.Response(), "Failure sending request") + return + } + + return +} + +// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request. +func (client WatchersClient) GetFlowLogStatusPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters) (*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 = "2021-08-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}/queryFlowLogStatus", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetFlowLogStatusSender(req *http.Request) (future WatchersGetFlowLogStatusFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result FlowLogInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkConfigurationDiagnostic gets Network Configuration Diagnostic data to help customers understand and debug +// network behavior. It provides detailed information on what security rules were applied to a specified traffic flow +// and the result of evaluating these rules. Customers must provide details of a flow like source, destination, +// protocol, etc. The API returns whether traffic was allowed or denied, the rules evaluated for the specified flow and +// the evaluation results. +// 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 tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNetworkConfigurationDiagnostic") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Profiles", 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 = "2021-08-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 + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + 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, + 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. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the source and destination endpoint. +func (client WatchersClient) GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (result WatchersGetNextHopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetNextHop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "GetNextHop", err.Error()) + } + + req, err := client.GetNextHopPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", nil, "Failure preparing request") + return + } + + result, err = client.GetNextHopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNextHop", result.Response(), "Failure sending request") + return + } + + return +} + +// GetNextHopPreparer prepares the GetNextHop request. +func (client WatchersClient) GetNextHopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters NextHopParameters) (*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 = "2021-08-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}/nextHop", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNextHopSender sends the GetNextHop request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetNextHopSender(req *http.Request) (future WatchersGetNextHopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetNextHopResponder handles the response to the GetNextHop request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetNextHopResponder(resp *http.Response) (result NextHopResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTopology gets the current network topology by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the representation of topology. +func (client WatchersClient) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTopology") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetTopologyPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", nil, "Failure preparing request") + return + } + + resp, err := client.GetTopologySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure sending request") + return + } + + result, err = client.GetTopologyResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTopology", resp, "Failure responding to request") + return + } + + return +} + +// GetTopologyPreparer prepares the GetTopology request. +func (client WatchersClient) GetTopologyPreparer(ctx context.Context, 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), + } + + const APIVersion = "2021-08-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}/topology", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTopologySender sends the GetTopology request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetTopologyResponder handles the response to the GetTopology request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTroubleshooting initiate troubleshooting on a specified resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the resource to troubleshoot. +func (client WatchersClient) GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (result WatchersGetTroubleshootingFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshooting") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "GetTroubleshooting", err.Error()) + } + + req, err := client.GetTroubleshootingPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", nil, "Failure preparing request") + return + } + + result, err = client.GetTroubleshootingSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshooting", result.Response(), "Failure sending request") + return + } + + return +} + +// GetTroubleshootingPreparer prepares the GetTroubleshooting request. +func (client WatchersClient) GetTroubleshootingPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters) (*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 = "2021-08-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}/troubleshoot", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTroubleshootingSender(req *http.Request) (future WatchersGetTroubleshootingFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTroubleshootingResponder(resp *http.Response) (result TroubleshootingResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetTroubleshootingResult get the last completed troubleshooting result on a specified resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the resource to query the troubleshooting result. +func (client WatchersClient) GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (result WatchersGetTroubleshootingResultFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetTroubleshootingResult") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "GetTroubleshootingResult", err.Error()) + } + + req, err := client.GetTroubleshootingResultPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request") + return + } + + result, err = client.GetTroubleshootingResultSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetTroubleshootingResult", result.Response(), "Failure sending request") + return + } + + return +} + +// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request. +func (client WatchersClient) GetTroubleshootingResultPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters) (*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 = "2021-08-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}/queryTroubleshootResult", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetTroubleshootingResultSender(req *http.Request) (future WatchersGetTroubleshootingResultFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result TroubleshootingResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetVMSecurityRules gets the configured and effective security group rules on the specified VM. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the VM to check security groups for. +func (client WatchersClient) GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (result WatchersGetVMSecurityRulesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.GetVMSecurityRules") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "GetVMSecurityRules", err.Error()) + } + + req, err := client.GetVMSecurityRulesPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", nil, "Failure preparing request") + return + } + + result, err = client.GetVMSecurityRulesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetVMSecurityRules", result.Response(), "Failure sending request") + return + } + + return +} + +// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request. +func (client WatchersClient) GetVMSecurityRulesPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters) (*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 = "2021-08-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}/securityGroupView", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetVMSecurityRulesSender(req *http.Request) (future WatchersGetVMSecurityRulesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result SecurityGroupViewResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all network watchers by resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client WatchersClient) List(ctx context.Context, resourceGroupName string) (result WatcherListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WatchersClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WatchersClient) ListResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + 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 WatchersClient) ListAll(ctx context.Context) (result WatcherListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAll") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure sending request") + return + } + + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAll", resp, "Failure responding to request") + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client WatchersClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": 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{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client WatchersClient) ListAllResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAvailableProviders nOTE: This feature is currently in preview and still being tested for stability. Lists all +// available internet service providers for a specified Azure region. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that scope the list of available providers. +func (client WatchersClient) ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (result WatchersListAvailableProvidersFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.ListAvailableProviders") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAvailableProvidersPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", nil, "Failure preparing request") + return + } + + result, err = client.ListAvailableProvidersSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "ListAvailableProviders", result.Response(), "Failure sending request") + return + } + + return +} + +// ListAvailableProvidersPreparer prepares the ListAvailableProviders request. +func (client WatchersClient) ListAvailableProvidersPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters AvailableProvidersListParameters) (*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 = "2021-08-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}/availableProvidersList", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAvailableProvidersSender sends the ListAvailableProviders request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) ListAvailableProvidersSender(req *http.Request) (future WatchersListAvailableProvidersFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ListAvailableProvidersResponder handles the response to the ListAvailableProviders request. The method always +// closes the http.Response Body. +func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response) (result AvailableProvidersList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SetFlowLogConfiguration configures flow log and traffic analytics (optional) on a specified resource. +// Parameters: +// resourceGroupName - the name of the network watcher resource group. +// networkWatcherName - the name of the network watcher resource. +// parameters - parameters that define the configuration of flow log. +func (client WatchersClient) SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (result WatchersSetFlowLogConfigurationFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.SetFlowLogConfiguration") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "SetFlowLogConfiguration", err.Error()) + } + + req, err := client.SetFlowLogConfigurationPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request") + return + } + + result, err = client.SetFlowLogConfigurationSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "SetFlowLogConfiguration", result.Response(), "Failure sending request") + return + } + + return +} + +// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request. +func (client WatchersClient) SetFlowLogConfigurationPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters FlowLogInformation) (*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 = "2021-08-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}/configureFlowLog", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) SetFlowLogConfigurationSender(req *http.Request) (future WatchersSetFlowLogConfigurationFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always +// closes the http.Response Body. +func (client WatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result FlowLogInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateTags updates a network watcher tags. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters supplied to update network watcher tags. +func (client WatchersClient) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client WatchersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters TagsObject) (*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 = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + 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{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client WatchersClient) UpdateTagsResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// VerifyIPFlow verify IP flow from the specified VM to a location given the currently configured NSG rules. +// Parameters: +// resourceGroupName - the name of the resource group. +// networkWatcherName - the name of the network watcher. +// parameters - parameters that define the IP flow to be verified. +func (client WatchersClient) VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (result WatchersVerifyIPFlowFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatchersClient.VerifyIPFlow") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + 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.NewError("network.WatchersClient", "VerifyIPFlow", err.Error()) + } + + req, err := client.VerifyIPFlowPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", nil, "Failure preparing request") + return + } + + result, err = client.VerifyIPFlowSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "VerifyIPFlow", result.Response(), "Failure sending request") + return + } + + return +} + +// VerifyIPFlowPreparer prepares the VerifyIPFlow request. +func (client WatchersClient) VerifyIPFlowPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters) (*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 = "2021-08-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}/ipFlowVerify", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) VerifyIPFlowSender(req *http.Request) (future WatchersVerifyIPFlowFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always +// closes the http.Response Body. +func (client WatchersClient) VerifyIPFlowResponder(resp *http.Response) (result VerificationIPFlowResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/network/mgmt/2021-08-01/network/webapplicationfirewallpolicies.go b/services/network/mgmt/2021-08-01/network/webapplicationfirewallpolicies.go new file mode 100644 index 000000000000..5a0a6a2b315e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/webapplicationfirewallpolicies.go @@ -0,0 +1,525 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WebApplicationFirewallPoliciesClient is the network Client +type WebApplicationFirewallPoliciesClient struct { + BaseClient +} + +// NewWebApplicationFirewallPoliciesClient creates an instance of the WebApplicationFirewallPoliciesClient client. +func NewWebApplicationFirewallPoliciesClient(subscriptionID string) WebApplicationFirewallPoliciesClient { + return NewWebApplicationFirewallPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebApplicationFirewallPoliciesClientWithBaseURI creates an instance of the WebApplicationFirewallPoliciesClient +// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI +// (sovereign clouds, Azure stack). +func NewWebApplicationFirewallPoliciesClientWithBaseURI(baseURI string, subscriptionID string) WebApplicationFirewallPoliciesClient { + return WebApplicationFirewallPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or update policy with specified rule set name within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// policyName - the name of the policy. +// parameters - policy to be created. +func (client WebApplicationFirewallPoliciesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (result WebApplicationFirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.MaxRequestBodySizeInKb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.MaxRequestBodySizeInKb", Name: validation.InclusiveMinimum, Rule: int64(8), Chain: nil}}}, + {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.FileUploadLimitInMb", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.PolicySettings.FileUploadLimitInMb", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}}}, + }}, + {Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.ManagedRules", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.WebApplicationFirewallPolicyPropertiesFormat.ManagedRules.ManagedRuleSets", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("network.WebApplicationFirewallPoliciesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, policyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WebApplicationFirewallPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, policyName string, parameters WebApplicationFirewallPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Etag = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client WebApplicationFirewallPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WebApplicationFirewallPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes Policy. +// Parameters: +// resourceGroupName - the name of the resource group. +// policyName - the name of the policy. +func (client WebApplicationFirewallPoliciesClient) Delete(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPoliciesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.WebApplicationFirewallPoliciesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WebApplicationFirewallPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client WebApplicationFirewallPoliciesClient) DeleteSender(req *http.Request) (future WebApplicationFirewallPoliciesDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WebApplicationFirewallPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve protection policy with specified name within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +// policyName - the name of the policy. +func (client WebApplicationFirewallPoliciesClient) Get(ctx context.Context, resourceGroupName string, policyName string) (result WebApplicationFirewallPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: policyName, + Constraints: []validation.Constraint{{Target: "policyName", Name: validation.MaxLength, Rule: 128, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.WebApplicationFirewallPoliciesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, policyName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebApplicationFirewallPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, policyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "policyName": autorest.Encode("path", policyName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies/{policyName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WebApplicationFirewallPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebApplicationFirewallPoliciesClient) GetResponder(resp *http.Response) (result WebApplicationFirewallPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List lists all of the protection policies within a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client WebApplicationFirewallPoliciesClient) List(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.List") + defer func() { + sc := -1 + if result.wafplr.Response.Response != nil { + sc = result.wafplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.wafplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "List", resp, "Failure sending request") + return + } + + result.wafplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "List", resp, "Failure responding to request") + return + } + if result.wafplr.hasNextLink() && result.wafplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WebApplicationFirewallPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WebApplicationFirewallPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WebApplicationFirewallPoliciesClient) ListResponder(resp *http.Response) (result WebApplicationFirewallPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WebApplicationFirewallPoliciesClient) listNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyListResult) (result WebApplicationFirewallPolicyListResult, err error) { + req, err := lastResults.webApplicationFirewallPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebApplicationFirewallPoliciesClient) ListComplete(ctx context.Context, resourceGroupName string) (result WebApplicationFirewallPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName) + return +} + +// ListAll gets all the WAF policies in a subscription. +func (client WebApplicationFirewallPoliciesClient) ListAll(ctx context.Context) (result WebApplicationFirewallPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.ListAll") + defer func() { + sc := -1 + if result.wafplr.Response.Response != nil { + sc = result.wafplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.wafplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "ListAll", resp, "Failure sending request") + return + } + + result.wafplr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "ListAll", resp, "Failure responding to request") + return + } + if result.wafplr.hasNextLink() && result.wafplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client WebApplicationFirewallPoliciesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/ApplicationGatewayWebApplicationFirewallPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client WebApplicationFirewallPoliciesClient) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client WebApplicationFirewallPoliciesClient) ListAllResponder(resp *http.Response) (result WebApplicationFirewallPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client WebApplicationFirewallPoliciesClient) listAllNextResults(ctx context.Context, lastResults WebApplicationFirewallPolicyListResult) (result WebApplicationFirewallPolicyListResult, err error) { + req, err := lastResults.webApplicationFirewallPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebApplicationFirewallPoliciesClient", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebApplicationFirewallPoliciesClient) ListAllComplete(ctx context.Context) (result WebApplicationFirewallPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebApplicationFirewallPoliciesClient.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx) + return +} diff --git a/services/network/mgmt/2021-08-01/network/webcategories.go b/services/network/mgmt/2021-08-01/network/webcategories.go new file mode 100644 index 000000000000..13fb4c1fb72e --- /dev/null +++ b/services/network/mgmt/2021-08-01/network/webcategories.go @@ -0,0 +1,222 @@ +package network + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WebCategoriesClient is the network Client +type WebCategoriesClient struct { + BaseClient +} + +// NewWebCategoriesClient creates an instance of the WebCategoriesClient client. +func NewWebCategoriesClient(subscriptionID string) WebCategoriesClient { + return NewWebCategoriesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWebCategoriesClientWithBaseURI creates an instance of the WebCategoriesClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWebCategoriesClientWithBaseURI(baseURI string, subscriptionID string) WebCategoriesClient { + return WebCategoriesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified Azure Web Category. +// Parameters: +// name - the name of the azureWebCategory. +// expand - expands resourceIds back referenced by the azureWebCategory resource. +func (client WebCategoriesClient) Get(ctx context.Context, name string, expand string) (result AzureWebCategory, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebCategoriesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, name, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WebCategoriesClient) GetPreparer(ctx context.Context, name string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories/{name}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WebCategoriesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WebCategoriesClient) GetResponder(resp *http.Response) (result AzureWebCategory, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription gets all the Azure Web Categories in a subscription. +func (client WebCategoriesClient) ListBySubscription(ctx context.Context) (result AzureWebCategoryListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebCategoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.awclr.Response.Response != nil { + sc = result.awclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.awclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.awclr, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.awclr.hasNextLink() && result.awclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client WebCategoriesClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-08-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/azureWebCategories", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client WebCategoriesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client WebCategoriesClient) ListBySubscriptionResponder(resp *http.Response) (result AzureWebCategoryListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client WebCategoriesClient) listBySubscriptionNextResults(ctx context.Context, lastResults AzureWebCategoryListResult) (result AzureWebCategoryListResult, err error) { + req, err := lastResults.azureWebCategoryListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "network.WebCategoriesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "network.WebCategoriesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WebCategoriesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client WebCategoriesClient) ListBySubscriptionComplete(ctx context.Context) (result AzureWebCategoryListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WebCategoriesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx) + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/CHANGELOG.md b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json new file mode 100644 index 000000000000..8b1625a1ceee --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", + "readme": "/_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "tag": "package-preview-2022-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/containerservice/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go new file mode 100644 index 000000000000..90495e507bf9 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/agentpools.go @@ -0,0 +1,734 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// AgentPoolsClient is the the Container Service Client. +type AgentPoolsClient struct { + BaseClient +} + +// NewAgentPoolsClient creates an instance of the AgentPoolsClient client. +func NewAgentPoolsClient(subscriptionID string) AgentPoolsClient { + return NewAgentPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgentPoolsClientWithBaseURI creates an instance of the AgentPoolsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewAgentPoolsClientWithBaseURI(baseURI string, subscriptionID string) AgentPoolsClient { + return AgentPoolsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +// parameters - the agent pool to create or update. +func (client AgentPoolsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (result AgentPoolsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterAgentPoolProfileProperties.KubeletConfig.ContainerLogMaxFiles", Name: validation.InclusiveMinimum, Rule: int64(2), Chain: nil}}}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, agentPoolName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AgentPoolsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters AgentPool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) CreateOrUpdateSender(req *http.Request) (future AgentPoolsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) CreateOrUpdateResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +// ignorePodDisruptionBudget - ignore-pod-disruption-budget=true to delete those pods on a node without +// considering Pod Disruption Budget +func (client AgentPoolsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, ignorePodDisruptionBudget *bool) (result AgentPoolsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AgentPoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, ignorePodDisruptionBudget *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if ignorePodDisruptionBudget != nil { + queryParameters["ignore-pod-disruption-budget"] = autorest.Encode("query", *ignorePodDisruptionBudget) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) DeleteSender(req *http.Request) (future AgentPoolsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPool, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgentPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAvailableAgentPoolVersions see [supported Kubernetes +// versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version +// lifecycle. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolAvailableVersions, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetAvailableAgentPoolVersions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", err.Error()) + } + + req, err := client.GetAvailableAgentPoolVersionsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", nil, "Failure preparing request") + return + } + + resp, err := client.GetAvailableAgentPoolVersionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure sending request") + return + } + + result, err = client.GetAvailableAgentPoolVersionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetAvailableAgentPoolVersions", resp, "Failure responding to request") + return + } + + return +} + +// GetAvailableAgentPoolVersionsPreparer prepares the GetAvailableAgentPoolVersions request. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAvailableAgentPoolVersionsSender sends the GetAvailableAgentPoolVersions request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAvailableAgentPoolVersionsResponder handles the response to the GetAvailableAgentPoolVersions request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetAvailableAgentPoolVersionsResponder(resp *http.Response) (result AgentPoolAvailableVersions, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.GetUpgradeProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client AgentPoolsClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) GetUpgradeProfileResponder(resp *http.Response) (result AgentPoolUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client AgentPoolsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.aplr.Response.Response != nil { + sc = result.aplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure sending request") + return + } + + result.aplr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "List", resp, "Failure responding to request") + return + } + if result.aplr.hasNextLink() && result.aplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AgentPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) ListResponder(resp *http.Response) (result AgentPoolListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AgentPoolsClient) listNextResults(ctx context.Context, lastResults AgentPoolListResult) (result AgentPoolListResult, err error) { + req, err := lastResults.agentPoolListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AgentPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result AgentPoolListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} + +// UpgradeNodeImageVersion upgrading the node image version of an agent pool applies the newest OS and runtime updates +// to the nodes. AKS provides one new image per week with the latest updates. For more details on node image versions, +// see: https://docs.microsoft.com/azure/aks/node-image-upgrade +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// agentPoolName - the name of the agent pool. +func (client AgentPoolsClient) UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result AgentPoolsUpgradeNodeImageVersionFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolsClient.UpgradeNodeImageVersion") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", err.Error()) + } + + req, err := client.UpgradeNodeImageVersionPreparer(ctx, resourceGroupName, resourceName, agentPoolName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", nil, "Failure preparing request") + return + } + + result, err = client.UpgradeNodeImageVersionSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsClient", "UpgradeNodeImageVersion", result.Response(), "Failure sending request") + return + } + + return +} + +// UpgradeNodeImageVersionPreparer prepares the UpgradeNodeImageVersion request. +func (client AgentPoolsClient) UpgradeNodeImageVersionPreparer(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agentPoolName": autorest.Encode("path", agentPoolName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpgradeNodeImageVersionSender sends the UpgradeNodeImageVersion request. The method will close the +// http.Response Body if it receives an error. +func (client AgentPoolsClient) UpgradeNodeImageVersionSender(req *http.Request) (future AgentPoolsUpgradeNodeImageVersionFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpgradeNodeImageVersionResponder handles the response to the UpgradeNodeImageVersion request. The method always +// closes the http.Response Body. +func (client AgentPoolsClient) UpgradeNodeImageVersionResponder(resp *http.Response) (result AgentPool, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go new file mode 100644 index 000000000000..c28b2f59ab53 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/client.go @@ -0,0 +1,41 @@ +// Package containerservice implements the Azure ARM Containerservice service API version 2022-03-02-preview. +// +// The Container Service Client. +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Containerservice + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Containerservice. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/containerserviceapi/interfaces.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/containerserviceapi/interfaces.go new file mode 100644 index 000000000000..e41113c37a92 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/containerserviceapi/interfaces.go @@ -0,0 +1,127 @@ +package containerserviceapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result containerservice.OperationListResult, err error) +} + +var _ OperationsClientAPI = (*containerservice.OperationsClient)(nil) + +// ManagedClustersClientAPI contains the set of methods on the ManagedClustersClient type. +type ManagedClustersClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedCluster) (result containerservice.ManagedClustersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, ignorePodDisruptionBudget *bool) (result containerservice.ManagedClustersDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedCluster, err error) + GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result containerservice.ManagedClusterAccessProfile, err error) + GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result containerservice.RunCommandResult, err error) + GetOSOptions(ctx context.Context, location string, resourceType string) (result containerservice.OSOptionProfile, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClusterUpgradeProfile, err error) + List(ctx context.Context) (result containerservice.ManagedClusterListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.ManagedClusterListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterListResultIterator, err error) + ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result containerservice.CredentialResults, err error) + ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter containerservice.Format) (result containerservice.CredentialResults, err error) + ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionPage, err error) + ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.OutboundEnvironmentEndpointCollectionIterator, err error) + ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterAADProfile) (result containerservice.ManagedClustersResetAADProfileFuture, err error) + ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterServicePrincipalProfile) (result containerservice.ManagedClustersResetServicePrincipalProfileFuture, err error) + RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersRotateClusterCertificatesFuture, err error) + RotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersRotateServiceAccountSigningKeysFuture, err error) + RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload containerservice.RunCommandRequest) (result containerservice.ManagedClustersRunCommandFuture, err error) + Start(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStartFuture, err error) + Stop(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClustersStopFuture, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.ManagedClustersUpdateTagsFuture, err error) +} + +var _ ManagedClustersClientAPI = (*containerservice.ManagedClustersClient)(nil) + +// MaintenanceConfigurationsClientAPI contains the set of methods on the MaintenanceConfigurationsClient type. +type MaintenanceConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters containerservice.MaintenanceConfiguration) (result containerservice.MaintenanceConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result containerservice.MaintenanceConfiguration, err error) + ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultPage, err error) + ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.MaintenanceConfigurationListResultIterator, err error) +} + +var _ MaintenanceConfigurationsClientAPI = (*containerservice.MaintenanceConfigurationsClient)(nil) + +// AgentPoolsClientAPI contains the set of methods on the AgentPoolsClient type. +type AgentPoolsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, parameters containerservice.AgentPool) (result containerservice.AgentPoolsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string, ignorePodDisruptionBudget *bool) (result containerservice.AgentPoolsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPool, err error) + GetAvailableAgentPoolVersions(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolAvailableVersions, err error) + GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolUpgradeProfile, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.AgentPoolListResultIterator, err error) + UpgradeNodeImageVersion(ctx context.Context, resourceGroupName string, resourceName string, agentPoolName string) (result containerservice.AgentPoolsUpgradeNodeImageVersionFuture, err error) +} + +var _ AgentPoolsClientAPI = (*containerservice.AgentPoolsClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result containerservice.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateEndpointConnectionListResult, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters containerservice.PrivateEndpointConnection) (result containerservice.PrivateEndpointConnection, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*containerservice.PrivateEndpointConnectionsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + List(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.PrivateLinkResourcesListResult, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*containerservice.PrivateLinkResourcesClient)(nil) + +// ResolvePrivateLinkServiceIDClientAPI contains the set of methods on the ResolvePrivateLinkServiceIDClient type. +type ResolvePrivateLinkServiceIDClientAPI interface { + POST(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.PrivateLinkResource) (result containerservice.PrivateLinkResource, err error) +} + +var _ ResolvePrivateLinkServiceIDClientAPI = (*containerservice.ResolvePrivateLinkServiceIDClient)(nil) + +// SnapshotsClientAPI contains the set of methods on the SnapshotsClient type. +type SnapshotsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.Snapshot) (result containerservice.Snapshot, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.Snapshot, err error) + List(ctx context.Context) (result containerservice.SnapshotListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.SnapshotListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.SnapshotListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.Snapshot, err error) +} + +var _ SnapshotsClientAPI = (*containerservice.SnapshotsClient)(nil) + +// ManagedClusterSnapshotsClientAPI contains the set of methods on the ManagedClusterSnapshotsClient type. +type ManagedClusterSnapshotsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.ManagedClusterSnapshot) (result containerservice.ManagedClusterSnapshot, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result containerservice.ManagedClusterSnapshot, err error) + List(ctx context.Context) (result containerservice.ManagedClusterSnapshotListResultPage, err error) + ListComplete(ctx context.Context) (result containerservice.ManagedClusterSnapshotListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterSnapshotListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result containerservice.ManagedClusterSnapshotListResultIterator, err error) + UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters containerservice.TagsObject) (result containerservice.ManagedClusterSnapshot, err error) +} + +var _ ManagedClusterSnapshotsClientAPI = (*containerservice.ManagedClusterSnapshotsClient)(nil) diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go new file mode 100644 index 000000000000..60781e75500b --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/enums.go @@ -0,0 +1,984 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AgentPoolMode enumerates the values for agent pool mode. +type AgentPoolMode string + +const ( + // AgentPoolModeSystem System agent pools are primarily for hosting critical system pods such as CoreDNS + // and metrics-server. System agent pools osType must be Linux. System agent pools VM SKU must have at + // least 2vCPUs and 4GB of memory. + AgentPoolModeSystem AgentPoolMode = "System" + // AgentPoolModeUser User agent pools are primarily for hosting your application pods. + AgentPoolModeUser AgentPoolMode = "User" +) + +// PossibleAgentPoolModeValues returns an array of possible values for the AgentPoolMode const type. +func PossibleAgentPoolModeValues() []AgentPoolMode { + return []AgentPoolMode{AgentPoolModeSystem, AgentPoolModeUser} +} + +// AgentPoolType enumerates the values for agent pool type. +type AgentPoolType string + +const ( + // AgentPoolTypeAvailabilitySet Use of this is strongly discouraged. + AgentPoolTypeAvailabilitySet AgentPoolType = "AvailabilitySet" + // AgentPoolTypeVirtualMachineScaleSets Create an Agent Pool backed by a Virtual Machine Scale Set. + AgentPoolTypeVirtualMachineScaleSets AgentPoolType = "VirtualMachineScaleSets" +) + +// PossibleAgentPoolTypeValues returns an array of possible values for the AgentPoolType const type. +func PossibleAgentPoolTypeValues() []AgentPoolType { + return []AgentPoolType{AgentPoolTypeAvailabilitySet, AgentPoolTypeVirtualMachineScaleSets} +} + +// Code enumerates the values for code. +type Code string + +const ( + // CodeRunning The cluster is running. + CodeRunning Code = "Running" + // CodeStopped The cluster is stopped. + CodeStopped Code = "Stopped" +) + +// PossibleCodeValues returns an array of possible values for the Code const type. +func PossibleCodeValues() []Code { + return []Code{CodeRunning, CodeStopped} +} + +// ConnectionStatus enumerates the values for connection status. +type ConnectionStatus string + +const ( + // ConnectionStatusApproved ... + ConnectionStatusApproved ConnectionStatus = "Approved" + // ConnectionStatusDisconnected ... + ConnectionStatusDisconnected ConnectionStatus = "Disconnected" + // ConnectionStatusPending ... + ConnectionStatusPending ConnectionStatus = "Pending" + // ConnectionStatusRejected ... + ConnectionStatusRejected ConnectionStatus = "Rejected" +) + +// PossibleConnectionStatusValues returns an array of possible values for the ConnectionStatus const type. +func PossibleConnectionStatusValues() []ConnectionStatus { + return []ConnectionStatus{ConnectionStatusApproved, ConnectionStatusDisconnected, ConnectionStatusPending, ConnectionStatusRejected} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// Expander enumerates the values for expander. +type Expander string + +const ( + // ExpanderLeastWaste Selects the node group that will have the least idle CPU (if tied, unused memory) + // after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high + // memory nodes, and only want to expand those when there are pending pods that need a lot of those + // resources. + ExpanderLeastWaste Expander = "least-waste" + // ExpanderMostPods Selects the node group that would be able to schedule the most pods when scaling up. + // This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note + // that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller + // nodes at once. + ExpanderMostPods Expander = "most-pods" + // ExpanderPriority Selects the node group that has the highest priority assigned by the user. It's + // configuration is described in more details + // [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). + ExpanderPriority Expander = "priority" + // ExpanderRandom Used when you don't have a particular need for the node groups to scale differently. + ExpanderRandom Expander = "random" +) + +// PossibleExpanderValues returns an array of possible values for the Expander const type. +func PossibleExpanderValues() []Expander { + return []Expander{ExpanderLeastWaste, ExpanderMostPods, ExpanderPriority, ExpanderRandom} +} + +// ExtendedLocationTypes enumerates the values for extended location types. +type ExtendedLocationTypes string + +const ( + // ExtendedLocationTypesEdgeZone ... + ExtendedLocationTypesEdgeZone ExtendedLocationTypes = "EdgeZone" +) + +// PossibleExtendedLocationTypesValues returns an array of possible values for the ExtendedLocationTypes const type. +func PossibleExtendedLocationTypesValues() []ExtendedLocationTypes { + return []ExtendedLocationTypes{ExtendedLocationTypesEdgeZone} +} + +// Format enumerates the values for format. +type Format string + +const ( + // FormatAzure Return azure auth-provider kubeconfig. This format is deprecated in 1.22 and will be fully + // removed in 1.25. + FormatAzure Format = "azure" + // FormatExec Return exec format kubeconfig. This format requires kubelogin binary in the path. + FormatExec Format = "exec" +) + +// PossibleFormatValues returns an array of possible values for the Format const type. +func PossibleFormatValues() []Format { + return []Format{FormatAzure, FormatExec} +} + +// GPUInstanceProfile enumerates the values for gpu instance profile. +type GPUInstanceProfile string + +const ( + // GPUInstanceProfileMIG1g ... + GPUInstanceProfileMIG1g GPUInstanceProfile = "MIG1g" + // GPUInstanceProfileMIG2g ... + GPUInstanceProfileMIG2g GPUInstanceProfile = "MIG2g" + // GPUInstanceProfileMIG3g ... + GPUInstanceProfileMIG3g GPUInstanceProfile = "MIG3g" + // GPUInstanceProfileMIG4g ... + GPUInstanceProfileMIG4g GPUInstanceProfile = "MIG4g" + // GPUInstanceProfileMIG7g ... + GPUInstanceProfileMIG7g GPUInstanceProfile = "MIG7g" +) + +// PossibleGPUInstanceProfileValues returns an array of possible values for the GPUInstanceProfile const type. +func PossibleGPUInstanceProfileValues() []GPUInstanceProfile { + return []GPUInstanceProfile{GPUInstanceProfileMIG1g, GPUInstanceProfileMIG2g, GPUInstanceProfileMIG3g, GPUInstanceProfileMIG4g, GPUInstanceProfileMIG7g} +} + +// IPFamily enumerates the values for ip family. +type IPFamily string + +const ( + // IPFamilyIPv4 ... + IPFamilyIPv4 IPFamily = "IPv4" + // IPFamilyIPv6 ... + IPFamilyIPv6 IPFamily = "IPv6" +) + +// PossibleIPFamilyValues returns an array of possible values for the IPFamily const type. +func PossibleIPFamilyValues() []IPFamily { + return []IPFamily{IPFamilyIPv4, IPFamilyIPv6} +} + +// KubeletDiskType enumerates the values for kubelet disk type. +type KubeletDiskType string + +const ( + // KubeletDiskTypeOS Kubelet will use the OS disk for its data. + KubeletDiskTypeOS KubeletDiskType = "OS" + // KubeletDiskTypeTemporary Kubelet will use the temporary disk for its data. + KubeletDiskTypeTemporary KubeletDiskType = "Temporary" +) + +// PossibleKubeletDiskTypeValues returns an array of possible values for the KubeletDiskType const type. +func PossibleKubeletDiskTypeValues() []KubeletDiskType { + return []KubeletDiskType{KubeletDiskTypeOS, KubeletDiskTypeTemporary} +} + +// LicenseType enumerates the values for license type. +type LicenseType string + +const ( + // LicenseTypeNone No additional licensing is applied. + LicenseTypeNone LicenseType = "None" + // LicenseTypeWindowsServer Enables Azure Hybrid User Benefits for Windows VMs. + LicenseTypeWindowsServer LicenseType = "Windows_Server" +) + +// PossibleLicenseTypeValues returns an array of possible values for the LicenseType const type. +func PossibleLicenseTypeValues() []LicenseType { + return []LicenseType{LicenseTypeNone, LicenseTypeWindowsServer} +} + +// LoadBalancerSku enumerates the values for load balancer sku. +type LoadBalancerSku string + +const ( + // LoadBalancerSkuBasic Use a basic Load Balancer with limited functionality. + LoadBalancerSkuBasic LoadBalancerSku = "basic" + // LoadBalancerSkuStandard Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For + // more information about on working with the load balancer in the managed cluster, see the [standard Load + // Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. + LoadBalancerSkuStandard LoadBalancerSku = "standard" +) + +// PossibleLoadBalancerSkuValues returns an array of possible values for the LoadBalancerSku const type. +func PossibleLoadBalancerSkuValues() []LoadBalancerSku { + return []LoadBalancerSku{LoadBalancerSkuBasic, LoadBalancerSkuStandard} +} + +// ManagedClusterPodIdentityProvisioningState enumerates the values for managed cluster pod identity +// provisioning state. +type ManagedClusterPodIdentityProvisioningState string + +const ( + // ManagedClusterPodIdentityProvisioningStateAssigned ... + ManagedClusterPodIdentityProvisioningStateAssigned ManagedClusterPodIdentityProvisioningState = "Assigned" + // ManagedClusterPodIdentityProvisioningStateDeleting ... + ManagedClusterPodIdentityProvisioningStateDeleting ManagedClusterPodIdentityProvisioningState = "Deleting" + // ManagedClusterPodIdentityProvisioningStateFailed ... + ManagedClusterPodIdentityProvisioningStateFailed ManagedClusterPodIdentityProvisioningState = "Failed" + // ManagedClusterPodIdentityProvisioningStateUpdating ... + ManagedClusterPodIdentityProvisioningStateUpdating ManagedClusterPodIdentityProvisioningState = "Updating" +) + +// PossibleManagedClusterPodIdentityProvisioningStateValues returns an array of possible values for the ManagedClusterPodIdentityProvisioningState const type. +func PossibleManagedClusterPodIdentityProvisioningStateValues() []ManagedClusterPodIdentityProvisioningState { + return []ManagedClusterPodIdentityProvisioningState{ManagedClusterPodIdentityProvisioningStateAssigned, ManagedClusterPodIdentityProvisioningStateDeleting, ManagedClusterPodIdentityProvisioningStateFailed, ManagedClusterPodIdentityProvisioningStateUpdating} +} + +// ManagedClusterSKUName enumerates the values for managed cluster sku name. +type ManagedClusterSKUName string + +const ( + // ManagedClusterSKUNameBasic ... + ManagedClusterSKUNameBasic ManagedClusterSKUName = "Basic" +) + +// PossibleManagedClusterSKUNameValues returns an array of possible values for the ManagedClusterSKUName const type. +func PossibleManagedClusterSKUNameValues() []ManagedClusterSKUName { + return []ManagedClusterSKUName{ManagedClusterSKUNameBasic} +} + +// ManagedClusterSKUTier enumerates the values for managed cluster sku tier. +type ManagedClusterSKUTier string + +const ( + // ManagedClusterSKUTierFree No guaranteed SLA, no additional charges. Free tier clusters have an SLO of + // 99.5%. + ManagedClusterSKUTierFree ManagedClusterSKUTier = "Free" + // ManagedClusterSKUTierPaid Guarantees 99.95% availability of the Kubernetes API server endpoint for + // clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability + // Zones. + ManagedClusterSKUTierPaid ManagedClusterSKUTier = "Paid" +) + +// PossibleManagedClusterSKUTierValues returns an array of possible values for the ManagedClusterSKUTier const type. +func PossibleManagedClusterSKUTierValues() []ManagedClusterSKUTier { + return []ManagedClusterSKUTier{ManagedClusterSKUTierFree, ManagedClusterSKUTierPaid} +} + +// NetworkMode enumerates the values for network mode. +type NetworkMode string + +const ( + // NetworkModeBridge This is no longer supported + NetworkModeBridge NetworkMode = "bridge" + // NetworkModeTransparent No bridge is created. Intra-VM Pod to Pod communication is through IP routes + // created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) + // for more information. + NetworkModeTransparent NetworkMode = "transparent" +) + +// PossibleNetworkModeValues returns an array of possible values for the NetworkMode const type. +func PossibleNetworkModeValues() []NetworkMode { + return []NetworkMode{NetworkModeBridge, NetworkModeTransparent} +} + +// NetworkPlugin enumerates the values for network plugin. +type NetworkPlugin string + +const ( + // NetworkPluginAzure Use the Azure CNI network plugin. See [Azure CNI (advanced) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for + // more information. + NetworkPluginAzure NetworkPlugin = "azure" + // NetworkPluginKubenet Use the Kubenet network plugin. See [Kubenet (basic) + // networking](https://docs.microsoft.com/azure/aks/concepts-network#kubenet-basic-networking) for more + // information. + NetworkPluginKubenet NetworkPlugin = "kubenet" + // NetworkPluginNone Do not use a network plugin. A custom CNI will need to be installed after cluster + // creation for networking functionality. + NetworkPluginNone NetworkPlugin = "none" +) + +// PossibleNetworkPluginValues returns an array of possible values for the NetworkPlugin const type. +func PossibleNetworkPluginValues() []NetworkPlugin { + return []NetworkPlugin{NetworkPluginAzure, NetworkPluginKubenet, NetworkPluginNone} +} + +// NetworkPolicy enumerates the values for network policy. +type NetworkPolicy string + +const ( + // NetworkPolicyAzure Use Azure network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyAzure NetworkPolicy = "azure" + // NetworkPolicyCalico Use Calico network policies. See [differences between Azure and Calico + // policies](https://docs.microsoft.com/azure/aks/use-network-policies#differences-between-azure-and-calico-policies-and-their-capabilities) + // for more information. + NetworkPolicyCalico NetworkPolicy = "calico" +) + +// PossibleNetworkPolicyValues returns an array of possible values for the NetworkPolicy const type. +func PossibleNetworkPolicyValues() []NetworkPolicy { + return []NetworkPolicy{NetworkPolicyAzure, NetworkPolicyCalico} +} + +// OSDiskType enumerates the values for os disk type. +type OSDiskType string + +const ( + // OSDiskTypeEphemeral Ephemeral OS disks are stored only on the host machine, just like a temporary disk. + // This provides lower read/write latency, along with faster node scaling and cluster upgrades. + OSDiskTypeEphemeral OSDiskType = "Ephemeral" + // OSDiskTypeManaged Azure replicates the operating system disk for a virtual machine to Azure storage to + // avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to + // have local state persisted, this behavior offers limited value while providing some drawbacks, including + // slower node provisioning and higher read/write latency. + OSDiskTypeManaged OSDiskType = "Managed" +) + +// PossibleOSDiskTypeValues returns an array of possible values for the OSDiskType const type. +func PossibleOSDiskTypeValues() []OSDiskType { + return []OSDiskType{OSDiskTypeEphemeral, OSDiskTypeManaged} +} + +// OSSKU enumerates the values for ossku. +type OSSKU string + +const ( + // OSSKUCBLMariner ... + OSSKUCBLMariner OSSKU = "CBLMariner" + // OSSKUUbuntu ... + OSSKUUbuntu OSSKU = "Ubuntu" +) + +// PossibleOSSKUValues returns an array of possible values for the OSSKU const type. +func PossibleOSSKUValues() []OSSKU { + return []OSSKU{OSSKUCBLMariner, OSSKUUbuntu} +} + +// OSType enumerates the values for os type. +type OSType string + +const ( + // OSTypeLinux Use Linux. + OSTypeLinux OSType = "Linux" + // OSTypeWindows Use Windows. + OSTypeWindows OSType = "Windows" +) + +// PossibleOSTypeValues returns an array of possible values for the OSType const type. +func PossibleOSTypeValues() []OSType { + return []OSType{OSTypeLinux, OSTypeWindows} +} + +// OutboundType enumerates the values for outbound type. +type OutboundType string + +const ( + // OutboundTypeLoadBalancer The load balancer is used for egress through an AKS assigned public IP. This + // supports Kubernetes services of type 'loadBalancer'. For more information see [outbound type + // loadbalancer](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-loadbalancer). + OutboundTypeLoadBalancer OutboundType = "loadBalancer" + // OutboundTypeManagedNATGateway The AKS-managed NAT gateway is used for egress. + OutboundTypeManagedNATGateway OutboundType = "managedNATGateway" + // OutboundTypeUserAssignedNATGateway The user-assigned NAT gateway associated to the cluster subnet is + // used for egress. This is an advanced scenario and requires proper network configuration. + OutboundTypeUserAssignedNATGateway OutboundType = "userAssignedNATGateway" + // OutboundTypeUserDefinedRouting Egress paths must be defined by the user. This is an advanced scenario + // and requires proper network configuration. For more information see [outbound type + // userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). + OutboundTypeUserDefinedRouting OutboundType = "userDefinedRouting" +) + +// PossibleOutboundTypeValues returns an array of possible values for the OutboundType const type. +func PossibleOutboundTypeValues() []OutboundType { + return []OutboundType{OutboundTypeLoadBalancer, OutboundTypeManagedNATGateway, OutboundTypeUserAssignedNATGateway, OutboundTypeUserDefinedRouting} +} + +// PrivateEndpointConnectionProvisioningState enumerates the values for private endpoint connection +// provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating ... + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting ... + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed ... + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded ... + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns an array of possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{PrivateEndpointConnectionProvisioningStateCreating, PrivateEndpointConnectionProvisioningStateDeleting, PrivateEndpointConnectionProvisioningStateFailed, PrivateEndpointConnectionProvisioningStateSucceeded} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // ResourceIdentityTypeNone Do not use a managed identity for the Managed Cluster, service principal will + // be used instead. + ResourceIdentityTypeNone ResourceIdentityType = "None" + // ResourceIdentityTypeSystemAssigned Use an implicitly created system assigned managed identity to manage + // cluster resources. Master components in the control plane such as kube-controller-manager will use the + // system assigned managed identity to manipulate Azure resources. + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + // ResourceIdentityTypeUserAssigned Use a user-specified identity to manage cluster resources. Master + // components in the control plane such as kube-controller-manager will use the specified user assigned + // managed identity to manipulate Azure resources. + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ResourceIdentityTypeNone, ResourceIdentityTypeSystemAssigned, ResourceIdentityTypeUserAssigned} +} + +// ScaleDownMode enumerates the values for scale down mode. +type ScaleDownMode string + +const ( + // ScaleDownModeDeallocate Attempt to start deallocated instances (if they exist) during scale up and + // deallocate instances during scale down. + ScaleDownModeDeallocate ScaleDownMode = "Deallocate" + // ScaleDownModeDelete Create new instances during scale up and remove instances during scale down. + ScaleDownModeDelete ScaleDownMode = "Delete" +) + +// PossibleScaleDownModeValues returns an array of possible values for the ScaleDownMode const type. +func PossibleScaleDownModeValues() []ScaleDownMode { + return []ScaleDownMode{ScaleDownModeDeallocate, ScaleDownModeDelete} +} + +// ScaleSetEvictionPolicy enumerates the values for scale set eviction policy. +type ScaleSetEvictionPolicy string + +const ( + // ScaleSetEvictionPolicyDeallocate Nodes in the underlying Scale Set of the node pool are set to the + // stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your + // compute quota and can cause issues with cluster scaling or upgrading. + ScaleSetEvictionPolicyDeallocate ScaleSetEvictionPolicy = "Deallocate" + // ScaleSetEvictionPolicyDelete Nodes in the underlying Scale Set of the node pool are deleted when they're + // evicted. + ScaleSetEvictionPolicyDelete ScaleSetEvictionPolicy = "Delete" +) + +// PossibleScaleSetEvictionPolicyValues returns an array of possible values for the ScaleSetEvictionPolicy const type. +func PossibleScaleSetEvictionPolicyValues() []ScaleSetEvictionPolicy { + return []ScaleSetEvictionPolicy{ScaleSetEvictionPolicyDeallocate, ScaleSetEvictionPolicyDelete} +} + +// ScaleSetPriority enumerates the values for scale set priority. +type ScaleSetPriority string + +const ( + // ScaleSetPriorityRegular Regular VMs will be used. + ScaleSetPriorityRegular ScaleSetPriority = "Regular" + // ScaleSetPrioritySpot Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on + // AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. + ScaleSetPrioritySpot ScaleSetPriority = "Spot" +) + +// PossibleScaleSetPriorityValues returns an array of possible values for the ScaleSetPriority const type. +func PossibleScaleSetPriorityValues() []ScaleSetPriority { + return []ScaleSetPriority{ScaleSetPriorityRegular, ScaleSetPrioritySpot} +} + +// SnapshotType enumerates the values for snapshot type. +type SnapshotType string + +const ( + // SnapshotTypeManagedCluster The snapshot is a snapshot of a managed cluster. + SnapshotTypeManagedCluster SnapshotType = "ManagedCluster" + // SnapshotTypeNodePool The snapshot is a snapshot of a node pool. + SnapshotTypeNodePool SnapshotType = "NodePool" +) + +// PossibleSnapshotTypeValues returns an array of possible values for the SnapshotType const type. +func PossibleSnapshotTypeValues() []SnapshotType { + return []SnapshotType{SnapshotTypeManagedCluster, SnapshotTypeNodePool} +} + +// StorageProfileTypes enumerates the values for storage profile types. +type StorageProfileTypes string + +const ( + // StorageProfileTypesManagedDisks ... + StorageProfileTypesManagedDisks StorageProfileTypes = "ManagedDisks" + // StorageProfileTypesStorageAccount ... + StorageProfileTypesStorageAccount StorageProfileTypes = "StorageAccount" +) + +// PossibleStorageProfileTypesValues returns an array of possible values for the StorageProfileTypes const type. +func PossibleStorageProfileTypesValues() []StorageProfileTypes { + return []StorageProfileTypes{StorageProfileTypesManagedDisks, StorageProfileTypesStorageAccount} +} + +// UpgradeChannel enumerates the values for upgrade channel. +type UpgradeChannel string + +const ( + // UpgradeChannelNodeImage Automatically upgrade the node image to the latest version available. Microsoft + // provides patches and new images for image nodes frequently (usually weekly), but your running nodes + // won't get the new images unless you do a node image upgrade. Turning on the node-image channel will + // automatically update your node images whenever a new version is available. + UpgradeChannelNodeImage UpgradeChannel = "node-image" + // UpgradeChannelNone Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. + UpgradeChannelNone UpgradeChannel = "none" + // UpgradeChannelPatch Automatically upgrade the cluster to the latest supported patch version when it + // becomes available while keeping the minor version the same. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.17.9. + UpgradeChannelPatch UpgradeChannel = "patch" + // UpgradeChannelRapid Automatically upgrade the cluster to the latest supported patch release on the + // latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an + // N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the + // latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 + // and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, + // then is upgraded to 1.19.1. + UpgradeChannelRapid UpgradeChannel = "rapid" + // UpgradeChannelStable Automatically upgrade the cluster to the latest supported patch release on minor + // version N-1, where N is the latest supported minor version. For example, if a cluster is running version + // 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to + // 1.18.6. + UpgradeChannelStable UpgradeChannel = "stable" +) + +// PossibleUpgradeChannelValues returns an array of possible values for the UpgradeChannel const type. +func PossibleUpgradeChannelValues() []UpgradeChannel { + return []UpgradeChannel{UpgradeChannelNodeImage, UpgradeChannelNone, UpgradeChannelPatch, UpgradeChannelRapid, UpgradeChannelStable} +} + +// VMSizeTypes enumerates the values for vm size types. +type VMSizeTypes string + +const ( + // VMSizeTypesStandardA1 ... + VMSizeTypesStandardA1 VMSizeTypes = "Standard_A1" + // VMSizeTypesStandardA10 ... + VMSizeTypesStandardA10 VMSizeTypes = "Standard_A10" + // VMSizeTypesStandardA11 ... + VMSizeTypesStandardA11 VMSizeTypes = "Standard_A11" + // VMSizeTypesStandardA1V2 ... + VMSizeTypesStandardA1V2 VMSizeTypes = "Standard_A1_v2" + // VMSizeTypesStandardA2 ... + VMSizeTypesStandardA2 VMSizeTypes = "Standard_A2" + // VMSizeTypesStandardA2mV2 ... + VMSizeTypesStandardA2mV2 VMSizeTypes = "Standard_A2m_v2" + // VMSizeTypesStandardA2V2 ... + VMSizeTypesStandardA2V2 VMSizeTypes = "Standard_A2_v2" + // VMSizeTypesStandardA3 ... + VMSizeTypesStandardA3 VMSizeTypes = "Standard_A3" + // VMSizeTypesStandardA4 ... + VMSizeTypesStandardA4 VMSizeTypes = "Standard_A4" + // VMSizeTypesStandardA4mV2 ... + VMSizeTypesStandardA4mV2 VMSizeTypes = "Standard_A4m_v2" + // VMSizeTypesStandardA4V2 ... + VMSizeTypesStandardA4V2 VMSizeTypes = "Standard_A4_v2" + // VMSizeTypesStandardA5 ... + VMSizeTypesStandardA5 VMSizeTypes = "Standard_A5" + // VMSizeTypesStandardA6 ... + VMSizeTypesStandardA6 VMSizeTypes = "Standard_A6" + // VMSizeTypesStandardA7 ... + VMSizeTypesStandardA7 VMSizeTypes = "Standard_A7" + // VMSizeTypesStandardA8 ... + VMSizeTypesStandardA8 VMSizeTypes = "Standard_A8" + // VMSizeTypesStandardA8mV2 ... + VMSizeTypesStandardA8mV2 VMSizeTypes = "Standard_A8m_v2" + // VMSizeTypesStandardA8V2 ... + VMSizeTypesStandardA8V2 VMSizeTypes = "Standard_A8_v2" + // VMSizeTypesStandardA9 ... + VMSizeTypesStandardA9 VMSizeTypes = "Standard_A9" + // VMSizeTypesStandardB2ms ... + VMSizeTypesStandardB2ms VMSizeTypes = "Standard_B2ms" + // VMSizeTypesStandardB2s ... + VMSizeTypesStandardB2s VMSizeTypes = "Standard_B2s" + // VMSizeTypesStandardB4ms ... + VMSizeTypesStandardB4ms VMSizeTypes = "Standard_B4ms" + // VMSizeTypesStandardB8ms ... + VMSizeTypesStandardB8ms VMSizeTypes = "Standard_B8ms" + // VMSizeTypesStandardD1 ... + VMSizeTypesStandardD1 VMSizeTypes = "Standard_D1" + // VMSizeTypesStandardD11 ... + VMSizeTypesStandardD11 VMSizeTypes = "Standard_D11" + // VMSizeTypesStandardD11V2 ... + VMSizeTypesStandardD11V2 VMSizeTypes = "Standard_D11_v2" + // VMSizeTypesStandardD11V2Promo ... + VMSizeTypesStandardD11V2Promo VMSizeTypes = "Standard_D11_v2_Promo" + // VMSizeTypesStandardD12 ... + VMSizeTypesStandardD12 VMSizeTypes = "Standard_D12" + // VMSizeTypesStandardD12V2 ... + VMSizeTypesStandardD12V2 VMSizeTypes = "Standard_D12_v2" + // VMSizeTypesStandardD12V2Promo ... + VMSizeTypesStandardD12V2Promo VMSizeTypes = "Standard_D12_v2_Promo" + // VMSizeTypesStandardD13 ... + VMSizeTypesStandardD13 VMSizeTypes = "Standard_D13" + // VMSizeTypesStandardD13V2 ... + VMSizeTypesStandardD13V2 VMSizeTypes = "Standard_D13_v2" + // VMSizeTypesStandardD13V2Promo ... + VMSizeTypesStandardD13V2Promo VMSizeTypes = "Standard_D13_v2_Promo" + // VMSizeTypesStandardD14 ... + VMSizeTypesStandardD14 VMSizeTypes = "Standard_D14" + // VMSizeTypesStandardD14V2 ... + VMSizeTypesStandardD14V2 VMSizeTypes = "Standard_D14_v2" + // VMSizeTypesStandardD14V2Promo ... + VMSizeTypesStandardD14V2Promo VMSizeTypes = "Standard_D14_v2_Promo" + // VMSizeTypesStandardD15V2 ... + VMSizeTypesStandardD15V2 VMSizeTypes = "Standard_D15_v2" + // VMSizeTypesStandardD16sV3 ... + VMSizeTypesStandardD16sV3 VMSizeTypes = "Standard_D16s_v3" + // VMSizeTypesStandardD16V3 ... + VMSizeTypesStandardD16V3 VMSizeTypes = "Standard_D16_v3" + // VMSizeTypesStandardD1V2 ... + VMSizeTypesStandardD1V2 VMSizeTypes = "Standard_D1_v2" + // VMSizeTypesStandardD2 ... + VMSizeTypesStandardD2 VMSizeTypes = "Standard_D2" + // VMSizeTypesStandardD2sV3 ... + VMSizeTypesStandardD2sV3 VMSizeTypes = "Standard_D2s_v3" + // VMSizeTypesStandardD2V2 ... + VMSizeTypesStandardD2V2 VMSizeTypes = "Standard_D2_v2" + // VMSizeTypesStandardD2V2Promo ... + VMSizeTypesStandardD2V2Promo VMSizeTypes = "Standard_D2_v2_Promo" + // VMSizeTypesStandardD2V3 ... + VMSizeTypesStandardD2V3 VMSizeTypes = "Standard_D2_v3" + // VMSizeTypesStandardD3 ... + VMSizeTypesStandardD3 VMSizeTypes = "Standard_D3" + // VMSizeTypesStandardD32sV3 ... + VMSizeTypesStandardD32sV3 VMSizeTypes = "Standard_D32s_v3" + // VMSizeTypesStandardD32V3 ... + VMSizeTypesStandardD32V3 VMSizeTypes = "Standard_D32_v3" + // VMSizeTypesStandardD3V2 ... + VMSizeTypesStandardD3V2 VMSizeTypes = "Standard_D3_v2" + // VMSizeTypesStandardD3V2Promo ... + VMSizeTypesStandardD3V2Promo VMSizeTypes = "Standard_D3_v2_Promo" + // VMSizeTypesStandardD4 ... + VMSizeTypesStandardD4 VMSizeTypes = "Standard_D4" + // VMSizeTypesStandardD4sV3 ... + VMSizeTypesStandardD4sV3 VMSizeTypes = "Standard_D4s_v3" + // VMSizeTypesStandardD4V2 ... + VMSizeTypesStandardD4V2 VMSizeTypes = "Standard_D4_v2" + // VMSizeTypesStandardD4V2Promo ... + VMSizeTypesStandardD4V2Promo VMSizeTypes = "Standard_D4_v2_Promo" + // VMSizeTypesStandardD4V3 ... + VMSizeTypesStandardD4V3 VMSizeTypes = "Standard_D4_v3" + // VMSizeTypesStandardD5V2 ... + VMSizeTypesStandardD5V2 VMSizeTypes = "Standard_D5_v2" + // VMSizeTypesStandardD5V2Promo ... + VMSizeTypesStandardD5V2Promo VMSizeTypes = "Standard_D5_v2_Promo" + // VMSizeTypesStandardD64sV3 ... + VMSizeTypesStandardD64sV3 VMSizeTypes = "Standard_D64s_v3" + // VMSizeTypesStandardD64V3 ... + VMSizeTypesStandardD64V3 VMSizeTypes = "Standard_D64_v3" + // VMSizeTypesStandardD8sV3 ... + VMSizeTypesStandardD8sV3 VMSizeTypes = "Standard_D8s_v3" + // VMSizeTypesStandardD8V3 ... + VMSizeTypesStandardD8V3 VMSizeTypes = "Standard_D8_v3" + // VMSizeTypesStandardDS1 ... + VMSizeTypesStandardDS1 VMSizeTypes = "Standard_DS1" + // VMSizeTypesStandardDS11 ... + VMSizeTypesStandardDS11 VMSizeTypes = "Standard_DS11" + // VMSizeTypesStandardDS11V2 ... + VMSizeTypesStandardDS11V2 VMSizeTypes = "Standard_DS11_v2" + // VMSizeTypesStandardDS11V2Promo ... + VMSizeTypesStandardDS11V2Promo VMSizeTypes = "Standard_DS11_v2_Promo" + // VMSizeTypesStandardDS12 ... + VMSizeTypesStandardDS12 VMSizeTypes = "Standard_DS12" + // VMSizeTypesStandardDS12V2 ... + VMSizeTypesStandardDS12V2 VMSizeTypes = "Standard_DS12_v2" + // VMSizeTypesStandardDS12V2Promo ... + VMSizeTypesStandardDS12V2Promo VMSizeTypes = "Standard_DS12_v2_Promo" + // VMSizeTypesStandardDS13 ... + VMSizeTypesStandardDS13 VMSizeTypes = "Standard_DS13" + // VMSizeTypesStandardDS132V2 ... + VMSizeTypesStandardDS132V2 VMSizeTypes = "Standard_DS13-2_v2" + // VMSizeTypesStandardDS134V2 ... + VMSizeTypesStandardDS134V2 VMSizeTypes = "Standard_DS13-4_v2" + // VMSizeTypesStandardDS13V2 ... + VMSizeTypesStandardDS13V2 VMSizeTypes = "Standard_DS13_v2" + // VMSizeTypesStandardDS13V2Promo ... + VMSizeTypesStandardDS13V2Promo VMSizeTypes = "Standard_DS13_v2_Promo" + // VMSizeTypesStandardDS14 ... + VMSizeTypesStandardDS14 VMSizeTypes = "Standard_DS14" + // VMSizeTypesStandardDS144V2 ... + VMSizeTypesStandardDS144V2 VMSizeTypes = "Standard_DS14-4_v2" + // VMSizeTypesStandardDS148V2 ... + VMSizeTypesStandardDS148V2 VMSizeTypes = "Standard_DS14-8_v2" + // VMSizeTypesStandardDS14V2 ... + VMSizeTypesStandardDS14V2 VMSizeTypes = "Standard_DS14_v2" + // VMSizeTypesStandardDS14V2Promo ... + VMSizeTypesStandardDS14V2Promo VMSizeTypes = "Standard_DS14_v2_Promo" + // VMSizeTypesStandardDS15V2 ... + VMSizeTypesStandardDS15V2 VMSizeTypes = "Standard_DS15_v2" + // VMSizeTypesStandardDS1V2 ... + VMSizeTypesStandardDS1V2 VMSizeTypes = "Standard_DS1_v2" + // VMSizeTypesStandardDS2 ... + VMSizeTypesStandardDS2 VMSizeTypes = "Standard_DS2" + // VMSizeTypesStandardDS2V2 ... + VMSizeTypesStandardDS2V2 VMSizeTypes = "Standard_DS2_v2" + // VMSizeTypesStandardDS2V2Promo ... + VMSizeTypesStandardDS2V2Promo VMSizeTypes = "Standard_DS2_v2_Promo" + // VMSizeTypesStandardDS3 ... + VMSizeTypesStandardDS3 VMSizeTypes = "Standard_DS3" + // VMSizeTypesStandardDS3V2 ... + VMSizeTypesStandardDS3V2 VMSizeTypes = "Standard_DS3_v2" + // VMSizeTypesStandardDS3V2Promo ... + VMSizeTypesStandardDS3V2Promo VMSizeTypes = "Standard_DS3_v2_Promo" + // VMSizeTypesStandardDS4 ... + VMSizeTypesStandardDS4 VMSizeTypes = "Standard_DS4" + // VMSizeTypesStandardDS4V2 ... + VMSizeTypesStandardDS4V2 VMSizeTypes = "Standard_DS4_v2" + // VMSizeTypesStandardDS4V2Promo ... + VMSizeTypesStandardDS4V2Promo VMSizeTypes = "Standard_DS4_v2_Promo" + // VMSizeTypesStandardDS5V2 ... + VMSizeTypesStandardDS5V2 VMSizeTypes = "Standard_DS5_v2" + // VMSizeTypesStandardDS5V2Promo ... + VMSizeTypesStandardDS5V2Promo VMSizeTypes = "Standard_DS5_v2_Promo" + // VMSizeTypesStandardE16sV3 ... + VMSizeTypesStandardE16sV3 VMSizeTypes = "Standard_E16s_v3" + // VMSizeTypesStandardE16V3 ... + VMSizeTypesStandardE16V3 VMSizeTypes = "Standard_E16_v3" + // VMSizeTypesStandardE2sV3 ... + VMSizeTypesStandardE2sV3 VMSizeTypes = "Standard_E2s_v3" + // VMSizeTypesStandardE2V3 ... + VMSizeTypesStandardE2V3 VMSizeTypes = "Standard_E2_v3" + // VMSizeTypesStandardE3216sV3 ... + VMSizeTypesStandardE3216sV3 VMSizeTypes = "Standard_E32-16s_v3" + // VMSizeTypesStandardE328sV3 ... + VMSizeTypesStandardE328sV3 VMSizeTypes = "Standard_E32-8s_v3" + // VMSizeTypesStandardE32sV3 ... + VMSizeTypesStandardE32sV3 VMSizeTypes = "Standard_E32s_v3" + // VMSizeTypesStandardE32V3 ... + VMSizeTypesStandardE32V3 VMSizeTypes = "Standard_E32_v3" + // VMSizeTypesStandardE4sV3 ... + VMSizeTypesStandardE4sV3 VMSizeTypes = "Standard_E4s_v3" + // VMSizeTypesStandardE4V3 ... + VMSizeTypesStandardE4V3 VMSizeTypes = "Standard_E4_v3" + // VMSizeTypesStandardE6416sV3 ... + VMSizeTypesStandardE6416sV3 VMSizeTypes = "Standard_E64-16s_v3" + // VMSizeTypesStandardE6432sV3 ... + VMSizeTypesStandardE6432sV3 VMSizeTypes = "Standard_E64-32s_v3" + // VMSizeTypesStandardE64sV3 ... + VMSizeTypesStandardE64sV3 VMSizeTypes = "Standard_E64s_v3" + // VMSizeTypesStandardE64V3 ... + VMSizeTypesStandardE64V3 VMSizeTypes = "Standard_E64_v3" + // VMSizeTypesStandardE8sV3 ... + VMSizeTypesStandardE8sV3 VMSizeTypes = "Standard_E8s_v3" + // VMSizeTypesStandardE8V3 ... + VMSizeTypesStandardE8V3 VMSizeTypes = "Standard_E8_v3" + // VMSizeTypesStandardF1 ... + VMSizeTypesStandardF1 VMSizeTypes = "Standard_F1" + // VMSizeTypesStandardF16 ... + VMSizeTypesStandardF16 VMSizeTypes = "Standard_F16" + // VMSizeTypesStandardF16s ... + VMSizeTypesStandardF16s VMSizeTypes = "Standard_F16s" + // VMSizeTypesStandardF16sV2 ... + VMSizeTypesStandardF16sV2 VMSizeTypes = "Standard_F16s_v2" + // VMSizeTypesStandardF1s ... + VMSizeTypesStandardF1s VMSizeTypes = "Standard_F1s" + // VMSizeTypesStandardF2 ... + VMSizeTypesStandardF2 VMSizeTypes = "Standard_F2" + // VMSizeTypesStandardF2s ... + VMSizeTypesStandardF2s VMSizeTypes = "Standard_F2s" + // VMSizeTypesStandardF2sV2 ... + VMSizeTypesStandardF2sV2 VMSizeTypes = "Standard_F2s_v2" + // VMSizeTypesStandardF32sV2 ... + VMSizeTypesStandardF32sV2 VMSizeTypes = "Standard_F32s_v2" + // VMSizeTypesStandardF4 ... + VMSizeTypesStandardF4 VMSizeTypes = "Standard_F4" + // VMSizeTypesStandardF4s ... + VMSizeTypesStandardF4s VMSizeTypes = "Standard_F4s" + // VMSizeTypesStandardF4sV2 ... + VMSizeTypesStandardF4sV2 VMSizeTypes = "Standard_F4s_v2" + // VMSizeTypesStandardF64sV2 ... + VMSizeTypesStandardF64sV2 VMSizeTypes = "Standard_F64s_v2" + // VMSizeTypesStandardF72sV2 ... + VMSizeTypesStandardF72sV2 VMSizeTypes = "Standard_F72s_v2" + // VMSizeTypesStandardF8 ... + VMSizeTypesStandardF8 VMSizeTypes = "Standard_F8" + // VMSizeTypesStandardF8s ... + VMSizeTypesStandardF8s VMSizeTypes = "Standard_F8s" + // VMSizeTypesStandardF8sV2 ... + VMSizeTypesStandardF8sV2 VMSizeTypes = "Standard_F8s_v2" + // VMSizeTypesStandardG1 ... + VMSizeTypesStandardG1 VMSizeTypes = "Standard_G1" + // VMSizeTypesStandardG2 ... + VMSizeTypesStandardG2 VMSizeTypes = "Standard_G2" + // VMSizeTypesStandardG3 ... + VMSizeTypesStandardG3 VMSizeTypes = "Standard_G3" + // VMSizeTypesStandardG4 ... + VMSizeTypesStandardG4 VMSizeTypes = "Standard_G4" + // VMSizeTypesStandardG5 ... + VMSizeTypesStandardG5 VMSizeTypes = "Standard_G5" + // VMSizeTypesStandardGS1 ... + VMSizeTypesStandardGS1 VMSizeTypes = "Standard_GS1" + // VMSizeTypesStandardGS2 ... + VMSizeTypesStandardGS2 VMSizeTypes = "Standard_GS2" + // VMSizeTypesStandardGS3 ... + VMSizeTypesStandardGS3 VMSizeTypes = "Standard_GS3" + // VMSizeTypesStandardGS4 ... + VMSizeTypesStandardGS4 VMSizeTypes = "Standard_GS4" + // VMSizeTypesStandardGS44 ... + VMSizeTypesStandardGS44 VMSizeTypes = "Standard_GS4-4" + // VMSizeTypesStandardGS48 ... + VMSizeTypesStandardGS48 VMSizeTypes = "Standard_GS4-8" + // VMSizeTypesStandardGS5 ... + VMSizeTypesStandardGS5 VMSizeTypes = "Standard_GS5" + // VMSizeTypesStandardGS516 ... + VMSizeTypesStandardGS516 VMSizeTypes = "Standard_GS5-16" + // VMSizeTypesStandardGS58 ... + VMSizeTypesStandardGS58 VMSizeTypes = "Standard_GS5-8" + // VMSizeTypesStandardH16 ... + VMSizeTypesStandardH16 VMSizeTypes = "Standard_H16" + // VMSizeTypesStandardH16m ... + VMSizeTypesStandardH16m VMSizeTypes = "Standard_H16m" + // VMSizeTypesStandardH16mr ... + VMSizeTypesStandardH16mr VMSizeTypes = "Standard_H16mr" + // VMSizeTypesStandardH16r ... + VMSizeTypesStandardH16r VMSizeTypes = "Standard_H16r" + // VMSizeTypesStandardH8 ... + VMSizeTypesStandardH8 VMSizeTypes = "Standard_H8" + // VMSizeTypesStandardH8m ... + VMSizeTypesStandardH8m VMSizeTypes = "Standard_H8m" + // VMSizeTypesStandardL16s ... + VMSizeTypesStandardL16s VMSizeTypes = "Standard_L16s" + // VMSizeTypesStandardL32s ... + VMSizeTypesStandardL32s VMSizeTypes = "Standard_L32s" + // VMSizeTypesStandardL4s ... + VMSizeTypesStandardL4s VMSizeTypes = "Standard_L4s" + // VMSizeTypesStandardL8s ... + VMSizeTypesStandardL8s VMSizeTypes = "Standard_L8s" + // VMSizeTypesStandardM12832ms ... + VMSizeTypesStandardM12832ms VMSizeTypes = "Standard_M128-32ms" + // VMSizeTypesStandardM12864ms ... + VMSizeTypesStandardM12864ms VMSizeTypes = "Standard_M128-64ms" + // VMSizeTypesStandardM128ms ... + VMSizeTypesStandardM128ms VMSizeTypes = "Standard_M128ms" + // VMSizeTypesStandardM128s ... + VMSizeTypesStandardM128s VMSizeTypes = "Standard_M128s" + // VMSizeTypesStandardM6416ms ... + VMSizeTypesStandardM6416ms VMSizeTypes = "Standard_M64-16ms" + // VMSizeTypesStandardM6432ms ... + VMSizeTypesStandardM6432ms VMSizeTypes = "Standard_M64-32ms" + // VMSizeTypesStandardM64ms ... + VMSizeTypesStandardM64ms VMSizeTypes = "Standard_M64ms" + // VMSizeTypesStandardM64s ... + VMSizeTypesStandardM64s VMSizeTypes = "Standard_M64s" + // VMSizeTypesStandardNC12 ... + VMSizeTypesStandardNC12 VMSizeTypes = "Standard_NC12" + // VMSizeTypesStandardNC12sV2 ... + VMSizeTypesStandardNC12sV2 VMSizeTypes = "Standard_NC12s_v2" + // VMSizeTypesStandardNC12sV3 ... + VMSizeTypesStandardNC12sV3 VMSizeTypes = "Standard_NC12s_v3" + // VMSizeTypesStandardNC24 ... + VMSizeTypesStandardNC24 VMSizeTypes = "Standard_NC24" + // VMSizeTypesStandardNC24r ... + VMSizeTypesStandardNC24r VMSizeTypes = "Standard_NC24r" + // VMSizeTypesStandardNC24rsV2 ... + VMSizeTypesStandardNC24rsV2 VMSizeTypes = "Standard_NC24rs_v2" + // VMSizeTypesStandardNC24rsV3 ... + VMSizeTypesStandardNC24rsV3 VMSizeTypes = "Standard_NC24rs_v3" + // VMSizeTypesStandardNC24sV2 ... + VMSizeTypesStandardNC24sV2 VMSizeTypes = "Standard_NC24s_v2" + // VMSizeTypesStandardNC24sV3 ... + VMSizeTypesStandardNC24sV3 VMSizeTypes = "Standard_NC24s_v3" + // VMSizeTypesStandardNC6 ... + VMSizeTypesStandardNC6 VMSizeTypes = "Standard_NC6" + // VMSizeTypesStandardNC6sV2 ... + VMSizeTypesStandardNC6sV2 VMSizeTypes = "Standard_NC6s_v2" + // VMSizeTypesStandardNC6sV3 ... + VMSizeTypesStandardNC6sV3 VMSizeTypes = "Standard_NC6s_v3" + // VMSizeTypesStandardND12s ... + VMSizeTypesStandardND12s VMSizeTypes = "Standard_ND12s" + // VMSizeTypesStandardND24rs ... + VMSizeTypesStandardND24rs VMSizeTypes = "Standard_ND24rs" + // VMSizeTypesStandardND24s ... + VMSizeTypesStandardND24s VMSizeTypes = "Standard_ND24s" + // VMSizeTypesStandardND6s ... + VMSizeTypesStandardND6s VMSizeTypes = "Standard_ND6s" + // VMSizeTypesStandardNV12 ... + VMSizeTypesStandardNV12 VMSizeTypes = "Standard_NV12" + // VMSizeTypesStandardNV24 ... + VMSizeTypesStandardNV24 VMSizeTypes = "Standard_NV24" + // VMSizeTypesStandardNV6 ... + VMSizeTypesStandardNV6 VMSizeTypes = "Standard_NV6" +) + +// PossibleVMSizeTypesValues returns an array of possible values for the VMSizeTypes const type. +func PossibleVMSizeTypesValues() []VMSizeTypes { + return []VMSizeTypes{VMSizeTypesStandardA1, VMSizeTypesStandardA10, VMSizeTypesStandardA11, VMSizeTypesStandardA1V2, VMSizeTypesStandardA2, VMSizeTypesStandardA2mV2, VMSizeTypesStandardA2V2, VMSizeTypesStandardA3, VMSizeTypesStandardA4, VMSizeTypesStandardA4mV2, VMSizeTypesStandardA4V2, VMSizeTypesStandardA5, VMSizeTypesStandardA6, VMSizeTypesStandardA7, VMSizeTypesStandardA8, VMSizeTypesStandardA8mV2, VMSizeTypesStandardA8V2, VMSizeTypesStandardA9, VMSizeTypesStandardB2ms, VMSizeTypesStandardB2s, VMSizeTypesStandardB4ms, VMSizeTypesStandardB8ms, VMSizeTypesStandardD1, VMSizeTypesStandardD11, VMSizeTypesStandardD11V2, VMSizeTypesStandardD11V2Promo, VMSizeTypesStandardD12, VMSizeTypesStandardD12V2, VMSizeTypesStandardD12V2Promo, VMSizeTypesStandardD13, VMSizeTypesStandardD13V2, VMSizeTypesStandardD13V2Promo, VMSizeTypesStandardD14, VMSizeTypesStandardD14V2, VMSizeTypesStandardD14V2Promo, VMSizeTypesStandardD15V2, VMSizeTypesStandardD16sV3, VMSizeTypesStandardD16V3, VMSizeTypesStandardD1V2, VMSizeTypesStandardD2, VMSizeTypesStandardD2sV3, VMSizeTypesStandardD2V2, VMSizeTypesStandardD2V2Promo, VMSizeTypesStandardD2V3, VMSizeTypesStandardD3, VMSizeTypesStandardD32sV3, VMSizeTypesStandardD32V3, VMSizeTypesStandardD3V2, VMSizeTypesStandardD3V2Promo, VMSizeTypesStandardD4, VMSizeTypesStandardD4sV3, VMSizeTypesStandardD4V2, VMSizeTypesStandardD4V2Promo, VMSizeTypesStandardD4V3, VMSizeTypesStandardD5V2, VMSizeTypesStandardD5V2Promo, VMSizeTypesStandardD64sV3, VMSizeTypesStandardD64V3, VMSizeTypesStandardD8sV3, VMSizeTypesStandardD8V3, VMSizeTypesStandardDS1, VMSizeTypesStandardDS11, VMSizeTypesStandardDS11V2, VMSizeTypesStandardDS11V2Promo, VMSizeTypesStandardDS12, VMSizeTypesStandardDS12V2, VMSizeTypesStandardDS12V2Promo, VMSizeTypesStandardDS13, VMSizeTypesStandardDS132V2, VMSizeTypesStandardDS134V2, VMSizeTypesStandardDS13V2, VMSizeTypesStandardDS13V2Promo, VMSizeTypesStandardDS14, VMSizeTypesStandardDS144V2, VMSizeTypesStandardDS148V2, VMSizeTypesStandardDS14V2, VMSizeTypesStandardDS14V2Promo, VMSizeTypesStandardDS15V2, VMSizeTypesStandardDS1V2, VMSizeTypesStandardDS2, VMSizeTypesStandardDS2V2, VMSizeTypesStandardDS2V2Promo, VMSizeTypesStandardDS3, VMSizeTypesStandardDS3V2, VMSizeTypesStandardDS3V2Promo, VMSizeTypesStandardDS4, VMSizeTypesStandardDS4V2, VMSizeTypesStandardDS4V2Promo, VMSizeTypesStandardDS5V2, VMSizeTypesStandardDS5V2Promo, VMSizeTypesStandardE16sV3, VMSizeTypesStandardE16V3, VMSizeTypesStandardE2sV3, VMSizeTypesStandardE2V3, VMSizeTypesStandardE3216sV3, VMSizeTypesStandardE328sV3, VMSizeTypesStandardE32sV3, VMSizeTypesStandardE32V3, VMSizeTypesStandardE4sV3, VMSizeTypesStandardE4V3, VMSizeTypesStandardE6416sV3, VMSizeTypesStandardE6432sV3, VMSizeTypesStandardE64sV3, VMSizeTypesStandardE64V3, VMSizeTypesStandardE8sV3, VMSizeTypesStandardE8V3, VMSizeTypesStandardF1, VMSizeTypesStandardF16, VMSizeTypesStandardF16s, VMSizeTypesStandardF16sV2, VMSizeTypesStandardF1s, VMSizeTypesStandardF2, VMSizeTypesStandardF2s, VMSizeTypesStandardF2sV2, VMSizeTypesStandardF32sV2, VMSizeTypesStandardF4, VMSizeTypesStandardF4s, VMSizeTypesStandardF4sV2, VMSizeTypesStandardF64sV2, VMSizeTypesStandardF72sV2, VMSizeTypesStandardF8, VMSizeTypesStandardF8s, VMSizeTypesStandardF8sV2, VMSizeTypesStandardG1, VMSizeTypesStandardG2, VMSizeTypesStandardG3, VMSizeTypesStandardG4, VMSizeTypesStandardG5, VMSizeTypesStandardGS1, VMSizeTypesStandardGS2, VMSizeTypesStandardGS3, VMSizeTypesStandardGS4, VMSizeTypesStandardGS44, VMSizeTypesStandardGS48, VMSizeTypesStandardGS5, VMSizeTypesStandardGS516, VMSizeTypesStandardGS58, VMSizeTypesStandardH16, VMSizeTypesStandardH16m, VMSizeTypesStandardH16mr, VMSizeTypesStandardH16r, VMSizeTypesStandardH8, VMSizeTypesStandardH8m, VMSizeTypesStandardL16s, VMSizeTypesStandardL32s, VMSizeTypesStandardL4s, VMSizeTypesStandardL8s, VMSizeTypesStandardM12832ms, VMSizeTypesStandardM12864ms, VMSizeTypesStandardM128ms, VMSizeTypesStandardM128s, VMSizeTypesStandardM6416ms, VMSizeTypesStandardM6432ms, VMSizeTypesStandardM64ms, VMSizeTypesStandardM64s, VMSizeTypesStandardNC12, VMSizeTypesStandardNC12sV2, VMSizeTypesStandardNC12sV3, VMSizeTypesStandardNC24, VMSizeTypesStandardNC24r, VMSizeTypesStandardNC24rsV2, VMSizeTypesStandardNC24rsV3, VMSizeTypesStandardNC24sV2, VMSizeTypesStandardNC24sV3, VMSizeTypesStandardNC6, VMSizeTypesStandardNC6sV2, VMSizeTypesStandardNC6sV3, VMSizeTypesStandardND12s, VMSizeTypesStandardND24rs, VMSizeTypesStandardND24s, VMSizeTypesStandardND6s, VMSizeTypesStandardNV12, VMSizeTypesStandardNV24, VMSizeTypesStandardNV6} +} + +// WeekDay enumerates the values for week day. +type WeekDay string + +const ( + // WeekDayFriday ... + WeekDayFriday WeekDay = "Friday" + // WeekDayMonday ... + WeekDayMonday WeekDay = "Monday" + // WeekDaySaturday ... + WeekDaySaturday WeekDay = "Saturday" + // WeekDaySunday ... + WeekDaySunday WeekDay = "Sunday" + // WeekDayThursday ... + WeekDayThursday WeekDay = "Thursday" + // WeekDayTuesday ... + WeekDayTuesday WeekDay = "Tuesday" + // WeekDayWednesday ... + WeekDayWednesday WeekDay = "Wednesday" +) + +// PossibleWeekDayValues returns an array of possible values for the WeekDay const type. +func PossibleWeekDayValues() []WeekDay { + return []WeekDay{WeekDayFriday, WeekDayMonday, WeekDaySaturday, WeekDaySunday, WeekDayThursday, WeekDayTuesday, WeekDayWednesday} +} + +// WorkloadRuntime enumerates the values for workload runtime. +type WorkloadRuntime string + +const ( + // WorkloadRuntimeOCIContainer Nodes will use Kubelet to run standard OCI container workloads. + WorkloadRuntimeOCIContainer WorkloadRuntime = "OCIContainer" + // WorkloadRuntimeWasmWasi Nodes will use Krustlet to run WASM workloads using the WASI provider (Preview). + WorkloadRuntimeWasmWasi WorkloadRuntime = "WasmWasi" +) + +// PossibleWorkloadRuntimeValues returns an array of possible values for the WorkloadRuntime const type. +func PossibleWorkloadRuntimeValues() []WorkloadRuntime { + return []WorkloadRuntime{WorkloadRuntimeOCIContainer, WorkloadRuntimeWasmWasi} +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go new file mode 100644 index 000000000000..441e6d2d3bb5 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/maintenanceconfigurations.go @@ -0,0 +1,440 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// MaintenanceConfigurationsClient is the the Container Service Client. +type MaintenanceConfigurationsClient struct { + BaseClient +} + +// NewMaintenanceConfigurationsClient creates an instance of the MaintenanceConfigurationsClient client. +func NewMaintenanceConfigurationsClient(subscriptionID string) MaintenanceConfigurationsClient { + return NewMaintenanceConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMaintenanceConfigurationsClientWithBaseURI creates an instance of the MaintenanceConfigurationsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewMaintenanceConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) MaintenanceConfigurationsClient { + return MaintenanceConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +// parameters - the maintenance configuration to create or update. +func (client MaintenanceConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, configName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MaintenanceConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string, parameters MaintenanceConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MaintenanceConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// configName - the name of the maintenance configuration. +func (client MaintenanceConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configName string) (result MaintenanceConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MaintenanceConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configName": autorest.Encode("path", configName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) GetResponder(resp *http.Response) (result MaintenanceConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByManagedCluster sends the list by managed cluster request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client MaintenanceConfigurationsClient) ListByManagedCluster(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", err.Error()) + } + + result.fn = client.listByManagedClusterNextResults + req, err := client.ListByManagedClusterPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", nil, "Failure preparing request") + return + } + + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "ListByManagedCluster", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByManagedClusterPreparer prepares the ListByManagedCluster request. +func (client MaintenanceConfigurationsClient) ListByManagedClusterPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByManagedClusterSender sends the ListByManagedCluster request. The method will close the +// http.Response Body if it receives an error. +func (client MaintenanceConfigurationsClient) ListByManagedClusterSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByManagedClusterResponder handles the response to the ListByManagedCluster request. The method always +// closes the http.Response Body. +func (client MaintenanceConfigurationsClient) ListByManagedClusterResponder(resp *http.Response) (result MaintenanceConfigurationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByManagedClusterNextResults retrieves the next set of results, if any. +func (client MaintenanceConfigurationsClient) listByManagedClusterNextResults(ctx context.Context, lastResults MaintenanceConfigurationListResult) (result MaintenanceConfigurationListResult, err error) { + req, err := lastResults.maintenanceConfigurationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByManagedClusterSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByManagedClusterResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.MaintenanceConfigurationsClient", "listByManagedClusterNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByManagedClusterComplete enumerates all values, automatically crossing page boundaries as required. +func (client MaintenanceConfigurationsClient) ListByManagedClusterComplete(ctx context.Context, resourceGroupName string, resourceName string) (result MaintenanceConfigurationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationsClient.ListByManagedCluster") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByManagedCluster(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go new file mode 100644 index 000000000000..1c1c93d3eefb --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclusters.go @@ -0,0 +1,2139 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedClustersClient is the the Container Service Client. +type ManagedClustersClient struct { + BaseClient +} + +// NewManagedClustersClient creates an instance of the ManagedClustersClient client. +func NewManagedClustersClient(subscriptionID string) ManagedClustersClient { + return NewManagedClustersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedClustersClientWithBaseURI creates an instance of the ManagedClustersClient client using a custom endpoint. +// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewManagedClustersClientWithBaseURI(baseURI string, subscriptionID string) ManagedClustersClient { + return ManagedClustersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the managed cluster to create or update. +func (client ManagedClustersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (result ManagedClustersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ManagedClusterProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.AdminUsername", Name: validation.Pattern, Rule: `^[A-Za-z][-A-Za-z0-9_]*$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.LinuxProfile.SSH.PublicKeys", Name: validation.Null, Rule: true, Chain: nil}}}, + }}, + {Target: "parameters.ManagedClusterProperties.WindowsProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.WindowsProfile.AdminUsername", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.ServicePrincipalProfile.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.PodCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.ServiceCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DNSServiceIP", Name: validation.Pattern, Rule: `^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.DockerBridgeCidr", Name: validation.Pattern, Rule: `^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$`, Chain: nil}}}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.InclusiveMaximum, Rule: int64(100), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.ManagedOutboundIPs.CountIPv6", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMaximum, Rule: int64(64000), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.AllocatedOutboundPorts", Name: validation.InclusiveMinimum, Rule: int64(0), Chain: nil}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.LoadBalancerProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMaximum, Rule: int64(16), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.ManagedOutboundIPProfile.Count", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}, + }}, + }}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMaximum, Rule: int64(120), Chain: nil}, + {Target: "parameters.ManagedClusterProperties.NetworkProfile.NatGatewayProfile.IdleTimeoutInMinutes", Name: validation.InclusiveMinimum, Rule: int64(4), Chain: nil}, + }}, + }}, + }}, + }}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedClustersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedCluster) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) CreateOrUpdateSender(req *http.Request) (future ManagedClustersCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// ignorePodDisruptionBudget - ignore-pod-disruption-budget=true to delete those pods on a node without +// considering Pod Disruption Budget +func (client ManagedClustersClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, ignorePodDisruptionBudget *bool) (result ManagedClustersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, ignorePodDisruptionBudget) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedClustersClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, ignorePodDisruptionBudget *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if ignorePodDisruptionBudget != nil { + queryParameters["ignore-pod-disruption-budget"] = autorest.Encode("query", *ignorePodDisruptionBudget) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) DeleteSender(req *http.Request) (future ManagedClustersDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedCluster, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedClustersClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetAccessProfile **WARNING**: This API will be deprecated. Instead use +// [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or +// [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// roleName - the name of the role for managed cluster accessProfile resource. +func (client ManagedClustersClient) GetAccessProfile(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (result ManagedClusterAccessProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetAccessProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetAccessProfile", err.Error()) + } + + req, err := client.GetAccessProfilePreparer(ctx, resourceGroupName, resourceName, roleName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetAccessProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure sending request") + return + } + + result, err = client.GetAccessProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetAccessProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetAccessProfilePreparer prepares the GetAccessProfile request. +func (client ManagedClustersClient) GetAccessProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, roleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAccessProfileSender sends the GetAccessProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetAccessProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAccessProfileResponder handles the response to the GetAccessProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetAccessProfileResponder(resp *http.Response) (result ManagedClusterAccessProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCommandResult sends the get command result request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// commandID - id of the command. +func (client ManagedClustersClient) GetCommandResult(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (result RunCommandResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetCommandResult") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetCommandResult", err.Error()) + } + + req, err := client.GetCommandResultPreparer(ctx, resourceGroupName, resourceName, commandID) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", nil, "Failure preparing request") + return + } + + resp, err := client.GetCommandResultSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure sending request") + return + } + + result, err = client.GetCommandResultResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetCommandResult", resp, "Failure responding to request") + return + } + + return +} + +// GetCommandResultPreparer prepares the GetCommandResult request. +func (client ManagedClustersClient) GetCommandResultPreparer(ctx context.Context, resourceGroupName string, resourceName string, commandID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "commandId": autorest.Encode("path", commandID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCommandResultSender sends the GetCommandResult request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetCommandResultSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCommandResultResponder handles the response to the GetCommandResult request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetCommandResultResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetOSOptions sends the get os options request. +// Parameters: +// location - the name of Azure region. +// resourceType - the resource type for which the OS options needs to be returned +func (client ManagedClustersClient) GetOSOptions(ctx context.Context, location string, resourceType string) (result OSOptionProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetOSOptions") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetOSOptions", err.Error()) + } + + req, err := client.GetOSOptionsPreparer(ctx, location, resourceType) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", nil, "Failure preparing request") + return + } + + resp, err := client.GetOSOptionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure sending request") + return + } + + result, err = client.GetOSOptionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetOSOptions", resp, "Failure responding to request") + return + } + + return +} + +// GetOSOptionsPreparer prepares the GetOSOptions request. +func (client ManagedClustersClient) GetOSOptionsPreparer(ctx context.Context, location string, resourceType string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(resourceType) > 0 { + queryParameters["resource-type"] = autorest.Encode("query", resourceType) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetOSOptionsSender sends the GetOSOptions request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetOSOptionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetOSOptionsResponder handles the response to the GetOSOptions request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetOSOptionsResponder(resp *http.Response) (result OSOptionProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpgradeProfile sends the get upgrade profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) GetUpgradeProfile(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterUpgradeProfile, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.GetUpgradeProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "GetUpgradeProfile", err.Error()) + } + + req, err := client.GetUpgradeProfilePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpgradeProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure sending request") + return + } + + result, err = client.GetUpgradeProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "GetUpgradeProfile", resp, "Failure responding to request") + return + } + + return +} + +// GetUpgradeProfilePreparer prepares the GetUpgradeProfile request. +func (client ManagedClustersClient) GetUpgradeProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpgradeProfileSender sends the GetUpgradeProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) GetUpgradeProfileSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpgradeProfileResponder handles the response to the GetUpgradeProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) GetUpgradeProfileResponder(resp *http.Response) (result ManagedClusterUpgradeProfile, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client ManagedClustersClient) List(ctx context.Context) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "List", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedClustersClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListResponder(resp *http.Response) (result ManagedClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListComplete(ctx context.Context) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ManagedClustersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mclr.Response.Response != nil { + sc = result.mclr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mclr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mclr.hasNextLink() && result.mclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedClustersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterListResult) (result ManagedClusterListResult, err error) { + req, err := lastResults.managedClusterListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// ListClusterAdminCredentials sends the list cluster admin credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterAdminCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterAdminCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterAdminCredentials", err.Error()) + } + + req, err := client.ListClusterAdminCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterAdminCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterAdminCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterAdminCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterAdminCredentialsPreparer prepares the ListClusterAdminCredentials request. +func (client ManagedClustersClient) ListClusterAdminCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterAdminCredentialsSender sends the ListClusterAdminCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterAdminCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterAdminCredentialsResponder handles the response to the ListClusterAdminCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterAdminCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterMonitoringUserCredentials sends the list cluster monitoring user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +func (client ManagedClustersClient) ListClusterMonitoringUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterMonitoringUserCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", err.Error()) + } + + req, err := client.ListClusterMonitoringUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterMonitoringUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterMonitoringUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterMonitoringUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterMonitoringUserCredentialsPreparer prepares the ListClusterMonitoringUserCredentials request. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterMonitoringUserCredentialsSender sends the ListClusterMonitoringUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterMonitoringUserCredentialsResponder handles the response to the ListClusterMonitoringUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterMonitoringUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListClusterUserCredentials sends the list cluster user credentials request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// serverFqdn - server fqdn type for credentials to be returned +// formatParameter - only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' +// will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires +// kubelogin binary in the path. +func (client ManagedClustersClient) ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (result CredentialResults, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListClusterUserCredentials") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListClusterUserCredentials", err.Error()) + } + + req, err := client.ListClusterUserCredentialsPreparer(ctx, resourceGroupName, resourceName, serverFqdn, formatParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListClusterUserCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListClusterUserCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListClusterUserCredentials", resp, "Failure responding to request") + return + } + + return +} + +// ListClusterUserCredentialsPreparer prepares the ListClusterUserCredentials request. +func (client ManagedClustersClient) ListClusterUserCredentialsPreparer(ctx context.Context, resourceGroupName string, resourceName string, serverFqdn string, formatParameter Format) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(serverFqdn) > 0 { + queryParameters["server-fqdn"] = autorest.Encode("query", serverFqdn) + } + if len(string(formatParameter)) > 0 { + queryParameters["format"] = autorest.Encode("query", formatParameter) + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListClusterUserCredentialsSender sends the ListClusterUserCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListClusterUserCredentialsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListClusterUserCredentialsResponder handles the response to the ListClusterUserCredentials request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListClusterUserCredentialsResponder(resp *http.Response) (result CredentialResults, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListOutboundNetworkDependenciesEndpoints gets a list of egress endpoints (network endpoints of all outbound +// dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpoints(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.oeec.Response.Response != nil { + sc = result.oeec.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", err.Error()) + } + + result.fn = client.listOutboundNetworkDependenciesEndpointsNextResults + req, err := client.ListOutboundNetworkDependenciesEndpointsPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", nil, "Failure preparing request") + return + } + + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.oeec.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure sending request") + return + } + + result.oeec, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ListOutboundNetworkDependenciesEndpoints", resp, "Failure responding to request") + return + } + if result.oeec.hasNextLink() && result.oeec.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListOutboundNetworkDependenciesEndpointsPreparer prepares the ListOutboundNetworkDependenciesEndpoints request. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListOutboundNetworkDependenciesEndpointsSender sends the ListOutboundNetworkDependenciesEndpoints request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListOutboundNetworkDependenciesEndpointsResponder handles the response to the ListOutboundNetworkDependenciesEndpoints request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsResponder(resp *http.Response) (result OutboundEnvironmentEndpointCollection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listOutboundNetworkDependenciesEndpointsNextResults retrieves the next set of results, if any. +func (client ManagedClustersClient) listOutboundNetworkDependenciesEndpointsNextResults(ctx context.Context, lastResults OutboundEnvironmentEndpointCollection) (result OutboundEnvironmentEndpointCollection, err error) { + req, err := lastResults.outboundEnvironmentEndpointCollectionPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListOutboundNetworkDependenciesEndpointsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListOutboundNetworkDependenciesEndpointsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "listOutboundNetworkDependenciesEndpointsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListOutboundNetworkDependenciesEndpointsComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClustersClient) ListOutboundNetworkDependenciesEndpointsComplete(ctx context.Context, resourceGroupName string, resourceName string) (result OutboundEnvironmentEndpointCollectionIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ListOutboundNetworkDependenciesEndpoints") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListOutboundNetworkDependenciesEndpoints(ctx, resourceGroupName, resourceName) + return +} + +// ResetAADProfile sends the reset aad profile request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the AAD profile to set on the Managed Cluster +func (client ManagedClustersClient) ResetAADProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (result ManagedClustersResetAADProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetAADProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetAADProfile", err.Error()) + } + + req, err := client.ResetAADProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetAADProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetAADProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetAADProfilePreparer prepares the ResetAADProfile request. +func (client ManagedClustersClient) ResetAADProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterAADProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + 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.ContainerService/managedClusters/{resourceName}/resetAADProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetAADProfileSender sends the ResetAADProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetAADProfileSender(req *http.Request) (future ManagedClustersResetAADProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetAADProfileResponder handles the response to the ResetAADProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetAADProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetServicePrincipalProfile this action cannot be performed on a cluster that is not using a service principal +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the service principal profile to set on the managed cluster. +func (client ManagedClustersClient) ResetServicePrincipalProfile(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (result ManagedClustersResetServicePrincipalProfileFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.ResetServicePrincipalProfile") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.ClientID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", err.Error()) + } + + req, err := client.ResetServicePrincipalProfilePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", nil, "Failure preparing request") + return + } + + result, err = client.ResetServicePrincipalProfileSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "ResetServicePrincipalProfile", result.Response(), "Failure sending request") + return + } + + return +} + +// ResetServicePrincipalProfilePreparer prepares the ResetServicePrincipalProfile request. +func (client ManagedClustersClient) ResetServicePrincipalProfilePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterServicePrincipalProfile) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + 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.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetServicePrincipalProfileSender sends the ResetServicePrincipalProfile request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) ResetServicePrincipalProfileSender(req *http.Request) (future ManagedClustersResetServicePrincipalProfileFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// ResetServicePrincipalProfileResponder handles the response to the ResetServicePrincipalProfile request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) ResetServicePrincipalProfileResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RotateClusterCertificates see [Certificate rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for +// more details about rotating managed cluster certificates. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) RotateClusterCertificates(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateClusterCertificatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateClusterCertificates") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RotateClusterCertificates", err.Error()) + } + + req, err := client.RotateClusterCertificatesPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", nil, "Failure preparing request") + return + } + + result, err = client.RotateClusterCertificatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateClusterCertificates", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateClusterCertificatesPreparer prepares the RotateClusterCertificates request. +func (client ManagedClustersClient) RotateClusterCertificatesPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateClusterCertificatesSender sends the RotateClusterCertificates request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RotateClusterCertificatesSender(req *http.Request) (future ManagedClustersRotateClusterCertificatesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RotateClusterCertificatesResponder handles the response to the RotateClusterCertificates request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RotateClusterCertificatesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RotateServiceAccountSigningKeys sends the rotate service account signing keys request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) RotateServiceAccountSigningKeys(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersRotateServiceAccountSigningKeysFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RotateServiceAccountSigningKeys") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", err.Error()) + } + + req, err := client.RotateServiceAccountSigningKeysPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", nil, "Failure preparing request") + return + } + + result, err = client.RotateServiceAccountSigningKeysSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RotateServiceAccountSigningKeys", result.Response(), "Failure sending request") + return + } + + return +} + +// RotateServiceAccountSigningKeysPreparer prepares the RotateServiceAccountSigningKeys request. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RotateServiceAccountSigningKeysSender sends the RotateServiceAccountSigningKeys request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysSender(req *http.Request) (future ManagedClustersRotateServiceAccountSigningKeysFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RotateServiceAccountSigningKeysResponder handles the response to the RotateServiceAccountSigningKeys request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RotateServiceAccountSigningKeysResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// RunCommand AKS will create a pod to run the command. This is primarily useful for private clusters. For more +// information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// requestPayload - the run command request +func (client ManagedClustersClient) RunCommand(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (result ManagedClustersRunCommandFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.RunCommand") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: requestPayload, + Constraints: []validation.Constraint{{Target: "requestPayload.Command", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "RunCommand", err.Error()) + } + + req, err := client.RunCommandPreparer(ctx, resourceGroupName, resourceName, requestPayload) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", nil, "Failure preparing request") + return + } + + result, err = client.RunCommandSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "RunCommand", result.Response(), "Failure sending request") + return + } + + return +} + +// RunCommandPreparer prepares the RunCommand request. +func (client ManagedClustersClient) RunCommandPreparer(ctx context.Context, resourceGroupName string, resourceName string, requestPayload RunCommandRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + 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.ContainerService/managedClusters/{resourceName}/runCommand", pathParameters), + autorest.WithJSON(requestPayload), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RunCommandSender sends the RunCommand request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) RunCommandSender(req *http.Request) (future ManagedClustersRunCommandFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// RunCommandResponder handles the response to the RunCommand request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) RunCommandResponder(resp *http.Response) (result RunCommandResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Start see [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about +// starting a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Start(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStartFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Start") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", nil, "Failure preparing request") + return + } + + result, err = client.StartSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Start", result.Response(), "Failure sending request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client ManagedClustersClient) StartPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StartSender(req *http.Request) (future ManagedClustersStartFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop this can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the +// control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue +// charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for +// more details about stopping a cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClustersClient) Stop(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClustersStopFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.Stop") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", nil, "Failure preparing request") + return + } + + result, err = client.StopSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "Stop", result.Response(), "Failure sending request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client ManagedClustersClient) StopPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) StopSender(req *http.Request) (future ManagedClustersStopFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update Managed Cluster Tags operation. +func (client ManagedClustersClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClustersUpdateTagsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClustersClient.UpdateTags") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClustersClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", nil, "Failure preparing request") + return + } + + result, err = client.UpdateTagsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersClient", "UpdateTags", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ManagedClustersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClustersClient) UpdateTagsSender(req *http.Request) (future ManagedClustersUpdateTagsFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ManagedClustersClient) UpdateTagsResponder(resp *http.Response) (result ManagedCluster, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go new file mode 100644 index 000000000000..89f23ffed8c1 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/managedclustersnapshots.go @@ -0,0 +1,638 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ManagedClusterSnapshotsClient is the the Container Service Client. +type ManagedClusterSnapshotsClient struct { + BaseClient +} + +// NewManagedClusterSnapshotsClient creates an instance of the ManagedClusterSnapshotsClient client. +func NewManagedClusterSnapshotsClient(subscriptionID string) ManagedClusterSnapshotsClient { + return NewManagedClusterSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewManagedClusterSnapshotsClientWithBaseURI creates an instance of the ManagedClusterSnapshotsClient client using a +// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, +// Azure stack). +func NewManagedClusterSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) ManagedClusterSnapshotsClient { + return ManagedClusterSnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the managed cluster snapshot to create or update. +func (client ManagedClusterSnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ManagedClusterSnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ManagedClusterSnapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClusterSnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ManagedClusterSnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client ManagedClusterSnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ManagedClusterSnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) GetResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client ManagedClusterSnapshotsClient) List(ctx context.Context) (result ManagedClusterSnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.List") + defer func() { + sc := -1 + if result.mcslr.Response.Response != nil { + sc = result.mcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.mcslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.mcslr.hasNextLink() && result.mcslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ManagedClusterSnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedclustersnapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) ListResponder(resp *http.Response) (result ManagedClusterSnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ManagedClusterSnapshotsClient) listNextResults(ctx context.Context, lastResults ManagedClusterSnapshotListResult) (result ManagedClusterSnapshotListResult, err error) { + req, err := lastResults.managedClusterSnapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClusterSnapshotsClient) ListComplete(ctx context.Context) (result ManagedClusterSnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client ManagedClusterSnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ManagedClusterSnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.mcslr.Response.Response != nil { + sc = result.mcslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.mcslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.mcslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.mcslr.hasNextLink() && result.mcslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result ManagedClusterSnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client ManagedClusterSnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ManagedClusterSnapshotListResult) (result ManagedClusterSnapshotListResult, err error) { + req, err := lastResults.managedClusterSnapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client ManagedClusterSnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ManagedClusterSnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update managed cluster snapshot Tags operation. +func (client ManagedClusterSnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result ManagedClusterSnapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ManagedClusterSnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClusterSnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client ManagedClusterSnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client ManagedClusterSnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client ManagedClusterSnapshotsClient) UpdateTagsResponder(resp *http.Response) (result ManagedClusterSnapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go new file mode 100644 index 000000000000..0f058147120e --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/models.go @@ -0,0 +1,4579 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice" + +// AccessProfile profile for enabling a user to access a managed cluster. +type AccessProfile struct { + // KubeConfig - Base64-encoded Kubernetes configuration file. + KubeConfig *[]byte `json:"kubeConfig,omitempty"` +} + +// AgentPool agent Pool. +type AgentPool struct { + autorest.Response `json:"-"` + // ManagedClusterAgentPoolProfileProperties - Properties of an agent pool. + *ManagedClusterAgentPoolProfileProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPool. +func (ap AgentPool) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ap.ManagedClusterAgentPoolProfileProperties != nil { + objectMap["properties"] = ap.ManagedClusterAgentPoolProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPool struct. +func (ap *AgentPool) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedClusterAgentPoolProfileProperties ManagedClusterAgentPoolProfileProperties + err = json.Unmarshal(*v, &managedClusterAgentPoolProfileProperties) + if err != nil { + return err + } + ap.ManagedClusterAgentPoolProfileProperties = &managedClusterAgentPoolProfileProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ap.Type = &typeVar + } + } + } + + return nil +} + +// AgentPoolAvailableVersions the list of available versions for an agent pool. +type AgentPoolAvailableVersions struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool version list. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool version list. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of the agent pool version list. + Type *string `json:"type,omitempty"` + // AgentPoolAvailableVersionsProperties - Properties of agent pool available versions. + *AgentPoolAvailableVersionsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolAvailableVersions. +func (apav AgentPoolAvailableVersions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apav.AgentPoolAvailableVersionsProperties != nil { + objectMap["properties"] = apav.AgentPoolAvailableVersionsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolAvailableVersions struct. +func (apav *AgentPoolAvailableVersions) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apav.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apav.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apav.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolAvailableVersionsProperties AgentPoolAvailableVersionsProperties + err = json.Unmarshal(*v, &agentPoolAvailableVersionsProperties) + if err != nil { + return err + } + apav.AgentPoolAvailableVersionsProperties = &agentPoolAvailableVersionsProperties + } + } + } + + return nil +} + +// AgentPoolAvailableVersionsProperties the list of available agent pool versions. +type AgentPoolAvailableVersionsProperties struct { + // AgentPoolVersions - List of versions available for agent pool. + AgentPoolVersions *[]AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem `json:"agentPoolVersions,omitempty"` +} + +// AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem ... +type AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem struct { + // Default - Whether this version is the default agent pool version. + Default *bool `json:"default,omitempty"` + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolListResult the response from the List Agent Pools operation. +type AgentPoolListResult struct { + autorest.Response `json:"-"` + // Value - The list of agent pools. + Value *[]AgentPool `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of agent pool results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolListResult. +func (aplr AgentPoolListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aplr.Value != nil { + objectMap["value"] = aplr.Value + } + return json.Marshal(objectMap) +} + +// AgentPoolListResultIterator provides access to a complete listing of AgentPool values. +type AgentPoolListResultIterator struct { + i int + page AgentPoolListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AgentPoolListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AgentPoolListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AgentPoolListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AgentPoolListResultIterator) Response() AgentPoolListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AgentPoolListResultIterator) Value() AgentPool { + if !iter.page.NotDone() { + return AgentPool{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AgentPoolListResultIterator type. +func NewAgentPoolListResultIterator(page AgentPoolListResultPage) AgentPoolListResultIterator { + return AgentPoolListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aplr AgentPoolListResult) IsEmpty() bool { + return aplr.Value == nil || len(*aplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aplr AgentPoolListResult) hasNextLink() bool { + return aplr.NextLink != nil && len(*aplr.NextLink) != 0 +} + +// agentPoolListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aplr AgentPoolListResult) agentPoolListResultPreparer(ctx context.Context) (*http.Request, error) { + if !aplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aplr.NextLink))) +} + +// AgentPoolListResultPage contains a page of AgentPool values. +type AgentPoolListResultPage struct { + fn func(context.Context, AgentPoolListResult) (AgentPoolListResult, error) + aplr AgentPoolListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AgentPoolListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgentPoolListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.aplr) + if err != nil { + return err + } + page.aplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AgentPoolListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AgentPoolListResultPage) NotDone() bool { + return !page.aplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AgentPoolListResultPage) Response() AgentPoolListResult { + return page.aplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AgentPoolListResultPage) Values() []AgentPool { + if page.aplr.IsEmpty() { + return nil + } + return *page.aplr.Value +} + +// Creates a new instance of the AgentPoolListResultPage type. +func NewAgentPoolListResultPage(cur AgentPoolListResult, getNextPage func(context.Context, AgentPoolListResult) (AgentPoolListResult, error)) AgentPoolListResultPage { + return AgentPoolListResultPage{ + fn: getNextPage, + aplr: cur, + } +} + +// AgentPoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsCreateOrUpdateFuture.Result. +func (future *AgentPoolsCreateOrUpdateFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.CreateOrUpdateResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsCreateOrUpdateFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AgentPoolsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsDeleteFuture.Result. +func (future *AgentPoolsDeleteFuture) result(client AgentPoolsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// AgentPoolsUpgradeNodeImageVersionFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type AgentPoolsUpgradeNodeImageVersionFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AgentPoolsClient) (AgentPool, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for AgentPoolsUpgradeNodeImageVersionFuture.Result. +func (future *AgentPoolsUpgradeNodeImageVersionFuture) result(client AgentPoolsClient) (ap AgentPool, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ap.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.AgentPoolsUpgradeNodeImageVersionFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ap.Response.Response, err = future.GetResult(sender); err == nil && ap.Response.Response.StatusCode != http.StatusNoContent { + ap, err = client.UpgradeNodeImageVersionResponder(ap.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.AgentPoolsUpgradeNodeImageVersionFuture", "Result", ap.Response.Response, "Failure responding to request") + } + } + return +} + +// AgentPoolUpgradeProfile the list of available upgrades for an agent pool. +type AgentPoolUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the agent pool upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the agent pool upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the agent pool upgrade profile. + Type *string `json:"type,omitempty"` + // AgentPoolUpgradeProfileProperties - The properties of the agent pool upgrade profile. + *AgentPoolUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AgentPoolUpgradeProfile. +func (apup AgentPoolUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if apup.AgentPoolUpgradeProfileProperties != nil { + objectMap["properties"] = apup.AgentPoolUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AgentPoolUpgradeProfile struct. +func (apup *AgentPoolUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + apup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + apup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + apup.Type = &typeVar + } + case "properties": + if v != nil { + var agentPoolUpgradeProfileProperties AgentPoolUpgradeProfileProperties + err = json.Unmarshal(*v, &agentPoolUpgradeProfileProperties) + if err != nil { + return err + } + apup.AgentPoolUpgradeProfileProperties = &agentPoolUpgradeProfileProperties + } + } + } + + return nil +} + +// AgentPoolUpgradeProfileProperties the list of available upgrade versions. +type AgentPoolUpgradeProfileProperties struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]AgentPoolUpgradeProfilePropertiesUpgradesItem `json:"upgrades,omitempty"` + // LatestNodeImageVersion - The latest AKS supported node image version. + LatestNodeImageVersion *string `json:"latestNodeImageVersion,omitempty"` +} + +// AgentPoolUpgradeProfilePropertiesUpgradesItem ... +type AgentPoolUpgradeProfilePropertiesUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// AgentPoolUpgradeSettings settings for upgrading an agentpool +type AgentPoolUpgradeSettings struct { + // MaxSurge - This can either be set to an integer (e.g. '5') or a percentage (e.g. '50%'). If a percentage is specified, it is the percentage of the total agent pool size at the time of the upgrade. For percentages, fractional nodes are rounded up. If not specified, the default is 1. For more information, including best practices, see: https://docs.microsoft.com/azure/aks/upgrade-cluster#customize-node-surge-upgrade + MaxSurge *string `json:"maxSurge,omitempty"` +} + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AzureKeyVaultKms azure Key Vault key management service settings for the security profile. +type AzureKeyVaultKms struct { + // Enabled - Whether to enable Azure Key Vault key management service. The default is false. + Enabled *bool `json:"enabled,omitempty"` + // KeyID - Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty. + KeyID *string `json:"keyId,omitempty"` +} + +// CloudError an error response from the Container service. +type CloudError struct { + // Error - Details about the error. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the Container service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CommandResultProperties the results of a run command +type CommandResultProperties struct { + // ProvisioningState - READ-ONLY; provisioning State + ProvisioningState *string `json:"provisioningState,omitempty"` + // ExitCode - READ-ONLY; The exit code of the command + ExitCode *int32 `json:"exitCode,omitempty"` + // StartedAt - READ-ONLY; The time when the command started. + StartedAt *date.Time `json:"startedAt,omitempty"` + // FinishedAt - READ-ONLY; The time when the command finished. + FinishedAt *date.Time `json:"finishedAt,omitempty"` + // Logs - READ-ONLY; The command output. + Logs *string `json:"logs,omitempty"` + // Reason - READ-ONLY; An explanation of why provisioningState is set to failed (if so). + Reason *string `json:"reason,omitempty"` +} + +// MarshalJSON is the custom marshaler for CommandResultProperties. +func (crp CommandResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CreationData data used when creating a target resource from a source resource. +type CreationData struct { + // SourceResourceID - This is the ARM ID of the source object to be used to create the target object. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// CredentialResult the credential result response. +type CredentialResult struct { + // Name - READ-ONLY; The name of the credential. + Name *string `json:"name,omitempty"` + // Value - READ-ONLY; Base64-encoded Kubernetes configuration file. + Value *[]byte `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResult. +func (cr CredentialResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// CredentialResults the list credential result response. +type CredentialResults struct { + autorest.Response `json:"-"` + // Kubeconfigs - READ-ONLY; Base64-encoded Kubernetes configuration file. + Kubeconfigs *[]CredentialResult `json:"kubeconfigs,omitempty"` +} + +// MarshalJSON is the custom marshaler for CredentialResults. +func (cr CredentialResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DiagnosticsProfile profile for diagnostics on the container service cluster. +type DiagnosticsProfile struct { + // VMDiagnostics - Profile for diagnostics on the container service VMs. + VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` +} + +// EndpointDependency a domain name that AKS agent nodes are reaching at. +type EndpointDependency struct { + // DomainName - The domain name of the dependency. + DomainName *string `json:"domainName,omitempty"` + // EndpointDetails - The Ports and Protocols used when connecting to domainName. + EndpointDetails *[]EndpointDetail `json:"endpointDetails,omitempty"` +} + +// EndpointDetail connect information from the AKS agent nodes to a single endpoint. +type EndpointDetail struct { + // IPAddress - An IP Address that Domain Name currently resolves to. + IPAddress *string `json:"ipAddress,omitempty"` + // Port - The port an endpoint is connected to. + Port *int32 `json:"port,omitempty"` + // Protocol - The protocol used for connection + Protocol *string `json:"protocol,omitempty"` + // Description - Description of the detail + Description *string `json:"description,omitempty"` +} + +// ExtendedLocation the complex type of the extended location. +type ExtendedLocation struct { + // Name - The name of the extended location. + Name *string `json:"name,omitempty"` + // Type - The type of the extended location. Possible values include: 'ExtendedLocationTypesEdgeZone' + Type ExtendedLocationTypes `json:"type,omitempty"` +} + +// KubeletConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type KubeletConfig struct { + // CPUManagerPolicy - The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. + CPUManagerPolicy *string `json:"cpuManagerPolicy,omitempty"` + // CPUCfsQuota - The default is true. + CPUCfsQuota *bool `json:"cpuCfsQuota,omitempty"` + // CPUCfsQuotaPeriod - The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. + CPUCfsQuotaPeriod *string `json:"cpuCfsQuotaPeriod,omitempty"` + // ImageGcHighThreshold - To disable image garbage collection, set to 100. The default is 85% + ImageGcHighThreshold *int32 `json:"imageGcHighThreshold,omitempty"` + // ImageGcLowThreshold - This cannot be set higher than imageGcHighThreshold. The default is 80% + ImageGcLowThreshold *int32 `json:"imageGcLowThreshold,omitempty"` + // TopologyManagerPolicy - For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. + TopologyManagerPolicy *string `json:"topologyManagerPolicy,omitempty"` + // AllowedUnsafeSysctls - Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). + AllowedUnsafeSysctls *[]string `json:"allowedUnsafeSysctls,omitempty"` + // FailSwapOn - If set to true it will make the Kubelet fail to start if swap is enabled on the node. + FailSwapOn *bool `json:"failSwapOn,omitempty"` + // ContainerLogMaxSizeMB - The maximum size (e.g. 10Mi) of container log file before it is rotated. + ContainerLogMaxSizeMB *int32 `json:"containerLogMaxSizeMB,omitempty"` + // ContainerLogMaxFiles - The maximum number of container log files that can be present for a container. The number must be ≥ 2. + ContainerLogMaxFiles *int32 `json:"containerLogMaxFiles,omitempty"` + // PodMaxPids - The maximum number of processes per pod. + PodMaxPids *int32 `json:"podMaxPids,omitempty"` +} + +// LinuxOSConfig see [AKS custom node +// configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. +type LinuxOSConfig struct { + // Sysctls - Sysctl settings for Linux agent nodes. + Sysctls *SysctlConfig `json:"sysctls,omitempty"` + // TransparentHugePageEnabled - Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageEnabled *string `json:"transparentHugePageEnabled,omitempty"` + // TransparentHugePageDefrag - Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). + TransparentHugePageDefrag *string `json:"transparentHugePageDefrag,omitempty"` + // SwapFileSizeMB - The size in MB of a swap file that will be created on each node. + SwapFileSizeMB *int32 `json:"swapFileSizeMB,omitempty"` +} + +// LinuxProfile profile for Linux VMs in the container service cluster. +type LinuxProfile struct { + // AdminUsername - The administrator username to use for Linux VMs. + AdminUsername *string `json:"adminUsername,omitempty"` + // SSH - The SSH configuration for Linux-based VMs running on Azure. + SSH *SSHConfiguration `json:"ssh,omitempty"` +} + +// MaintenanceConfiguration see [planned +// maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about +// planned maintenance. +type MaintenanceConfiguration struct { + autorest.Response `json:"-"` + // SystemData - READ-ONLY; The system metadata relating to this resource. + SystemData *SystemData `json:"systemData,omitempty"` + // MaintenanceConfigurationProperties - Properties of a default maintenance configuration. + *MaintenanceConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfiguration. +func (mc MaintenanceConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.MaintenanceConfigurationProperties != nil { + objectMap["properties"] = mc.MaintenanceConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MaintenanceConfiguration struct. +func (mc *MaintenanceConfiguration) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + case "properties": + if v != nil { + var maintenanceConfigurationProperties MaintenanceConfigurationProperties + err = json.Unmarshal(*v, &maintenanceConfigurationProperties) + if err != nil { + return err + } + mc.MaintenanceConfigurationProperties = &maintenanceConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + } + } + + return nil +} + +// MaintenanceConfigurationListResult the response from the List maintenance configurations operation. +type MaintenanceConfigurationListResult struct { + autorest.Response `json:"-"` + // Value - The list of maintenance configurations. + Value *[]MaintenanceConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of maintenance configuration results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for MaintenanceConfigurationListResult. +func (mclr MaintenanceConfigurationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// MaintenanceConfigurationListResultIterator provides access to a complete listing of +// MaintenanceConfiguration values. +type MaintenanceConfigurationListResultIterator struct { + i int + page MaintenanceConfigurationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MaintenanceConfigurationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MaintenanceConfigurationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MaintenanceConfigurationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MaintenanceConfigurationListResultIterator) Response() MaintenanceConfigurationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MaintenanceConfigurationListResultIterator) Value() MaintenanceConfiguration { + if !iter.page.NotDone() { + return MaintenanceConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MaintenanceConfigurationListResultIterator type. +func NewMaintenanceConfigurationListResultIterator(page MaintenanceConfigurationListResultPage) MaintenanceConfigurationListResultIterator { + return MaintenanceConfigurationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr MaintenanceConfigurationListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr MaintenanceConfigurationListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// maintenanceConfigurationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr MaintenanceConfigurationListResult) maintenanceConfigurationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// MaintenanceConfigurationListResultPage contains a page of MaintenanceConfiguration values. +type MaintenanceConfigurationListResultPage struct { + fn func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error) + mclr MaintenanceConfigurationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MaintenanceConfigurationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MaintenanceConfigurationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MaintenanceConfigurationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MaintenanceConfigurationListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MaintenanceConfigurationListResultPage) Response() MaintenanceConfigurationListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MaintenanceConfigurationListResultPage) Values() []MaintenanceConfiguration { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the MaintenanceConfigurationListResultPage type. +func NewMaintenanceConfigurationListResultPage(cur MaintenanceConfigurationListResult, getNextPage func(context.Context, MaintenanceConfigurationListResult) (MaintenanceConfigurationListResult, error)) MaintenanceConfigurationListResultPage { + return MaintenanceConfigurationListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// MaintenanceConfigurationProperties properties used to configure planned maintenance for a Managed +// Cluster. +type MaintenanceConfigurationProperties struct { + // TimeInWeek - If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. + TimeInWeek *[]TimeInWeek `json:"timeInWeek,omitempty"` + // NotAllowedTime - Time slots on which upgrade is not allowed. + NotAllowedTime *[]TimeSpan `json:"notAllowedTime,omitempty"` +} + +// ManagedCluster managed cluster. +type ManagedCluster struct { + autorest.Response `json:"-"` + // Sku - The managed cluster SKU. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // ExtendedLocation - The extended location of the Virtual Machine. + ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` + // Identity - The identity of the managed cluster, if configured. + Identity *ManagedClusterIdentity `json:"identity,omitempty"` + // ManagedClusterProperties - Properties of a managed cluster. + *ManagedClusterProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedCluster. +func (mc ManagedCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mc.Sku != nil { + objectMap["sku"] = mc.Sku + } + if mc.ExtendedLocation != nil { + objectMap["extendedLocation"] = mc.ExtendedLocation + } + if mc.Identity != nil { + objectMap["identity"] = mc.Identity + } + if mc.ManagedClusterProperties != nil { + objectMap["properties"] = mc.ManagedClusterProperties + } + if mc.Tags != nil { + objectMap["tags"] = mc.Tags + } + if mc.Location != nil { + objectMap["location"] = mc.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedCluster struct. +func (mc *ManagedCluster) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku ManagedClusterSKU + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + mc.Sku = &sku + } + case "extendedLocation": + if v != nil { + var extendedLocation ExtendedLocation + err = json.Unmarshal(*v, &extendedLocation) + if err != nil { + return err + } + mc.ExtendedLocation = &extendedLocation + } + case "identity": + if v != nil { + var identity ManagedClusterIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + mc.Identity = &identity + } + case "properties": + if v != nil { + var managedClusterProperties ManagedClusterProperties + err = json.Unmarshal(*v, &managedClusterProperties) + if err != nil { + return err + } + mc.ManagedClusterProperties = &managedClusterProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mc.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mc.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mc.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAADProfile for more details see [managed AAD on +// AKS](https://docs.microsoft.com/azure/aks/managed-aad). +type ManagedClusterAADProfile struct { + // Managed - Whether to enable managed AAD. + Managed *bool `json:"managed,omitempty"` + // EnableAzureRBAC - Whether to enable Azure RBAC for Kubernetes authorization. + EnableAzureRBAC *bool `json:"enableAzureRBAC,omitempty"` + // AdminGroupObjectIDs - The list of AAD group object IDs that will have admin role of the cluster. + AdminGroupObjectIDs *[]string `json:"adminGroupObjectIDs,omitempty"` + // ClientAppID - The client AAD application ID. + ClientAppID *string `json:"clientAppID,omitempty"` + // ServerAppID - The server AAD application ID. + ServerAppID *string `json:"serverAppID,omitempty"` + // ServerAppSecret - The server AAD application secret. + ServerAppSecret *string `json:"serverAppSecret,omitempty"` + // TenantID - The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. + TenantID *string `json:"tenantID,omitempty"` +} + +// ManagedClusterAccessProfile managed cluster Access Profile. +type ManagedClusterAccessProfile struct { + autorest.Response `json:"-"` + // AccessProfile - AccessProfile of a managed cluster. + *AccessProfile `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAccessProfile. +func (mcap ManagedClusterAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.AccessProfile != nil { + objectMap["properties"] = mcap.AccessProfile + } + if mcap.Tags != nil { + objectMap["tags"] = mcap.Tags + } + if mcap.Location != nil { + objectMap["location"] = mcap.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterAccessProfile struct. +func (mcap *ManagedClusterAccessProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var accessProfile AccessProfile + err = json.Unmarshal(*v, &accessProfile) + if err != nil { + return err + } + mcap.AccessProfile = &accessProfile + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcap.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcap.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcap.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcap.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcap.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mcap.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterAddonProfile a Kubernetes add-on profile for a managed cluster. +type ManagedClusterAddonProfile struct { + // Enabled - Whether the add-on is enabled or not. + Enabled *bool `json:"enabled,omitempty"` + // Config - Key-value pairs for configuring an add-on. + Config map[string]*string `json:"config"` + // Identity - READ-ONLY; Information of user assigned identity used by this add-on. + Identity *ManagedClusterAddonProfileIdentity `json:"identity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAddonProfile. +func (mcap ManagedClusterAddonProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcap.Enabled != nil { + objectMap["enabled"] = mcap.Enabled + } + if mcap.Config != nil { + objectMap["config"] = mcap.Config + } + return json.Marshal(objectMap) +} + +// ManagedClusterAddonProfileIdentity information of user assigned identity used by this add-on. +type ManagedClusterAddonProfileIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// ManagedClusterAgentPoolProfile profile for the container service agent pool. +type ManagedClusterAgentPoolProfile struct { + // Name - Windows agent pool names must be 6 characters or less. + Name *string `json:"name,omitempty"` + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // CurrentOrchestratorVersion - If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion was , this field will contain the full version being used. + CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + HostGroupID *string `json:"hostGroupID,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfile. +func (mcapp ManagedClusterAgentPoolProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcapp.Name != nil { + objectMap["name"] = mcapp.Name + } + if mcapp.Count != nil { + objectMap["count"] = mcapp.Count + } + if mcapp.VMSize != nil { + objectMap["vmSize"] = mcapp.VMSize + } + if mcapp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcapp.OsDiskSizeGB + } + if mcapp.OsDiskType != "" { + objectMap["osDiskType"] = mcapp.OsDiskType + } + if mcapp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcapp.KubeletDiskType + } + if mcapp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcapp.WorkloadRuntime + } + if mcapp.MessageOfTheDay != nil { + objectMap["messageOfTheDay"] = mcapp.MessageOfTheDay + } + if mcapp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcapp.VnetSubnetID + } + if mcapp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcapp.PodSubnetID + } + if mcapp.MaxPods != nil { + objectMap["maxPods"] = mcapp.MaxPods + } + if mcapp.OsType != "" { + objectMap["osType"] = mcapp.OsType + } + if mcapp.OsSKU != "" { + objectMap["osSKU"] = mcapp.OsSKU + } + if mcapp.MaxCount != nil { + objectMap["maxCount"] = mcapp.MaxCount + } + if mcapp.MinCount != nil { + objectMap["minCount"] = mcapp.MinCount + } + if mcapp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcapp.EnableAutoScaling + } + if mcapp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcapp.ScaleDownMode + } + if mcapp.Type != "" { + objectMap["type"] = mcapp.Type + } + if mcapp.Mode != "" { + objectMap["mode"] = mcapp.Mode + } + if mcapp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcapp.OrchestratorVersion + } + if mcapp.CurrentOrchestratorVersion != nil { + objectMap["currentOrchestratorVersion"] = mcapp.CurrentOrchestratorVersion + } + if mcapp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcapp.UpgradeSettings + } + if mcapp.PowerState != nil { + objectMap["powerState"] = mcapp.PowerState + } + if mcapp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcapp.AvailabilityZones + } + if mcapp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcapp.EnableNodePublicIP + } + if mcapp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcapp.NodePublicIPPrefixID + } + if mcapp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcapp.ScaleSetPriority + } + if mcapp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcapp.ScaleSetEvictionPolicy + } + if mcapp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcapp.SpotMaxPrice + } + if mcapp.Tags != nil { + objectMap["tags"] = mcapp.Tags + } + if mcapp.NodeLabels != nil { + objectMap["nodeLabels"] = mcapp.NodeLabels + } + if mcapp.NodeTaints != nil { + objectMap["nodeTaints"] = mcapp.NodeTaints + } + if mcapp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcapp.ProximityPlacementGroupID + } + if mcapp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcapp.KubeletConfig + } + if mcapp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcapp.LinuxOSConfig + } + if mcapp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcapp.EnableEncryptionAtHost + } + if mcapp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcapp.EnableUltraSSD + } + if mcapp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcapp.EnableFIPS + } + if mcapp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcapp.GpuInstanceProfile + } + if mcapp.CreationData != nil { + objectMap["creationData"] = mcapp.CreationData + } + if mcapp.CapacityReservationGroupID != nil { + objectMap["capacityReservationGroupID"] = mcapp.CapacityReservationGroupID + } + if mcapp.HostGroupID != nil { + objectMap["hostGroupID"] = mcapp.HostGroupID + } + return json.Marshal(objectMap) +} + +// ManagedClusterAgentPoolProfileProperties properties for the container service agent pool profile. +type ManagedClusterAgentPoolProfileProperties struct { + // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to 1000 (inclusive) for system pools. The default value is 1. + Count *int32 `json:"count,omitempty"` + // VMSize - VM size availability varies by region. If a node contains insufficient compute resources (memory, cpu, etc) pods might fail to run correctly. For more details on restricted VM sizes, see: https://docs.microsoft.com/azure/aks/quotas-skus-regions + VMSize *string `json:"vmSize,omitempty"` + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // OsDiskType - Possible values include: 'OSDiskTypeManaged', 'OSDiskTypeEphemeral' + OsDiskType OSDiskType `json:"osDiskType,omitempty"` + // KubeletDiskType - Possible values include: 'KubeletDiskTypeOS', 'KubeletDiskTypeTemporary' + KubeletDiskType KubeletDiskType `json:"kubeletDiskType,omitempty"` + // WorkloadRuntime - Possible values include: 'WorkloadRuntimeOCIContainer', 'WorkloadRuntimeWasmWasi' + WorkloadRuntime WorkloadRuntime `json:"workloadRuntime,omitempty"` + // MessageOfTheDay - A base64-encoded string which will be written to /etc/motd after decoding. This allows customization of the message of the day for Linux nodes. It must not be specified for Windows nodes. It must be a static string (i.e., will be printed raw and not be executed as a script). + MessageOfTheDay *string `json:"messageOfTheDay,omitempty"` + // VnetSubnetID - If this is not specified, a VNET and subnet will be generated and used. If no podSubnetID is specified, this applies to nodes and pods, otherwise it applies to just nodes. This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // PodSubnetID - If omitted, pod IPs are statically assigned on the node subnet (see vnetSubnetID for more details). This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} + PodSubnetID *string `json:"podSubnetID,omitempty"` + // MaxPods - The maximum number of pods that can run on a node. + MaxPods *int32 `json:"maxPods,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSKU - Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSKU OSSKU `json:"osSKU,omitempty"` + // MaxCount - The maximum number of nodes for auto-scaling + MaxCount *int32 `json:"maxCount,omitempty"` + // MinCount - The minimum number of nodes for auto-scaling + MinCount *int32 `json:"minCount,omitempty"` + // EnableAutoScaling - Whether to enable auto-scaler + EnableAutoScaling *bool `json:"enableAutoScaling,omitempty"` + // ScaleDownMode - This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. Possible values include: 'ScaleDownModeDelete', 'ScaleDownModeDeallocate' + ScaleDownMode ScaleDownMode `json:"scaleDownMode,omitempty"` + // Type - Possible values include: 'AgentPoolTypeVirtualMachineScaleSets', 'AgentPoolTypeAvailabilitySet' + Type AgentPoolType `json:"type,omitempty"` + // Mode - Possible values include: 'AgentPoolModeSystem', 'AgentPoolModeUser' + Mode AgentPoolMode `json:"mode,omitempty"` + // OrchestratorVersion - Both patch version and are supported. When is specified, the latest supported patch version is chosen automatically. Updating the agent pool with the same once it has been created will not trigger an upgrade, even if a newer patch version is available. As a best practice, you should upgrade all node pools in an AKS cluster to the same Kubernetes version. The node pool version must have the same major version as the control plane. The node pool minor version must be within two minor versions of the control plane version. The node pool version cannot be greater than the control plane version. For more information see [upgrading a node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). + OrchestratorVersion *string `json:"orchestratorVersion,omitempty"` + // CurrentOrchestratorVersion - If orchestratorVersion was a fully specified version , this field will be exactly equal to it. If orchestratorVersion was , this field will contain the full version being used. + CurrentOrchestratorVersion *string `json:"currentOrchestratorVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // UpgradeSettings - Settings for upgrading the agentpool + UpgradeSettings *AgentPoolUpgradeSettings `json:"upgradeSettings,omitempty"` + // ProvisioningState - READ-ONLY; The current deployment or provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops all of its VMs and does not accrue billing charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // AvailabilityZones - The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. + AvailabilityZones *[]string `json:"availabilityZones,omitempty"` + // EnableNodePublicIP - Some scenarios may require nodes in a node pool to receive their own dedicated public IP addresses. A common scenario is for gaming workloads, where a console needs to make a direct connection to a cloud virtual machine to minimize hops. For more information see [assigning a public IP per node](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#assign-a-public-ip-per-node-for-your-node-pools). The default is false. + EnableNodePublicIP *bool `json:"enableNodePublicIP,omitempty"` + // NodePublicIPPrefixID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName} + NodePublicIPPrefixID *string `json:"nodePublicIPPrefixID,omitempty"` + // ScaleSetPriority - The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. Possible values include: 'ScaleSetPrioritySpot', 'ScaleSetPriorityRegular' + ScaleSetPriority ScaleSetPriority `json:"scaleSetPriority,omitempty"` + // ScaleSetEvictionPolicy - This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. Possible values include: 'ScaleSetEvictionPolicyDelete', 'ScaleSetEvictionPolicyDeallocate' + ScaleSetEvictionPolicy ScaleSetEvictionPolicy `json:"scaleSetEvictionPolicy,omitempty"` + // SpotMaxPrice - Possible values are any decimal value greater than zero or -1 which indicates the willingness to pay any on-demand price. For more details on spot pricing, see [spot VMs pricing](https://docs.microsoft.com/azure/virtual-machines/spot-vms#pricing) + SpotMaxPrice *float64 `json:"spotMaxPrice,omitempty"` + // Tags - The tags to be persisted on the agent pool virtual machine scale set. + Tags map[string]*string `json:"tags"` + // NodeLabels - The node labels to be persisted across all nodes in agent pool. + NodeLabels map[string]*string `json:"nodeLabels"` + // NodeTaints - The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. + NodeTaints *[]string `json:"nodeTaints,omitempty"` + // ProximityPlacementGroupID - The ID for Proximity Placement Group. + ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` + // KubeletConfig - The Kubelet configuration on the agent pool nodes. + KubeletConfig *KubeletConfig `json:"kubeletConfig,omitempty"` + // LinuxOSConfig - The OS configuration of Linux agent nodes. + LinuxOSConfig *LinuxOSConfig `json:"linuxOSConfig,omitempty"` + // EnableEncryptionAtHost - This is only supported on certain VM sizes and in certain Azure regions. For more information, see: https://docs.microsoft.com/azure/aks/enable-host-encryption + EnableEncryptionAtHost *bool `json:"enableEncryptionAtHost,omitempty"` + // EnableUltraSSD - Whether to enable UltraSSD + EnableUltraSSD *bool `json:"enableUltraSSD,omitempty"` + // EnableFIPS - See [Add a FIPS-enabled node pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#add-a-fips-enabled-node-pool-preview) for more details. + EnableFIPS *bool `json:"enableFIPS,omitempty"` + // GpuInstanceProfile - GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. Possible values include: 'GPUInstanceProfileMIG1g', 'GPUInstanceProfileMIG2g', 'GPUInstanceProfileMIG3g', 'GPUInstanceProfileMIG4g', 'GPUInstanceProfileMIG7g' + GpuInstanceProfile GPUInstanceProfile `json:"gpuInstanceProfile,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // CapacityReservationGroupID - AKS will associate the specified agent pool with the Capacity Reservation Group. + CapacityReservationGroupID *string `json:"capacityReservationGroupID,omitempty"` + // HostGroupID - This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. For more information see [Azure dedicated hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + HostGroupID *string `json:"hostGroupID,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterAgentPoolProfileProperties. +func (mcappp ManagedClusterAgentPoolProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcappp.Count != nil { + objectMap["count"] = mcappp.Count + } + if mcappp.VMSize != nil { + objectMap["vmSize"] = mcappp.VMSize + } + if mcappp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mcappp.OsDiskSizeGB + } + if mcappp.OsDiskType != "" { + objectMap["osDiskType"] = mcappp.OsDiskType + } + if mcappp.KubeletDiskType != "" { + objectMap["kubeletDiskType"] = mcappp.KubeletDiskType + } + if mcappp.WorkloadRuntime != "" { + objectMap["workloadRuntime"] = mcappp.WorkloadRuntime + } + if mcappp.MessageOfTheDay != nil { + objectMap["messageOfTheDay"] = mcappp.MessageOfTheDay + } + if mcappp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mcappp.VnetSubnetID + } + if mcappp.PodSubnetID != nil { + objectMap["podSubnetID"] = mcappp.PodSubnetID + } + if mcappp.MaxPods != nil { + objectMap["maxPods"] = mcappp.MaxPods + } + if mcappp.OsType != "" { + objectMap["osType"] = mcappp.OsType + } + if mcappp.OsSKU != "" { + objectMap["osSKU"] = mcappp.OsSKU + } + if mcappp.MaxCount != nil { + objectMap["maxCount"] = mcappp.MaxCount + } + if mcappp.MinCount != nil { + objectMap["minCount"] = mcappp.MinCount + } + if mcappp.EnableAutoScaling != nil { + objectMap["enableAutoScaling"] = mcappp.EnableAutoScaling + } + if mcappp.ScaleDownMode != "" { + objectMap["scaleDownMode"] = mcappp.ScaleDownMode + } + if mcappp.Type != "" { + objectMap["type"] = mcappp.Type + } + if mcappp.Mode != "" { + objectMap["mode"] = mcappp.Mode + } + if mcappp.OrchestratorVersion != nil { + objectMap["orchestratorVersion"] = mcappp.OrchestratorVersion + } + if mcappp.CurrentOrchestratorVersion != nil { + objectMap["currentOrchestratorVersion"] = mcappp.CurrentOrchestratorVersion + } + if mcappp.UpgradeSettings != nil { + objectMap["upgradeSettings"] = mcappp.UpgradeSettings + } + if mcappp.PowerState != nil { + objectMap["powerState"] = mcappp.PowerState + } + if mcappp.AvailabilityZones != nil { + objectMap["availabilityZones"] = mcappp.AvailabilityZones + } + if mcappp.EnableNodePublicIP != nil { + objectMap["enableNodePublicIP"] = mcappp.EnableNodePublicIP + } + if mcappp.NodePublicIPPrefixID != nil { + objectMap["nodePublicIPPrefixID"] = mcappp.NodePublicIPPrefixID + } + if mcappp.ScaleSetPriority != "" { + objectMap["scaleSetPriority"] = mcappp.ScaleSetPriority + } + if mcappp.ScaleSetEvictionPolicy != "" { + objectMap["scaleSetEvictionPolicy"] = mcappp.ScaleSetEvictionPolicy + } + if mcappp.SpotMaxPrice != nil { + objectMap["spotMaxPrice"] = mcappp.SpotMaxPrice + } + if mcappp.Tags != nil { + objectMap["tags"] = mcappp.Tags + } + if mcappp.NodeLabels != nil { + objectMap["nodeLabels"] = mcappp.NodeLabels + } + if mcappp.NodeTaints != nil { + objectMap["nodeTaints"] = mcappp.NodeTaints + } + if mcappp.ProximityPlacementGroupID != nil { + objectMap["proximityPlacementGroupID"] = mcappp.ProximityPlacementGroupID + } + if mcappp.KubeletConfig != nil { + objectMap["kubeletConfig"] = mcappp.KubeletConfig + } + if mcappp.LinuxOSConfig != nil { + objectMap["linuxOSConfig"] = mcappp.LinuxOSConfig + } + if mcappp.EnableEncryptionAtHost != nil { + objectMap["enableEncryptionAtHost"] = mcappp.EnableEncryptionAtHost + } + if mcappp.EnableUltraSSD != nil { + objectMap["enableUltraSSD"] = mcappp.EnableUltraSSD + } + if mcappp.EnableFIPS != nil { + objectMap["enableFIPS"] = mcappp.EnableFIPS + } + if mcappp.GpuInstanceProfile != "" { + objectMap["gpuInstanceProfile"] = mcappp.GpuInstanceProfile + } + if mcappp.CreationData != nil { + objectMap["creationData"] = mcappp.CreationData + } + if mcappp.CapacityReservationGroupID != nil { + objectMap["capacityReservationGroupID"] = mcappp.CapacityReservationGroupID + } + if mcappp.HostGroupID != nil { + objectMap["hostGroupID"] = mcappp.HostGroupID + } + return json.Marshal(objectMap) +} + +// ManagedClusterAPIServerAccessProfile access profile for managed cluster API server. +type ManagedClusterAPIServerAccessProfile struct { + // AuthorizedIPRanges - IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). + AuthorizedIPRanges *[]string `json:"authorizedIPRanges,omitempty"` + // EnablePrivateCluster - For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). + EnablePrivateCluster *bool `json:"enablePrivateCluster,omitempty"` + // PrivateDNSZone - The default is System. For more details see [configure private DNS zone](https://docs.microsoft.com/azure/aks/private-clusters#configure-private-dns-zone). Allowed values are 'system' and 'none'. + PrivateDNSZone *string `json:"privateDNSZone,omitempty"` + // EnablePrivateClusterPublicFQDN - Whether to create additional public FQDN for private cluster or not. + EnablePrivateClusterPublicFQDN *bool `json:"enablePrivateClusterPublicFQDN,omitempty"` + // DisableRunCommand - Whether to disable run command for the cluster or not. + DisableRunCommand *bool `json:"disableRunCommand,omitempty"` +} + +// ManagedClusterAutoUpgradeProfile auto upgrade profile for a managed cluster. +type ManagedClusterAutoUpgradeProfile struct { + // UpgradeChannel - For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). Possible values include: 'UpgradeChannelRapid', 'UpgradeChannelStable', 'UpgradeChannelPatch', 'UpgradeChannelNodeImage', 'UpgradeChannelNone' + UpgradeChannel UpgradeChannel `json:"upgradeChannel,omitempty"` +} + +// ManagedClusterHTTPProxyConfig cluster HTTP proxy configuration. +type ManagedClusterHTTPProxyConfig struct { + // HTTPProxy - The HTTP proxy server endpoint to use. + HTTPProxy *string `json:"httpProxy,omitempty"` + // HTTPSProxy - The HTTPS proxy server endpoint to use. + HTTPSProxy *string `json:"httpsProxy,omitempty"` + // NoProxy - The endpoints that should not go through proxy. + NoProxy *[]string `json:"noProxy,omitempty"` + // EffectiveNoProxy - READ-ONLY; A read-only list of all endpoints for which traffic should not be sent to the proxy. This list is a superset of noProxy and values injected by AKS. + EffectiveNoProxy *[]string `json:"effectiveNoProxy,omitempty"` + // TrustedCa - Alternative CA cert to use for connecting to proxy servers. + TrustedCa *string `json:"trustedCa,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterHTTPProxyConfig. +func (mchpc ManagedClusterHTTPProxyConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mchpc.HTTPProxy != nil { + objectMap["httpProxy"] = mchpc.HTTPProxy + } + if mchpc.HTTPSProxy != nil { + objectMap["httpsProxy"] = mchpc.HTTPSProxy + } + if mchpc.NoProxy != nil { + objectMap["noProxy"] = mchpc.NoProxy + } + if mchpc.TrustedCa != nil { + objectMap["trustedCa"] = mchpc.TrustedCa + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentity identity for the managed cluster. +type ManagedClusterIdentity struct { + // PrincipalID - READ-ONLY; The principal id of the system assigned identity which is used by master components. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the system assigned identity which is used by master components. + TenantID *string `json:"tenantId,omitempty"` + // Type - For more information see [use managed identities in AKS](https://docs.microsoft.com/azure/aks/use-managed-identity). Possible values include: 'ResourceIdentityTypeSystemAssigned', 'ResourceIdentityTypeUserAssigned', 'ResourceIdentityTypeNone' + Type ResourceIdentityType `json:"type,omitempty"` + // UserAssignedIdentities - The keys must be ARM resource IDs in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*ManagedClusterIdentityUserAssignedIdentitiesValue `json:"userAssignedIdentities"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentity. +func (mci ManagedClusterIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mci.Type != "" { + objectMap["type"] = mci.Type + } + if mci.UserAssignedIdentities != nil { + objectMap["userAssignedIdentities"] = mci.UserAssignedIdentities + } + return json.Marshal(objectMap) +} + +// ManagedClusterIdentityUserAssignedIdentitiesValue ... +type ManagedClusterIdentityUserAssignedIdentitiesValue struct { + // PrincipalID - READ-ONLY; The principal id of user assigned identity. + PrincipalID *string `json:"principalId,omitempty"` + // ClientID - READ-ONLY; The client id of user assigned identity. + ClientID *string `json:"clientId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterIdentityUserAssignedIdentitiesValue. +func (mciAiv ManagedClusterIdentityUserAssignedIdentitiesValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ManagedClusterIngressProfile ingress profile for the container service cluster. +type ManagedClusterIngressProfile struct { + // WebAppRouting - Web App Routing settings for the ingress profile. + WebAppRouting *ManagedClusterIngressProfileWebAppRouting `json:"webAppRouting,omitempty"` +} + +// ManagedClusterIngressProfileWebAppRouting web App Routing settings for the ingress profile. +type ManagedClusterIngressProfileWebAppRouting struct { + // Enabled - Whether to enable Web App Routing. + Enabled *bool `json:"enabled,omitempty"` + // DNSZoneResourceID - Resource ID of the DNS Zone to be associated with the web app. Used only when Web App Routing is enabled. + DNSZoneResourceID *string `json:"dnsZoneResourceId,omitempty"` +} + +// ManagedClusterListResult the response from the List Managed Clusters operation. +type ManagedClusterListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed clusters. + Value *[]ManagedCluster `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterListResult. +func (mclr ManagedClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mclr.Value != nil { + objectMap["value"] = mclr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterListResultIterator provides access to a complete listing of ManagedCluster values. +type ManagedClusterListResultIterator struct { + i int + page ManagedClusterListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedClusterListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedClusterListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedClusterListResultIterator) Response() ManagedClusterListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedClusterListResultIterator) Value() ManagedCluster { + if !iter.page.NotDone() { + return ManagedCluster{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterListResultIterator type. +func NewManagedClusterListResultIterator(page ManagedClusterListResultPage) ManagedClusterListResultIterator { + return ManagedClusterListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mclr ManagedClusterListResult) IsEmpty() bool { + return mclr.Value == nil || len(*mclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mclr ManagedClusterListResult) hasNextLink() bool { + return mclr.NextLink != nil && len(*mclr.NextLink) != 0 +} + +// managedClusterListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mclr ManagedClusterListResult) managedClusterListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mclr.NextLink))) +} + +// ManagedClusterListResultPage contains a page of ManagedCluster values. +type ManagedClusterListResultPage struct { + fn func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error) + mclr ManagedClusterListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedClusterListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mclr) + if err != nil { + return err + } + page.mclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedClusterListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterListResultPage) NotDone() bool { + return !page.mclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterListResultPage) Response() ManagedClusterListResult { + return page.mclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterListResultPage) Values() []ManagedCluster { + if page.mclr.IsEmpty() { + return nil + } + return *page.mclr.Value +} + +// Creates a new instance of the ManagedClusterListResultPage type. +func NewManagedClusterListResultPage(cur ManagedClusterListResult, getNextPage func(context.Context, ManagedClusterListResult) (ManagedClusterListResult, error)) ManagedClusterListResultPage { + return ManagedClusterListResultPage{ + fn: getNextPage, + mclr: cur, + } +} + +// ManagedClusterLoadBalancerProfile profile of the managed cluster load balancer. +type ManagedClusterLoadBalancerProfile struct { + // ManagedOutboundIPs - Desired managed outbound IPs for the cluster load balancer. + ManagedOutboundIPs *ManagedClusterLoadBalancerProfileManagedOutboundIPs `json:"managedOutboundIPs,omitempty"` + // OutboundIPPrefixes - Desired outbound IP Prefix resources for the cluster load balancer. + OutboundIPPrefixes *ManagedClusterLoadBalancerProfileOutboundIPPrefixes `json:"outboundIPPrefixes,omitempty"` + // OutboundIPs - Desired outbound IP resources for the cluster load balancer. + OutboundIPs *ManagedClusterLoadBalancerProfileOutboundIPs `json:"outboundIPs,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster load balancer. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // AllocatedOutboundPorts - The desired number of allocated SNAT ports per VM. Allowed values are in the range of 0 to 64000 (inclusive). The default value is 0 which results in Azure dynamically allocating ports. + AllocatedOutboundPorts *int32 `json:"allocatedOutboundPorts,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` + // EnableMultipleStandardLoadBalancers - Enable multiple standard load balancers per AKS cluster or not. + EnableMultipleStandardLoadBalancers *bool `json:"enableMultipleStandardLoadBalancers,omitempty"` +} + +// ManagedClusterLoadBalancerProfileManagedOutboundIPs desired managed outbound IPs for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileManagedOutboundIPs struct { + // Count - The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` + // CountIPv6 - The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. + CountIPv6 *int32 `json:"countIPv6,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPPrefixes desired outbound IP Prefix resources for the cluster +// load balancer. +type ManagedClusterLoadBalancerProfileOutboundIPPrefixes struct { + // PublicIPPrefixes - A list of public IP prefix resources. + PublicIPPrefixes *[]ResourceReference `json:"publicIPPrefixes,omitempty"` +} + +// ManagedClusterLoadBalancerProfileOutboundIPs desired outbound IP resources for the cluster load +// balancer. +type ManagedClusterLoadBalancerProfileOutboundIPs struct { + // PublicIPs - A list of public IP resources. + PublicIPs *[]ResourceReference `json:"publicIPs,omitempty"` +} + +// ManagedClusterManagedOutboundIPProfile profile of the managed outbound IP resources of the managed +// cluster. +type ManagedClusterManagedOutboundIPProfile struct { + // Count - The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. + Count *int32 `json:"count,omitempty"` +} + +// ManagedClusterNATGatewayProfile profile of the managed cluster NAT gateway. +type ManagedClusterNATGatewayProfile struct { + // ManagedOutboundIPProfile - Profile of the managed outbound IP resources of the cluster NAT gateway. + ManagedOutboundIPProfile *ManagedClusterManagedOutboundIPProfile `json:"managedOutboundIPProfile,omitempty"` + // EffectiveOutboundIPs - The effective outbound IP resources of the cluster NAT gateway. + EffectiveOutboundIPs *[]ResourceReference `json:"effectiveOutboundIPs,omitempty"` + // IdleTimeoutInMinutes - Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 4 minutes. + IdleTimeoutInMinutes *int32 `json:"idleTimeoutInMinutes,omitempty"` +} + +// ManagedClusterOIDCIssuerProfile the OIDC issuer profile of the Managed Cluster. +type ManagedClusterOIDCIssuerProfile struct { + // IssuerURL - READ-ONLY; The OIDC issuer url of the Managed Cluster. + IssuerURL *string `json:"issuerURL,omitempty"` + // Enabled - Whether the OIDC issuer is enabled. + Enabled *bool `json:"enabled,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterOIDCIssuerProfile. +func (mcoip ManagedClusterOIDCIssuerProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcoip.Enabled != nil { + objectMap["enabled"] = mcoip.Enabled + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentity details about the pod identity assigned to the Managed Cluster. +type ManagedClusterPodIdentity struct { + // Name - The name of the pod identity. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity. + Namespace *string `json:"namespace,omitempty"` + // BindingSelector - The binding selector to use for the AzureIdentityBinding resource. + BindingSelector *string `json:"bindingSelector,omitempty"` + // Identity - The user assigned identity details. + Identity *UserAssignedIdentity `json:"identity,omitempty"` + // ProvisioningState - READ-ONLY; The current provisioning state of the pod identity. Possible values include: 'ManagedClusterPodIdentityProvisioningStateAssigned', 'ManagedClusterPodIdentityProvisioningStateUpdating', 'ManagedClusterPodIdentityProvisioningStateDeleting', 'ManagedClusterPodIdentityProvisioningStateFailed' + ProvisioningState ManagedClusterPodIdentityProvisioningState `json:"provisioningState,omitempty"` + // ProvisioningInfo - READ-ONLY + ProvisioningInfo *ManagedClusterPodIdentityProvisioningInfo `json:"provisioningInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentity. +func (mcpi ManagedClusterPodIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpi.Name != nil { + objectMap["name"] = mcpi.Name + } + if mcpi.Namespace != nil { + objectMap["namespace"] = mcpi.Namespace + } + if mcpi.BindingSelector != nil { + objectMap["bindingSelector"] = mcpi.BindingSelector + } + if mcpi.Identity != nil { + objectMap["identity"] = mcpi.Identity + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityException see [disable AAD Pod Identity for a specific +// Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for +// more details. +type ManagedClusterPodIdentityException struct { + // Name - The name of the pod identity exception. + Name *string `json:"name,omitempty"` + // Namespace - The namespace of the pod identity exception. + Namespace *string `json:"namespace,omitempty"` + // PodLabels - The pod labels to match. + PodLabels map[string]*string `json:"podLabels"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterPodIdentityException. +func (mcpie ManagedClusterPodIdentityException) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcpie.Name != nil { + objectMap["name"] = mcpie.Name + } + if mcpie.Namespace != nil { + objectMap["namespace"] = mcpie.Namespace + } + if mcpie.PodLabels != nil { + objectMap["podLabels"] = mcpie.PodLabels + } + return json.Marshal(objectMap) +} + +// ManagedClusterPodIdentityProfile see [use AAD pod +// identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod +// identity integration. +type ManagedClusterPodIdentityProfile struct { + // Enabled - Whether the pod identity addon is enabled. + Enabled *bool `json:"enabled,omitempty"` + // AllowNetworkPluginKubenet - Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. + AllowNetworkPluginKubenet *bool `json:"allowNetworkPluginKubenet,omitempty"` + // UserAssignedIdentities - The pod identities to use in the cluster. + UserAssignedIdentities *[]ManagedClusterPodIdentity `json:"userAssignedIdentities,omitempty"` + // UserAssignedIdentityExceptions - The pod identity exceptions to allow. + UserAssignedIdentityExceptions *[]ManagedClusterPodIdentityException `json:"userAssignedIdentityExceptions,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningError an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningError struct { + // Error - Details about the error. + Error *ManagedClusterPodIdentityProvisioningErrorBody `json:"error,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningErrorBody an error response from the pod identity provisioning. +type ManagedClusterPodIdentityProvisioningErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]ManagedClusterPodIdentityProvisioningErrorBody `json:"details,omitempty"` +} + +// ManagedClusterPodIdentityProvisioningInfo ... +type ManagedClusterPodIdentityProvisioningInfo struct { + // Error - Pod identity assignment error (if any). + Error *ManagedClusterPodIdentityProvisioningError `json:"error,omitempty"` +} + +// ManagedClusterPoolUpgradeProfile the list of available upgrade versions. +type ManagedClusterPoolUpgradeProfile struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Name - The Agent Pool name. + Name *string `json:"name,omitempty"` + // OsType - Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // Upgrades - List of orchestrator types and versions available for upgrade. + Upgrades *[]ManagedClusterPoolUpgradeProfileUpgradesItem `json:"upgrades,omitempty"` +} + +// ManagedClusterPoolUpgradeProfileUpgradesItem ... +type ManagedClusterPoolUpgradeProfileUpgradesItem struct { + // KubernetesVersion - The Kubernetes version (major.minor.patch). + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // IsPreview - Whether the Kubernetes version is currently in preview. + IsPreview *bool `json:"isPreview,omitempty"` +} + +// ManagedClusterProperties properties of the managed cluster. +type ManagedClusterProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` + // PowerState - READ-ONLY; The Power State of the cluster. + PowerState *PowerState `json:"powerState,omitempty"` + // CreationData - CreationData to be used to specify the source Snapshot ID if the cluster will be created/upgraded using a snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // MaxAgentPools - READ-ONLY; The max number of agent pools for the managed cluster. + MaxAgentPools *int32 `json:"maxAgentPools,omitempty"` + // KubernetesVersion - When you upgrade a supported AKS cluster, Kubernetes minor versions cannot be skipped. All upgrades must be performed sequentially by major version number. For example, upgrades between 1.14.x -> 1.15.x or 1.15.x -> 1.16.x are allowed, however 1.14.x -> 1.16.x is not allowed. See [upgrading an AKS cluster](https://docs.microsoft.com/azure/aks/upgrade-cluster) for more details. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // CurrentKubernetesVersion - READ-ONLY; The version of Kubernetes the Managed Cluster is running. + CurrentKubernetesVersion *string `json:"currentKubernetesVersion,omitempty"` + // DNSPrefix - This cannot be updated once the Managed Cluster has been created. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // FqdnSubdomain - This cannot be updated once the Managed Cluster has been created. + FqdnSubdomain *string `json:"fqdnSubdomain,omitempty"` + // Fqdn - READ-ONLY; The FQDN of the master pool. + Fqdn *string `json:"fqdn,omitempty"` + // PrivateFQDN - READ-ONLY; The FQDN of private cluster. + PrivateFQDN *string `json:"privateFQDN,omitempty"` + // AzurePortalFQDN - READ-ONLY; The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. + AzurePortalFQDN *string `json:"azurePortalFQDN,omitempty"` + // AgentPoolProfiles - The agent pool properties. + AgentPoolProfiles *[]ManagedClusterAgentPoolProfile `json:"agentPoolProfiles,omitempty"` + // LinuxProfile - The profile for Linux VMs in the Managed Cluster. + LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` + // WindowsProfile - The profile for Windows VMs in the Managed Cluster. + WindowsProfile *ManagedClusterWindowsProfile `json:"windowsProfile,omitempty"` + // ServicePrincipalProfile - Information about a service principal identity for the cluster to use for manipulating Azure APIs. + ServicePrincipalProfile *ManagedClusterServicePrincipalProfile `json:"servicePrincipalProfile,omitempty"` + // AddonProfiles - The profile of managed cluster add-on. + AddonProfiles map[string]*ManagedClusterAddonProfile `json:"addonProfiles"` + // PodIdentityProfile - See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. + PodIdentityProfile *ManagedClusterPodIdentityProfile `json:"podIdentityProfile,omitempty"` + // OidcIssuerProfile - The OIDC issuer profile of the Managed Cluster. + OidcIssuerProfile *ManagedClusterOIDCIssuerProfile `json:"oidcIssuerProfile,omitempty"` + // NodeResourceGroup - The name of the resource group containing agent pool nodes. + NodeResourceGroup *string `json:"nodeResourceGroup,omitempty"` + // EnableRBAC - Whether to enable Kubernetes Role-Based Access Control. + EnableRBAC *bool `json:"enableRBAC,omitempty"` + // EnablePodSecurityPolicy - (DEPRECATING) Whether to enable Kubernetes pod security policy (preview). This feature is set for removal on October 15th, 2020. Learn more at aka.ms/aks/azpodpolicy. + EnablePodSecurityPolicy *bool `json:"enablePodSecurityPolicy,omitempty"` + // EnableNamespaceResources - The default value is false. It can be enabled/disabled on creation and updation of the managed cluster. See [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) for more details on Namespace as a ARM Resource. + EnableNamespaceResources *bool `json:"enableNamespaceResources,omitempty"` + // NetworkProfile - The network configuration profile. + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // AadProfile - The Azure Active Directory configuration. + AadProfile *ManagedClusterAADProfile `json:"aadProfile,omitempty"` + // AutoUpgradeProfile - The auto upgrade configuration. + AutoUpgradeProfile *ManagedClusterAutoUpgradeProfile `json:"autoUpgradeProfile,omitempty"` + // AutoScalerProfile - Parameters to be applied to the cluster-autoscaler when enabled + AutoScalerProfile *ManagedClusterPropertiesAutoScalerProfile `json:"autoScalerProfile,omitempty"` + // APIServerAccessProfile - The access profile for managed cluster API server. + APIServerAccessProfile *ManagedClusterAPIServerAccessProfile `json:"apiServerAccessProfile,omitempty"` + // DiskEncryptionSetID - This is of the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{encryptionSetName}' + DiskEncryptionSetID *string `json:"diskEncryptionSetID,omitempty"` + // IdentityProfile - Identities associated with the cluster. + IdentityProfile map[string]*UserAssignedIdentity `json:"identityProfile"` + // PrivateLinkResources - Private link resources associated with the cluster. + PrivateLinkResources *[]PrivateLinkResource `json:"privateLinkResources,omitempty"` + // DisableLocalAccounts - If set to true, getting static credentials will be disabled for this cluster. This must only be used on Managed Clusters that are AAD enabled. For more details see [disable local accounts](https://docs.microsoft.com/azure/aks/managed-aad#disable-local-accounts-preview). + DisableLocalAccounts *bool `json:"disableLocalAccounts,omitempty"` + // HTTPProxyConfig - Configurations for provisioning the cluster with HTTP proxy servers. + HTTPProxyConfig *ManagedClusterHTTPProxyConfig `json:"httpProxyConfig,omitempty"` + // SecurityProfile - Security profile for the managed cluster. + SecurityProfile *ManagedClusterSecurityProfile `json:"securityProfile,omitempty"` + // IngressProfile - Ingress profile for the managed cluster. + IngressProfile *ManagedClusterIngressProfile `json:"ingressProfile,omitempty"` + // PublicNetworkAccess - Allow or deny public network access for AKS. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterProperties. +func (mcp ManagedClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcp.CreationData != nil { + objectMap["creationData"] = mcp.CreationData + } + if mcp.KubernetesVersion != nil { + objectMap["kubernetesVersion"] = mcp.KubernetesVersion + } + if mcp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mcp.DNSPrefix + } + if mcp.FqdnSubdomain != nil { + objectMap["fqdnSubdomain"] = mcp.FqdnSubdomain + } + if mcp.AgentPoolProfiles != nil { + objectMap["agentPoolProfiles"] = mcp.AgentPoolProfiles + } + if mcp.LinuxProfile != nil { + objectMap["linuxProfile"] = mcp.LinuxProfile + } + if mcp.WindowsProfile != nil { + objectMap["windowsProfile"] = mcp.WindowsProfile + } + if mcp.ServicePrincipalProfile != nil { + objectMap["servicePrincipalProfile"] = mcp.ServicePrincipalProfile + } + if mcp.AddonProfiles != nil { + objectMap["addonProfiles"] = mcp.AddonProfiles + } + if mcp.PodIdentityProfile != nil { + objectMap["podIdentityProfile"] = mcp.PodIdentityProfile + } + if mcp.OidcIssuerProfile != nil { + objectMap["oidcIssuerProfile"] = mcp.OidcIssuerProfile + } + if mcp.NodeResourceGroup != nil { + objectMap["nodeResourceGroup"] = mcp.NodeResourceGroup + } + if mcp.EnableRBAC != nil { + objectMap["enableRBAC"] = mcp.EnableRBAC + } + if mcp.EnablePodSecurityPolicy != nil { + objectMap["enablePodSecurityPolicy"] = mcp.EnablePodSecurityPolicy + } + if mcp.EnableNamespaceResources != nil { + objectMap["enableNamespaceResources"] = mcp.EnableNamespaceResources + } + if mcp.NetworkProfile != nil { + objectMap["networkProfile"] = mcp.NetworkProfile + } + if mcp.AadProfile != nil { + objectMap["aadProfile"] = mcp.AadProfile + } + if mcp.AutoUpgradeProfile != nil { + objectMap["autoUpgradeProfile"] = mcp.AutoUpgradeProfile + } + if mcp.AutoScalerProfile != nil { + objectMap["autoScalerProfile"] = mcp.AutoScalerProfile + } + if mcp.APIServerAccessProfile != nil { + objectMap["apiServerAccessProfile"] = mcp.APIServerAccessProfile + } + if mcp.DiskEncryptionSetID != nil { + objectMap["diskEncryptionSetID"] = mcp.DiskEncryptionSetID + } + if mcp.IdentityProfile != nil { + objectMap["identityProfile"] = mcp.IdentityProfile + } + if mcp.PrivateLinkResources != nil { + objectMap["privateLinkResources"] = mcp.PrivateLinkResources + } + if mcp.DisableLocalAccounts != nil { + objectMap["disableLocalAccounts"] = mcp.DisableLocalAccounts + } + if mcp.HTTPProxyConfig != nil { + objectMap["httpProxyConfig"] = mcp.HTTPProxyConfig + } + if mcp.SecurityProfile != nil { + objectMap["securityProfile"] = mcp.SecurityProfile + } + if mcp.IngressProfile != nil { + objectMap["ingressProfile"] = mcp.IngressProfile + } + if mcp.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = mcp.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// ManagedClusterPropertiesAutoScalerProfile parameters to be applied to the cluster-autoscaler when +// enabled +type ManagedClusterPropertiesAutoScalerProfile struct { + // BalanceSimilarNodeGroups - Valid values are 'true' and 'false' + BalanceSimilarNodeGroups *string `json:"balance-similar-node-groups,omitempty"` + // Expander - If not specified, the default is 'random'. See [expanders](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/FAQ.md#what-are-expanders) for more information. Possible values include: 'ExpanderLeastWaste', 'ExpanderMostPods', 'ExpanderPriority', 'ExpanderRandom' + Expander Expander `json:"expander,omitempty"` + // MaxEmptyBulkDelete - The default is 10. + MaxEmptyBulkDelete *string `json:"max-empty-bulk-delete,omitempty"` + // MaxGracefulTerminationSec - The default is 600. + MaxGracefulTerminationSec *string `json:"max-graceful-termination-sec,omitempty"` + // MaxNodeProvisionTime - The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + MaxNodeProvisionTime *string `json:"max-node-provision-time,omitempty"` + // MaxTotalUnreadyPercentage - The default is 45. The maximum is 100 and the minimum is 0. + MaxTotalUnreadyPercentage *string `json:"max-total-unready-percentage,omitempty"` + // NewPodScaleUpDelay - For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). + NewPodScaleUpDelay *string `json:"new-pod-scale-up-delay,omitempty"` + // OkTotalUnreadyCount - This must be an integer. The default is 3. + OkTotalUnreadyCount *string `json:"ok-total-unready-count,omitempty"` + // ScanInterval - The default is '10'. Values must be an integer number of seconds. + ScanInterval *string `json:"scan-interval,omitempty"` + // ScaleDownDelayAfterAdd - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterAdd *string `json:"scale-down-delay-after-add,omitempty"` + // ScaleDownDelayAfterDelete - The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterDelete *string `json:"scale-down-delay-after-delete,omitempty"` + // ScaleDownDelayAfterFailure - The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownDelayAfterFailure *string `json:"scale-down-delay-after-failure,omitempty"` + // ScaleDownUnneededTime - The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnneededTime *string `json:"scale-down-unneeded-time,omitempty"` + // ScaleDownUnreadyTime - The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. + ScaleDownUnreadyTime *string `json:"scale-down-unready-time,omitempty"` + // ScaleDownUtilizationThreshold - The default is '0.5'. + ScaleDownUtilizationThreshold *string `json:"scale-down-utilization-threshold,omitempty"` + // SkipNodesWithLocalStorage - The default is true. + SkipNodesWithLocalStorage *string `json:"skip-nodes-with-local-storage,omitempty"` + // SkipNodesWithSystemPods - The default is true. + SkipNodesWithSystemPods *string `json:"skip-nodes-with-system-pods,omitempty"` +} + +// ManagedClusterPropertiesForSnapshot managed cluster properties for snapshot, these properties are read +// only. +type ManagedClusterPropertiesForSnapshot struct { + // KubernetesVersion - The current kubernetes version. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // Sku - The current managed cluster sku. + Sku *ManagedClusterSKU `json:"sku,omitempty"` + // EnableRbac - Whether the cluster has enabled Kubernetes Role-Based Access Control or not. + EnableRbac *bool `json:"enableRbac,omitempty"` + // NetworkProfile - The current network profile. + NetworkProfile *NetworkProfileForSnapshot `json:"networkProfile,omitempty"` +} + +// ManagedClustersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersCreateOrUpdateFuture.Result. +func (future *ManagedClustersCreateOrUpdateFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.CreateOrUpdateResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersCreateOrUpdateFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersDeleteFuture.Result. +func (future *ManagedClustersDeleteFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterSecurityProfile security profile for the container service cluster. +type ManagedClusterSecurityProfile struct { + // AzureDefender - Azure Defender settings for the security profile. + AzureDefender *ManagedClusterSecurityProfileAzureDefender `json:"azureDefender,omitempty"` + // AzureKeyVaultKms - Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. + AzureKeyVaultKms *AzureKeyVaultKms `json:"azureKeyVaultKms,omitempty"` + // WorkloadIdentity - [Workload Identity](https://azure.github.io/azure-workload-identity/docs/) settings for the security profile. + WorkloadIdentity *ManagedClusterSecurityProfileWorkloadIdentity `json:"workloadIdentity,omitempty"` +} + +// ManagedClusterSecurityProfileAzureDefender azure Defender settings for the security profile. +type ManagedClusterSecurityProfileAzureDefender struct { + // Enabled - Whether to enable Azure Defender + Enabled *bool `json:"enabled,omitempty"` + // LogAnalyticsWorkspaceResourceID - Resource ID of the Log Analytics workspace to be associated with Azure Defender. When Azure Defender is enabled, this field is required and must be a valid workspace resource ID. When Azure Defender is disabled, leave the field empty. + LogAnalyticsWorkspaceResourceID *string `json:"logAnalyticsWorkspaceResourceId,omitempty"` +} + +// ManagedClusterSecurityProfileWorkloadIdentity workload Identity settings for the security profile. +type ManagedClusterSecurityProfileWorkloadIdentity struct { + // Enabled - Whether to enable Workload Identity + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterServicePrincipalProfile information about a service principal identity for the cluster to +// use for manipulating Azure APIs. +type ManagedClusterServicePrincipalProfile struct { + // ClientID - The ID for the service principal. + ClientID *string `json:"clientId,omitempty"` + // Secret - The secret password associated with the service principal in plain text. + Secret *string `json:"secret,omitempty"` +} + +// ManagedClusterSKU the SKU of a Managed Cluster. +type ManagedClusterSKU struct { + // Name - The name of a managed cluster SKU. Possible values include: 'ManagedClusterSKUNameBasic' + Name ManagedClusterSKUName `json:"name,omitempty"` + // Tier - If not specified, the default is 'Free'. See [uptime SLA](https://docs.microsoft.com/azure/aks/uptime-sla) for more details. Possible values include: 'ManagedClusterSKUTierPaid', 'ManagedClusterSKUTierFree' + Tier ManagedClusterSKUTier `json:"tier,omitempty"` +} + +// ManagedClusterSnapshot a managed cluster snapshot resource. +type ManagedClusterSnapshot struct { + autorest.Response `json:"-"` + // ManagedClusterSnapshotProperties - Properties of a managed cluster snapshot. + *ManagedClusterSnapshotProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterSnapshot. +func (mcs ManagedClusterSnapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcs.ManagedClusterSnapshotProperties != nil { + objectMap["properties"] = mcs.ManagedClusterSnapshotProperties + } + if mcs.Tags != nil { + objectMap["tags"] = mcs.Tags + } + if mcs.Location != nil { + objectMap["location"] = mcs.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterSnapshot struct. +func (mcs *ManagedClusterSnapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var managedClusterSnapshotProperties ManagedClusterSnapshotProperties + err = json.Unmarshal(*v, &managedClusterSnapshotProperties) + if err != nil { + return err + } + mcs.ManagedClusterSnapshotProperties = &managedClusterSnapshotProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + mcs.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + mcs.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcs.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mcs.SystemData = &systemData + } + } + } + + return nil +} + +// ManagedClusterSnapshotListResult the response from the List Managed Cluster Snapshots operation. +type ManagedClusterSnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of managed cluster snapshots. + Value *[]ManagedClusterSnapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of managed cluster snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterSnapshotListResult. +func (mcslr ManagedClusterSnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcslr.Value != nil { + objectMap["value"] = mcslr.Value + } + return json.Marshal(objectMap) +} + +// ManagedClusterSnapshotListResultIterator provides access to a complete listing of ManagedClusterSnapshot +// values. +type ManagedClusterSnapshotListResultIterator struct { + i int + page ManagedClusterSnapshotListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ManagedClusterSnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ManagedClusterSnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ManagedClusterSnapshotListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ManagedClusterSnapshotListResultIterator) Response() ManagedClusterSnapshotListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ManagedClusterSnapshotListResultIterator) Value() ManagedClusterSnapshot { + if !iter.page.NotDone() { + return ManagedClusterSnapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ManagedClusterSnapshotListResultIterator type. +func NewManagedClusterSnapshotListResultIterator(page ManagedClusterSnapshotListResultPage) ManagedClusterSnapshotListResultIterator { + return ManagedClusterSnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mcslr ManagedClusterSnapshotListResult) IsEmpty() bool { + return mcslr.Value == nil || len(*mcslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mcslr ManagedClusterSnapshotListResult) hasNextLink() bool { + return mcslr.NextLink != nil && len(*mcslr.NextLink) != 0 +} + +// managedClusterSnapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mcslr ManagedClusterSnapshotListResult) managedClusterSnapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !mcslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mcslr.NextLink))) +} + +// ManagedClusterSnapshotListResultPage contains a page of ManagedClusterSnapshot values. +type ManagedClusterSnapshotListResultPage struct { + fn func(context.Context, ManagedClusterSnapshotListResult) (ManagedClusterSnapshotListResult, error) + mcslr ManagedClusterSnapshotListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ManagedClusterSnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ManagedClusterSnapshotListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mcslr) + if err != nil { + return err + } + page.mcslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ManagedClusterSnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ManagedClusterSnapshotListResultPage) NotDone() bool { + return !page.mcslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ManagedClusterSnapshotListResultPage) Response() ManagedClusterSnapshotListResult { + return page.mcslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ManagedClusterSnapshotListResultPage) Values() []ManagedClusterSnapshot { + if page.mcslr.IsEmpty() { + return nil + } + return *page.mcslr.Value +} + +// Creates a new instance of the ManagedClusterSnapshotListResultPage type. +func NewManagedClusterSnapshotListResultPage(cur ManagedClusterSnapshotListResult, getNextPage func(context.Context, ManagedClusterSnapshotListResult) (ManagedClusterSnapshotListResult, error)) ManagedClusterSnapshotListResultPage { + return ManagedClusterSnapshotListResultPage{ + fn: getNextPage, + mcslr: cur, + } +} + +// ManagedClusterSnapshotProperties properties for a managed cluster snapshot. +type ManagedClusterSnapshotProperties struct { + // CreationData - CreationData to be used to specify the source resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool', 'SnapshotTypeManagedCluster' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // ManagedClusterPropertiesReadOnly - What the properties will be showed when getting managed cluster snapshot. Those properties are read-only. + ManagedClusterPropertiesReadOnly *ManagedClusterPropertiesForSnapshot `json:"managedClusterPropertiesReadOnly,omitempty"` +} + +// ManagedClustersResetAADProfileFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersResetAADProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetAADProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetAADProfileFuture.Result. +func (future *ManagedClustersResetAADProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetAADProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetAADProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersResetServicePrincipalProfileFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersResetServicePrincipalProfileFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersResetServicePrincipalProfileFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersResetServicePrincipalProfileFuture.Result. +func (future *ManagedClustersResetServicePrincipalProfileFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersResetServicePrincipalProfileFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersResetServicePrincipalProfileFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateClusterCertificatesFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type ManagedClustersRotateClusterCertificatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateClusterCertificatesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRotateClusterCertificatesFuture.Result. +func (future *ManagedClustersRotateClusterCertificatesFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateClusterCertificatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateClusterCertificatesFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRotateServiceAccountSigningKeysFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type ManagedClustersRotateServiceAccountSigningKeysFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRotateServiceAccountSigningKeysFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRotateServiceAccountSigningKeysFuture.Result. +func (future *ManagedClustersRotateServiceAccountSigningKeysFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRotateServiceAccountSigningKeysFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRotateServiceAccountSigningKeysFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersRunCommandFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersRunCommandFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (RunCommandResult, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersRunCommandFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersRunCommandFuture.Result. +func (future *ManagedClustersRunCommandFuture) result(client ManagedClustersClient) (rcr RunCommandResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + rcr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersRunCommandFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rcr.Response.Response, err = future.GetResult(sender); err == nil && rcr.Response.Response.StatusCode != http.StatusNoContent { + rcr, err = client.RunCommandResponder(rcr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersRunCommandFuture", "Result", rcr.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClustersStartFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStartFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStartFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStartFuture.Result. +func (future *ManagedClustersStartFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStartFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStartFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClustersStopFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ManagedClustersStopFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersStopFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersStopFuture.Result. +func (future *ManagedClustersStopFuture) result(client ManagedClustersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersStopFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersStopFuture") + return + } + ar.Response = future.Response() + return +} + +// ManagedClusterStorageProfile storage profile for the container service cluster. +type ManagedClusterStorageProfile struct { + // DiskCSIDriver - AzureDisk CSI Driver settings for the storage profile. + DiskCSIDriver *ManagedClusterStorageProfileDiskCSIDriver `json:"diskCSIDriver,omitempty"` + // FileCSIDriver - AzureFile CSI Driver settings for the storage profile. + FileCSIDriver *ManagedClusterStorageProfileFileCSIDriver `json:"fileCSIDriver,omitempty"` + // SnapshotController - Snapshot Controller settings for the storage profile. + SnapshotController *ManagedClusterStorageProfileSnapshotController `json:"snapshotController,omitempty"` +} + +// ManagedClusterStorageProfileDiskCSIDriver azureDisk CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileDiskCSIDriver struct { + // Enabled - Whether to enable AzureDisk CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` + // Version - The version of AzureDisk CSI Driver. The default value is v1. + Version *string `json:"version,omitempty"` +} + +// ManagedClusterStorageProfileFileCSIDriver azureFile CSI Driver settings for the storage profile. +type ManagedClusterStorageProfileFileCSIDriver struct { + // Enabled - Whether to enable AzureFile CSI Driver. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClusterStorageProfileSnapshotController snapshot Controller settings for the storage profile. +type ManagedClusterStorageProfileSnapshotController struct { + // Enabled - Whether to enable Snapshot Controller. The default value is true. + Enabled *bool `json:"enabled,omitempty"` +} + +// ManagedClustersUpdateTagsFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ManagedClustersUpdateTagsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ManagedClustersClient) (ManagedCluster, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ManagedClustersUpdateTagsFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ManagedClustersUpdateTagsFuture.Result. +func (future *ManagedClustersUpdateTagsFuture) result(client ManagedClustersClient) (mc ManagedCluster, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.ManagedClustersUpdateTagsFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mc.Response.Response, err = future.GetResult(sender); err == nil && mc.Response.Response.StatusCode != http.StatusNoContent { + mc, err = client.UpdateTagsResponder(mc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ManagedClustersUpdateTagsFuture", "Result", mc.Response.Response, "Failure responding to request") + } + } + return +} + +// ManagedClusterUpgradeProfile the list of available upgrades for compute pools. +type ManagedClusterUpgradeProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the upgrade profile. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the upgrade profile. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the upgrade profile. + Type *string `json:"type,omitempty"` + // ManagedClusterUpgradeProfileProperties - The properties of the upgrade profile. + *ManagedClusterUpgradeProfileProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ManagedClusterUpgradeProfile. +func (mcup ManagedClusterUpgradeProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mcup.ManagedClusterUpgradeProfileProperties != nil { + objectMap["properties"] = mcup.ManagedClusterUpgradeProfileProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ManagedClusterUpgradeProfile struct. +func (mcup *ManagedClusterUpgradeProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mcup.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mcup.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mcup.Type = &typeVar + } + case "properties": + if v != nil { + var managedClusterUpgradeProfileProperties ManagedClusterUpgradeProfileProperties + err = json.Unmarshal(*v, &managedClusterUpgradeProfileProperties) + if err != nil { + return err + } + mcup.ManagedClusterUpgradeProfileProperties = &managedClusterUpgradeProfileProperties + } + } + } + + return nil +} + +// ManagedClusterUpgradeProfileProperties control plane and agent pool upgrade profiles. +type ManagedClusterUpgradeProfileProperties struct { + // ControlPlaneProfile - The list of available upgrade versions for the control plane. + ControlPlaneProfile *ManagedClusterPoolUpgradeProfile `json:"controlPlaneProfile,omitempty"` + // AgentPoolProfiles - The list of available upgrade versions for agent pools. + AgentPoolProfiles *[]ManagedClusterPoolUpgradeProfile `json:"agentPoolProfiles,omitempty"` +} + +// ManagedClusterWindowsProfile profile for Windows VMs in the managed cluster. +type ManagedClusterWindowsProfile struct { + // AdminUsername - Specifies the name of the administrator account.

**Restriction:** Cannot end in "."

**Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5".

**Minimum-length:** 1 character

**Max-length:** 20 characters + AdminUsername *string `json:"adminUsername,omitempty"` + // AdminPassword - Specifies the password of the administrator account.

**Minimum-length:** 8 characters

**Max-length:** 123 characters

**Complexity requirements:** 3 out of 4 conditions below need to be fulfilled
Has lower characters
Has upper characters
Has a digit
Has a special character (Regex match [\W_])

**Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" + AdminPassword *string `json:"adminPassword,omitempty"` + // LicenseType - The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. Possible values include: 'LicenseTypeNone', 'LicenseTypeWindowsServer' + LicenseType LicenseType `json:"licenseType,omitempty"` + // EnableCSIProxy - For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). + EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` + // GmsaProfile - The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` +} + +// MasterProfile profile for the container service master. +type MasterProfile struct { + // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. + Count *int32 `json:"count,omitempty"` + // DNSPrefix - DNS prefix to be used to create the FQDN for the master pool. + DNSPrefix *string `json:"dnsPrefix,omitempty"` + // VMSize - Size of agent VMs. Possible values include: 'VMSizeTypesStandardA1', 'VMSizeTypesStandardA10', 'VMSizeTypesStandardA11', 'VMSizeTypesStandardA1V2', 'VMSizeTypesStandardA2', 'VMSizeTypesStandardA2V2', 'VMSizeTypesStandardA2mV2', 'VMSizeTypesStandardA3', 'VMSizeTypesStandardA4', 'VMSizeTypesStandardA4V2', 'VMSizeTypesStandardA4mV2', 'VMSizeTypesStandardA5', 'VMSizeTypesStandardA6', 'VMSizeTypesStandardA7', 'VMSizeTypesStandardA8', 'VMSizeTypesStandardA8V2', 'VMSizeTypesStandardA8mV2', 'VMSizeTypesStandardA9', 'VMSizeTypesStandardB2ms', 'VMSizeTypesStandardB2s', 'VMSizeTypesStandardB4ms', 'VMSizeTypesStandardB8ms', 'VMSizeTypesStandardD1', 'VMSizeTypesStandardD11', 'VMSizeTypesStandardD11V2', 'VMSizeTypesStandardD11V2Promo', 'VMSizeTypesStandardD12', 'VMSizeTypesStandardD12V2', 'VMSizeTypesStandardD12V2Promo', 'VMSizeTypesStandardD13', 'VMSizeTypesStandardD13V2', 'VMSizeTypesStandardD13V2Promo', 'VMSizeTypesStandardD14', 'VMSizeTypesStandardD14V2', 'VMSizeTypesStandardD14V2Promo', 'VMSizeTypesStandardD15V2', 'VMSizeTypesStandardD16V3', 'VMSizeTypesStandardD16sV3', 'VMSizeTypesStandardD1V2', 'VMSizeTypesStandardD2', 'VMSizeTypesStandardD2V2', 'VMSizeTypesStandardD2V2Promo', 'VMSizeTypesStandardD2V3', 'VMSizeTypesStandardD2sV3', 'VMSizeTypesStandardD3', 'VMSizeTypesStandardD32V3', 'VMSizeTypesStandardD32sV3', 'VMSizeTypesStandardD3V2', 'VMSizeTypesStandardD3V2Promo', 'VMSizeTypesStandardD4', 'VMSizeTypesStandardD4V2', 'VMSizeTypesStandardD4V2Promo', 'VMSizeTypesStandardD4V3', 'VMSizeTypesStandardD4sV3', 'VMSizeTypesStandardD5V2', 'VMSizeTypesStandardD5V2Promo', 'VMSizeTypesStandardD64V3', 'VMSizeTypesStandardD64sV3', 'VMSizeTypesStandardD8V3', 'VMSizeTypesStandardD8sV3', 'VMSizeTypesStandardDS1', 'VMSizeTypesStandardDS11', 'VMSizeTypesStandardDS11V2', 'VMSizeTypesStandardDS11V2Promo', 'VMSizeTypesStandardDS12', 'VMSizeTypesStandardDS12V2', 'VMSizeTypesStandardDS12V2Promo', 'VMSizeTypesStandardDS13', 'VMSizeTypesStandardDS132V2', 'VMSizeTypesStandardDS134V2', 'VMSizeTypesStandardDS13V2', 'VMSizeTypesStandardDS13V2Promo', 'VMSizeTypesStandardDS14', 'VMSizeTypesStandardDS144V2', 'VMSizeTypesStandardDS148V2', 'VMSizeTypesStandardDS14V2', 'VMSizeTypesStandardDS14V2Promo', 'VMSizeTypesStandardDS15V2', 'VMSizeTypesStandardDS1V2', 'VMSizeTypesStandardDS2', 'VMSizeTypesStandardDS2V2', 'VMSizeTypesStandardDS2V2Promo', 'VMSizeTypesStandardDS3', 'VMSizeTypesStandardDS3V2', 'VMSizeTypesStandardDS3V2Promo', 'VMSizeTypesStandardDS4', 'VMSizeTypesStandardDS4V2', 'VMSizeTypesStandardDS4V2Promo', 'VMSizeTypesStandardDS5V2', 'VMSizeTypesStandardDS5V2Promo', 'VMSizeTypesStandardE16V3', 'VMSizeTypesStandardE16sV3', 'VMSizeTypesStandardE2V3', 'VMSizeTypesStandardE2sV3', 'VMSizeTypesStandardE3216sV3', 'VMSizeTypesStandardE328sV3', 'VMSizeTypesStandardE32V3', 'VMSizeTypesStandardE32sV3', 'VMSizeTypesStandardE4V3', 'VMSizeTypesStandardE4sV3', 'VMSizeTypesStandardE6416sV3', 'VMSizeTypesStandardE6432sV3', 'VMSizeTypesStandardE64V3', 'VMSizeTypesStandardE64sV3', 'VMSizeTypesStandardE8V3', 'VMSizeTypesStandardE8sV3', 'VMSizeTypesStandardF1', 'VMSizeTypesStandardF16', 'VMSizeTypesStandardF16s', 'VMSizeTypesStandardF16sV2', 'VMSizeTypesStandardF1s', 'VMSizeTypesStandardF2', 'VMSizeTypesStandardF2s', 'VMSizeTypesStandardF2sV2', 'VMSizeTypesStandardF32sV2', 'VMSizeTypesStandardF4', 'VMSizeTypesStandardF4s', 'VMSizeTypesStandardF4sV2', 'VMSizeTypesStandardF64sV2', 'VMSizeTypesStandardF72sV2', 'VMSizeTypesStandardF8', 'VMSizeTypesStandardF8s', 'VMSizeTypesStandardF8sV2', 'VMSizeTypesStandardG1', 'VMSizeTypesStandardG2', 'VMSizeTypesStandardG3', 'VMSizeTypesStandardG4', 'VMSizeTypesStandardG5', 'VMSizeTypesStandardGS1', 'VMSizeTypesStandardGS2', 'VMSizeTypesStandardGS3', 'VMSizeTypesStandardGS4', 'VMSizeTypesStandardGS44', 'VMSizeTypesStandardGS48', 'VMSizeTypesStandardGS5', 'VMSizeTypesStandardGS516', 'VMSizeTypesStandardGS58', 'VMSizeTypesStandardH16', 'VMSizeTypesStandardH16m', 'VMSizeTypesStandardH16mr', 'VMSizeTypesStandardH16r', 'VMSizeTypesStandardH8', 'VMSizeTypesStandardH8m', 'VMSizeTypesStandardL16s', 'VMSizeTypesStandardL32s', 'VMSizeTypesStandardL4s', 'VMSizeTypesStandardL8s', 'VMSizeTypesStandardM12832ms', 'VMSizeTypesStandardM12864ms', 'VMSizeTypesStandardM128ms', 'VMSizeTypesStandardM128s', 'VMSizeTypesStandardM6416ms', 'VMSizeTypesStandardM6432ms', 'VMSizeTypesStandardM64ms', 'VMSizeTypesStandardM64s', 'VMSizeTypesStandardNC12', 'VMSizeTypesStandardNC12sV2', 'VMSizeTypesStandardNC12sV3', 'VMSizeTypesStandardNC24', 'VMSizeTypesStandardNC24r', 'VMSizeTypesStandardNC24rsV2', 'VMSizeTypesStandardNC24rsV3', 'VMSizeTypesStandardNC24sV2', 'VMSizeTypesStandardNC24sV3', 'VMSizeTypesStandardNC6', 'VMSizeTypesStandardNC6sV2', 'VMSizeTypesStandardNC6sV3', 'VMSizeTypesStandardND12s', 'VMSizeTypesStandardND24rs', 'VMSizeTypesStandardND24s', 'VMSizeTypesStandardND6s', 'VMSizeTypesStandardNV12', 'VMSizeTypesStandardNV24', 'VMSizeTypesStandardNV6' + VMSize VMSizeTypes `json:"vmSize,omitempty"` + // OsDiskSizeGB - OS Disk Size in GB to be used to specify the disk size for every machine in this master/agent pool. If you specify 0, it will apply the default osDisk size according to the vmSize specified. + OsDiskSizeGB *int32 `json:"osDiskSizeGB,omitempty"` + // VnetSubnetID - VNet SubnetID specifies the VNet's subnet identifier. + VnetSubnetID *string `json:"vnetSubnetID,omitempty"` + // FirstConsecutiveStaticIP - FirstConsecutiveStaticIP used to specify the first static ip of masters. + FirstConsecutiveStaticIP *string `json:"firstConsecutiveStaticIP,omitempty"` + // StorageProfile - Storage profile specifies what kind of storage used. Choose from StorageAccount and ManagedDisks. Leave it empty, we will choose for you based on the orchestrator choice. Possible values include: 'StorageProfileTypesStorageAccount', 'StorageProfileTypesManagedDisks' + StorageProfile StorageProfileTypes `json:"storageProfile,omitempty"` + // Fqdn - READ-ONLY; FQDN for the master pool. + Fqdn *string `json:"fqdn,omitempty"` +} + +// MarshalJSON is the custom marshaler for MasterProfile. +func (mp MasterProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mp.Count != nil { + objectMap["count"] = mp.Count + } + if mp.DNSPrefix != nil { + objectMap["dnsPrefix"] = mp.DNSPrefix + } + if mp.VMSize != "" { + objectMap["vmSize"] = mp.VMSize + } + if mp.OsDiskSizeGB != nil { + objectMap["osDiskSizeGB"] = mp.OsDiskSizeGB + } + if mp.VnetSubnetID != nil { + objectMap["vnetSubnetID"] = mp.VnetSubnetID + } + if mp.FirstConsecutiveStaticIP != nil { + objectMap["firstConsecutiveStaticIP"] = mp.FirstConsecutiveStaticIP + } + if mp.StorageProfile != "" { + objectMap["storageProfile"] = mp.StorageProfile + } + return json.Marshal(objectMap) +} + +// NetworkProfile profile of network configuration. +type NetworkProfile struct { + // NetworkPlugin - Network plugin used for building the Kubernetes network. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet', 'NetworkPluginNone' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - Network policy used for building the Kubernetes network. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - This cannot be specified if networkPlugin is anything other than 'azure'. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // PodCidr - A CIDR notation IP range from which to assign pod IPs when kubenet is used. + PodCidr *string `json:"podCidr,omitempty"` + // ServiceCidr - A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. + ServiceCidr *string `json:"serviceCidr,omitempty"` + // DNSServiceIP - An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. + DNSServiceIP *string `json:"dnsServiceIP,omitempty"` + // DockerBridgeCidr - A CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the Kubernetes service address range. + DockerBridgeCidr *string `json:"dockerBridgeCidr,omitempty"` + // OutboundType - This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). Possible values include: 'OutboundTypeLoadBalancer', 'OutboundTypeUserDefinedRouting', 'OutboundTypeManagedNATGateway', 'OutboundTypeUserAssignedNATGateway' + OutboundType OutboundType `json:"outboundType,omitempty"` + // LoadBalancerSku - The default is 'standard'. See [Azure Load Balancer SKUs](https://docs.microsoft.com/azure/load-balancer/skus) for more information about the differences between load balancer SKUs. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` + // LoadBalancerProfile - Profile of the cluster load balancer. + LoadBalancerProfile *ManagedClusterLoadBalancerProfile `json:"loadBalancerProfile,omitempty"` + // NatGatewayProfile - Profile of the cluster NAT gateway. + NatGatewayProfile *ManagedClusterNATGatewayProfile `json:"natGatewayProfile,omitempty"` + // PodCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. + PodCidrs *[]string `json:"podCidrs,omitempty"` + // ServiceCidrs - One IPv4 CIDR is expected for single-stack networking. Two CIDRs, one for each IP family (IPv4/IPv6), is expected for dual-stack networking. They must not overlap with any Subnet IP ranges. + ServiceCidrs *[]string `json:"serviceCidrs,omitempty"` + // IPFamilies - IP families are used to determine single-stack or dual-stack clusters. For single-stack, the expected value is IPv4. For dual-stack, the expected values are IPv4 and IPv6. + IPFamilies *[]IPFamily `json:"ipFamilies,omitempty"` +} + +// NetworkProfileForSnapshot network profile for managed cluster snapshot, these properties are read only. +type NetworkProfileForSnapshot struct { + // NetworkPlugin - networkPlugin for managed cluster snapshot. Possible values include: 'NetworkPluginAzure', 'NetworkPluginKubenet', 'NetworkPluginNone' + NetworkPlugin NetworkPlugin `json:"networkPlugin,omitempty"` + // NetworkPolicy - networkPolicy for managed cluster snapshot. Possible values include: 'NetworkPolicyCalico', 'NetworkPolicyAzure' + NetworkPolicy NetworkPolicy `json:"networkPolicy,omitempty"` + // NetworkMode - networkMode for managed cluster snapshot. Possible values include: 'NetworkModeTransparent', 'NetworkModeBridge' + NetworkMode NetworkMode `json:"networkMode,omitempty"` + // LoadBalancerSku - loadBalancerSku for managed cluster snapshot. Possible values include: 'LoadBalancerSkuStandard', 'LoadBalancerSkuBasic' + LoadBalancerSku LoadBalancerSku `json:"loadBalancerSku,omitempty"` +} + +// OperationListResult the List Operation response. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of operations + Value *[]OperationValue `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationValue describes the properties of a Operation value. +type OperationValue struct { + // Origin - READ-ONLY; The origin of the operation. + Origin *string `json:"origin,omitempty"` + // Name - READ-ONLY; The name of the operation. + Name *string `json:"name,omitempty"` + // OperationValueDisplay - Describes the properties of a Operation Value Display. + *OperationValueDisplay `json:"display,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValue. +func (ov OperationValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ov.OperationValueDisplay != nil { + objectMap["display"] = ov.OperationValueDisplay + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OperationValue struct. +func (ov *OperationValue) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + ov.Origin = &origin + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ov.Name = &name + } + case "display": + if v != nil { + var operationValueDisplay OperationValueDisplay + err = json.Unmarshal(*v, &operationValueDisplay) + if err != nil { + return err + } + ov.OperationValueDisplay = &operationValueDisplay + } + } + } + + return nil +} + +// OperationValueDisplay describes the properties of a Operation Value Display. +type OperationValueDisplay struct { + // Operation - READ-ONLY; The display name of the operation. + Operation *string `json:"operation,omitempty"` + // Resource - READ-ONLY; The display name of the resource the operation applies to. + Resource *string `json:"resource,omitempty"` + // Description - READ-ONLY; The description of the operation. + Description *string `json:"description,omitempty"` + // Provider - READ-ONLY; The resource provider for the operation. + Provider *string `json:"provider,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationValueDisplay. +func (ovd OperationValueDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OSOptionProfile the OS option profile. +type OSOptionProfile struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the OS option resource. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the OS option resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the OS option resource. + Type *string `json:"type,omitempty"` + // OSOptionPropertyList - The list of OS options. + *OSOptionPropertyList `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for OSOptionProfile. +func (oop OSOptionProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oop.OSOptionPropertyList != nil { + objectMap["properties"] = oop.OSOptionPropertyList + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OSOptionProfile struct. +func (oop *OSOptionProfile) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + oop.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + oop.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + oop.Type = &typeVar + } + case "properties": + if v != nil { + var oSOptionPropertyList OSOptionPropertyList + err = json.Unmarshal(*v, &oSOptionPropertyList) + if err != nil { + return err + } + oop.OSOptionPropertyList = &oSOptionPropertyList + } + } + } + + return nil +} + +// OSOptionProperty OS option property. +type OSOptionProperty struct { + // OsType - The OS type. + OsType *string `json:"os-type,omitempty"` + // EnableFipsImage - Whether the image is FIPS-enabled. + EnableFipsImage *bool `json:"enable-fips-image,omitempty"` +} + +// OSOptionPropertyList the list of OS option properties. +type OSOptionPropertyList struct { + // OsOptionPropertyList - The list of OS options. + OsOptionPropertyList *[]OSOptionProperty `json:"osOptionPropertyList,omitempty"` +} + +// OutboundEnvironmentEndpoint egress endpoints which AKS agent nodes connect to for common purpose. +type OutboundEnvironmentEndpoint struct { + // Category - The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. + Category *string `json:"category,omitempty"` + // Endpoints - The endpoints that AKS agent nodes connect to + Endpoints *[]EndpointDependency `json:"endpoints,omitempty"` +} + +// OutboundEnvironmentEndpointCollection collection of OutboundEnvironmentEndpoint +type OutboundEnvironmentEndpointCollection struct { + autorest.Response `json:"-"` + // Value - Collection of resources. + Value *[]OutboundEnvironmentEndpoint `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to next page of resources. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OutboundEnvironmentEndpointCollection. +func (oeec OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if oeec.Value != nil { + objectMap["value"] = oeec.Value + } + return json.Marshal(objectMap) +} + +// OutboundEnvironmentEndpointCollectionIterator provides access to a complete listing of +// OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionIterator struct { + i int + page OutboundEnvironmentEndpointCollectionPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OutboundEnvironmentEndpointCollectionIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OutboundEnvironmentEndpointCollectionIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OutboundEnvironmentEndpointCollectionIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OutboundEnvironmentEndpointCollectionIterator) Response() OutboundEnvironmentEndpointCollection { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OutboundEnvironmentEndpointCollectionIterator) Value() OutboundEnvironmentEndpoint { + if !iter.page.NotDone() { + return OutboundEnvironmentEndpoint{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionIterator type. +func NewOutboundEnvironmentEndpointCollectionIterator(page OutboundEnvironmentEndpointCollectionPage) OutboundEnvironmentEndpointCollectionIterator { + return OutboundEnvironmentEndpointCollectionIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oeec OutboundEnvironmentEndpointCollection) IsEmpty() bool { + return oeec.Value == nil || len(*oeec.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (oeec OutboundEnvironmentEndpointCollection) hasNextLink() bool { + return oeec.NextLink != nil && len(*oeec.NextLink) != 0 +} + +// outboundEnvironmentEndpointCollectionPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oeec OutboundEnvironmentEndpointCollection) outboundEnvironmentEndpointCollectionPreparer(ctx context.Context) (*http.Request, error) { + if !oeec.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oeec.NextLink))) +} + +// OutboundEnvironmentEndpointCollectionPage contains a page of OutboundEnvironmentEndpoint values. +type OutboundEnvironmentEndpointCollectionPage struct { + fn func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error) + oeec OutboundEnvironmentEndpointCollection +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OutboundEnvironmentEndpointCollectionPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OutboundEnvironmentEndpointCollectionPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.oeec) + if err != nil { + return err + } + page.oeec = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OutboundEnvironmentEndpointCollectionPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OutboundEnvironmentEndpointCollectionPage) NotDone() bool { + return !page.oeec.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OutboundEnvironmentEndpointCollectionPage) Response() OutboundEnvironmentEndpointCollection { + return page.oeec +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OutboundEnvironmentEndpointCollectionPage) Values() []OutboundEnvironmentEndpoint { + if page.oeec.IsEmpty() { + return nil + } + return *page.oeec.Value +} + +// Creates a new instance of the OutboundEnvironmentEndpointCollectionPage type. +func NewOutboundEnvironmentEndpointCollectionPage(cur OutboundEnvironmentEndpointCollection, getNextPage func(context.Context, OutboundEnvironmentEndpointCollection) (OutboundEnvironmentEndpointCollection, error)) OutboundEnvironmentEndpointCollectionPage { + return OutboundEnvironmentEndpointCollectionPage{ + fn: getNextPage, + oeec: cur, + } +} + +// PowerState describes the Power State of the cluster +type PowerState struct { + // Code - Tells whether the cluster is Running or Stopped. Possible values include: 'CodeRunning', 'CodeStopped' + Code Code `json:"code,omitempty"` +} + +// PrivateEndpoint private endpoint which a connection belongs to. +type PrivateEndpoint struct { + // ID - The resource ID of the private endpoint + ID *string `json:"id,omitempty"` +} + +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The ID of the private endpoint connection. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the private endpoint connection. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // PrivateEndpointConnectionProperties - The properties of a private endpoint connection. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + case "properties": + if v != nil { + var privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + } + } + + return nil +} + +// PrivateEndpointConnectionListResult a list of private endpoint connections +type PrivateEndpointConnectionListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // ProvisioningState - READ-ONLY; The current provisioning state. Possible values include: 'PrivateEndpointConnectionProvisioningStateSucceeded', 'PrivateEndpointConnectionProvisioningStateCreating', 'PrivateEndpointConnectionProvisioningStateDeleting', 'PrivateEndpointConnectionProvisioningStateFailed' + ProvisioningState PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - The resource of private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnectionProperties. +func (pecp PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pecp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = pecp.PrivateEndpoint + } + if pecp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = pecp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("containerservice.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateLinkResource a private link resource +type PrivateLinkResource struct { + autorest.Response `json:"-"` + // ID - The ID of the private link resource. + ID *string `json:"id,omitempty"` + // Name - The name of the private link resource. + Name *string `json:"name,omitempty"` + // Type - The resource type. + Type *string `json:"type,omitempty"` + // GroupID - The group ID of the resource. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The RequiredMembers of the resource + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // PrivateLinkServiceID - READ-ONLY; The private link service ID of the resource, this field is exposed only to NRP internally. + PrivateLinkServiceID *string `json:"privateLinkServiceID,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkResource. +func (plr PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plr.ID != nil { + objectMap["id"] = plr.ID + } + if plr.Name != nil { + objectMap["name"] = plr.Name + } + if plr.Type != nil { + objectMap["type"] = plr.Type + } + if plr.GroupID != nil { + objectMap["groupId"] = plr.GroupID + } + if plr.RequiredMembers != nil { + objectMap["requiredMembers"] = plr.RequiredMembers + } + return json.Marshal(objectMap) +} + +// PrivateLinkResourcesListResult a list of private link resources +type PrivateLinkResourcesListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]PrivateLinkResource `json:"value,omitempty"` +} + +// PrivateLinkServiceConnectionState the state of a private link service connection. +type PrivateLinkServiceConnectionState struct { + // Status - The private link service connection status. Possible values include: 'ConnectionStatusPending', 'ConnectionStatusApproved', 'ConnectionStatusRejected', 'ConnectionStatusDisconnected' + Status ConnectionStatus `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` +} + +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceReference a reference to an Azure resource. +type ResourceReference struct { + // ID - The fully qualified Azure resource id. + ID *string `json:"id,omitempty"` +} + +// RunCommandRequest a run command request +type RunCommandRequest struct { + // Command - The command to run. + Command *string `json:"command,omitempty"` + // Context - A base64 encoded zip file containing the files required by the command. + Context *string `json:"context,omitempty"` + // ClusterToken - AuthToken issued for AKS AAD Server App. + ClusterToken *string `json:"clusterToken,omitempty"` +} + +// RunCommandResult run command result. +type RunCommandResult struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The command id. + ID *string `json:"id,omitempty"` + // CommandResultProperties - Properties of command result. + *CommandResultProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RunCommandResult. +func (rcr RunCommandResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rcr.CommandResultProperties != nil { + objectMap["properties"] = rcr.CommandResultProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RunCommandResult struct. +func (rcr *RunCommandResult) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rcr.ID = &ID + } + case "properties": + if v != nil { + var commandResultProperties CommandResultProperties + err = json.Unmarshal(*v, &commandResultProperties) + if err != nil { + return err + } + rcr.CommandResultProperties = &commandResultProperties + } + } + } + + return nil +} + +// Snapshot a node pool snapshot resource. +type Snapshot struct { + autorest.Response `json:"-"` + // SnapshotProperties - Properties of a snapshot. + *SnapshotProperties `json:"properties,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Snapshot. +func (s Snapshot) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SnapshotProperties != nil { + objectMap["properties"] = s.SnapshotProperties + } + if s.Tags != nil { + objectMap["tags"] = s.Tags + } + if s.Location != nil { + objectMap["location"] = s.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Snapshot struct. +func (s *Snapshot) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var snapshotProperties SnapshotProperties + err = json.Unmarshal(*v, &snapshotProperties) + if err != nil { + return err + } + s.SnapshotProperties = &snapshotProperties + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + s.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + s.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + } + } + + return nil +} + +// SnapshotListResult the response from the List Snapshots operation. +type SnapshotListResult struct { + autorest.Response `json:"-"` + // Value - The list of snapshots. + Value *[]Snapshot `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to get the next set of snapshot results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotListResult. +func (slr SnapshotListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if slr.Value != nil { + objectMap["value"] = slr.Value + } + return json.Marshal(objectMap) +} + +// SnapshotListResultIterator provides access to a complete listing of Snapshot values. +type SnapshotListResultIterator struct { + i int + page SnapshotListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SnapshotListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SnapshotListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SnapshotListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SnapshotListResultIterator) Response() SnapshotListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SnapshotListResultIterator) Value() Snapshot { + if !iter.page.NotDone() { + return Snapshot{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SnapshotListResultIterator type. +func NewSnapshotListResultIterator(page SnapshotListResultPage) SnapshotListResultIterator { + return SnapshotListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (slr SnapshotListResult) IsEmpty() bool { + return slr.Value == nil || len(*slr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (slr SnapshotListResult) hasNextLink() bool { + return slr.NextLink != nil && len(*slr.NextLink) != 0 +} + +// snapshotListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (slr SnapshotListResult) snapshotListResultPreparer(ctx context.Context) (*http.Request, error) { + if !slr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(slr.NextLink))) +} + +// SnapshotListResultPage contains a page of Snapshot values. +type SnapshotListResultPage struct { + fn func(context.Context, SnapshotListResult) (SnapshotListResult, error) + slr SnapshotListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SnapshotListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.slr) + if err != nil { + return err + } + page.slr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SnapshotListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SnapshotListResultPage) NotDone() bool { + return !page.slr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SnapshotListResultPage) Response() SnapshotListResult { + return page.slr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SnapshotListResultPage) Values() []Snapshot { + if page.slr.IsEmpty() { + return nil + } + return *page.slr.Value +} + +// Creates a new instance of the SnapshotListResultPage type. +func NewSnapshotListResultPage(cur SnapshotListResult, getNextPage func(context.Context, SnapshotListResult) (SnapshotListResult, error)) SnapshotListResultPage { + return SnapshotListResultPage{ + fn: getNextPage, + slr: cur, + } +} + +// SnapshotProperties properties used to configure a node pool snapshot. +type SnapshotProperties struct { + // CreationData - CreationData to be used to specify the source agent pool resource ID to create this snapshot. + CreationData *CreationData `json:"creationData,omitempty"` + // SnapshotType - Possible values include: 'SnapshotTypeNodePool', 'SnapshotTypeManagedCluster' + SnapshotType SnapshotType `json:"snapshotType,omitempty"` + // KubernetesVersion - READ-ONLY; The version of Kubernetes. + KubernetesVersion *string `json:"kubernetesVersion,omitempty"` + // NodeImageVersion - READ-ONLY; The version of node image. + NodeImageVersion *string `json:"nodeImageVersion,omitempty"` + // OsType - READ-ONLY; Possible values include: 'OSTypeLinux', 'OSTypeWindows' + OsType OSType `json:"osType,omitempty"` + // OsSku - READ-ONLY; Possible values include: 'OSSKUUbuntu', 'OSSKUCBLMariner' + OsSku OSSKU `json:"osSku,omitempty"` + // VMSize - READ-ONLY; The size of the VM. + VMSize *string `json:"vmSize,omitempty"` + // EnableFIPS - READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool `json:"enableFIPS,omitempty"` +} + +// MarshalJSON is the custom marshaler for SnapshotProperties. +func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.CreationData != nil { + objectMap["creationData"] = sp.CreationData + } + if sp.SnapshotType != "" { + objectMap["snapshotType"] = sp.SnapshotType + } + return json.Marshal(objectMap) +} + +// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. +type SSHConfiguration struct { + // PublicKeys - The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` +} + +// SSHPublicKey contains information about SSH certificate public key data. +type SSHPublicKey struct { + // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + KeyData *string `json:"keyData,omitempty"` +} + +// SubResource reference to another subresource. +type SubResource struct { + // ID - READ-ONLY; Resource ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubResource. +func (sr SubResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SysctlConfig sysctl settings for Linux agent nodes. +type SysctlConfig struct { + // NetCoreSomaxconn - Sysctl setting net.core.somaxconn. + NetCoreSomaxconn *int32 `json:"netCoreSomaxconn,omitempty"` + // NetCoreNetdevMaxBacklog - Sysctl setting net.core.netdev_max_backlog. + NetCoreNetdevMaxBacklog *int32 `json:"netCoreNetdevMaxBacklog,omitempty"` + // NetCoreRmemDefault - Sysctl setting net.core.rmem_default. + NetCoreRmemDefault *int32 `json:"netCoreRmemDefault,omitempty"` + // NetCoreRmemMax - Sysctl setting net.core.rmem_max. + NetCoreRmemMax *int32 `json:"netCoreRmemMax,omitempty"` + // NetCoreWmemDefault - Sysctl setting net.core.wmem_default. + NetCoreWmemDefault *int32 `json:"netCoreWmemDefault,omitempty"` + // NetCoreWmemMax - Sysctl setting net.core.wmem_max. + NetCoreWmemMax *int32 `json:"netCoreWmemMax,omitempty"` + // NetCoreOptmemMax - Sysctl setting net.core.optmem_max. + NetCoreOptmemMax *int32 `json:"netCoreOptmemMax,omitempty"` + // NetIpv4TCPMaxSynBacklog - Sysctl setting net.ipv4.tcp_max_syn_backlog. + NetIpv4TCPMaxSynBacklog *int32 `json:"netIpv4TcpMaxSynBacklog,omitempty"` + // NetIpv4TCPMaxTwBuckets - Sysctl setting net.ipv4.tcp_max_tw_buckets. + NetIpv4TCPMaxTwBuckets *int32 `json:"netIpv4TcpMaxTwBuckets,omitempty"` + // NetIpv4TCPFinTimeout - Sysctl setting net.ipv4.tcp_fin_timeout. + NetIpv4TCPFinTimeout *int32 `json:"netIpv4TcpFinTimeout,omitempty"` + // NetIpv4TCPKeepaliveTime - Sysctl setting net.ipv4.tcp_keepalive_time. + NetIpv4TCPKeepaliveTime *int32 `json:"netIpv4TcpKeepaliveTime,omitempty"` + // NetIpv4TCPKeepaliveProbes - Sysctl setting net.ipv4.tcp_keepalive_probes. + NetIpv4TCPKeepaliveProbes *int32 `json:"netIpv4TcpKeepaliveProbes,omitempty"` + // NetIpv4TcpkeepaliveIntvl - Sysctl setting net.ipv4.tcp_keepalive_intvl. + NetIpv4TcpkeepaliveIntvl *int32 `json:"netIpv4TcpkeepaliveIntvl,omitempty"` + // NetIpv4TCPTwReuse - Sysctl setting net.ipv4.tcp_tw_reuse. + NetIpv4TCPTwReuse *bool `json:"netIpv4TcpTwReuse,omitempty"` + // NetIpv4IPLocalPortRange - Sysctl setting net.ipv4.ip_local_port_range. + NetIpv4IPLocalPortRange *string `json:"netIpv4IpLocalPortRange,omitempty"` + // NetIpv4NeighDefaultGcThresh1 - Sysctl setting net.ipv4.neigh.default.gc_thresh1. + NetIpv4NeighDefaultGcThresh1 *int32 `json:"netIpv4NeighDefaultGcThresh1,omitempty"` + // NetIpv4NeighDefaultGcThresh2 - Sysctl setting net.ipv4.neigh.default.gc_thresh2. + NetIpv4NeighDefaultGcThresh2 *int32 `json:"netIpv4NeighDefaultGcThresh2,omitempty"` + // NetIpv4NeighDefaultGcThresh3 - Sysctl setting net.ipv4.neigh.default.gc_thresh3. + NetIpv4NeighDefaultGcThresh3 *int32 `json:"netIpv4NeighDefaultGcThresh3,omitempty"` + // NetNetfilterNfConntrackMax - Sysctl setting net.netfilter.nf_conntrack_max. + NetNetfilterNfConntrackMax *int32 `json:"netNetfilterNfConntrackMax,omitempty"` + // NetNetfilterNfConntrackBuckets - Sysctl setting net.netfilter.nf_conntrack_buckets. + NetNetfilterNfConntrackBuckets *int32 `json:"netNetfilterNfConntrackBuckets,omitempty"` + // FsInotifyMaxUserWatches - Sysctl setting fs.inotify.max_user_watches. + FsInotifyMaxUserWatches *int32 `json:"fsInotifyMaxUserWatches,omitempty"` + // FsFileMax - Sysctl setting fs.file-max. + FsFileMax *int32 `json:"fsFileMax,omitempty"` + // FsAioMaxNr - Sysctl setting fs.aio-max-nr. + FsAioMaxNr *int32 `json:"fsAioMaxNr,omitempty"` + // FsNrOpen - Sysctl setting fs.nr_open. + FsNrOpen *int32 `json:"fsNrOpen,omitempty"` + // KernelThreadsMax - Sysctl setting kernel.threads-max. + KernelThreadsMax *int32 `json:"kernelThreadsMax,omitempty"` + // VMMaxMapCount - Sysctl setting vm.max_map_count. + VMMaxMapCount *int32 `json:"vmMaxMapCount,omitempty"` + // VMSwappiness - Sysctl setting vm.swappiness. + VMSwappiness *int32 `json:"vmSwappiness,omitempty"` + // VMVfsCachePressure - Sysctl setting vm.vfs_cache_pressure. + VMVfsCachePressure *int32 `json:"vmVfsCachePressure,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TagsObject tags object for patch operations. +type TagsObject struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for TagsObject. +func (toVar TagsObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if toVar.Tags != nil { + objectMap["tags"] = toVar.Tags + } + return json.Marshal(objectMap) +} + +// TimeInWeek time in a week. +type TimeInWeek struct { + // Day - The day of the week. Possible values include: 'WeekDaySunday', 'WeekDayMonday', 'WeekDayTuesday', 'WeekDayWednesday', 'WeekDayThursday', 'WeekDayFriday', 'WeekDaySaturday' + Day WeekDay `json:"day,omitempty"` + // HourSlots - Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. + HourSlots *[]int32 `json:"hourSlots,omitempty"` +} + +// TimeSpan for example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. +type TimeSpan struct { + // Start - The start of a time span + Start *date.Time `json:"start,omitempty"` + // End - The end of a time span + End *date.Time `json:"end,omitempty"` +} + +// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + +// UserAssignedIdentity details about a user assigned identity. +type UserAssignedIdentity struct { + // ResourceID - The resource ID of the user assigned identity. + ResourceID *string `json:"resourceId,omitempty"` + // ClientID - The client ID of the user assigned identity. + ClientID *string `json:"clientId,omitempty"` + // ObjectID - The object ID of the user assigned identity. + ObjectID *string `json:"objectId,omitempty"` +} + +// VMDiagnostics profile for diagnostics on the container service VMs. +type VMDiagnostics struct { + // Enabled - Whether the VM diagnostic agent is provisioned on the VM. + Enabled *bool `json:"enabled,omitempty"` + // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. + StorageURI *string `json:"storageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMDiagnostics. +func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vd.Enabled != nil { + objectMap["enabled"] = vd.Enabled + } + return json.Marshal(objectMap) +} + +// WindowsGmsaProfile windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Enabled - Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool `json:"enabled,omitempty"` + // DNSServer - Specifies the DNS server for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string `json:"dnsServer,omitempty"` + // RootDomainName - Specifies the root domain name for Windows gMSA.

Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string `json:"rootDomainName,omitempty"` +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go new file mode 100644 index 000000000000..d3fceb6d4aa3 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/operations.go @@ -0,0 +1,98 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationsClient is the the Container Service Client. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.OperationsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ContainerService/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go new file mode 100644 index 000000000000..316d11958eac --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privateendpointconnections.go @@ -0,0 +1,406 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateEndpointConnectionsClient is the the Container Service Client. +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update sends the update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// privateEndpointConnectionName - the name of the private endpoint connection. +// parameters - the updated private endpoint connection. +func (client PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}, + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.PrivateEndpointConnectionProperties.PrivateLinkServiceConnectionState", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateEndpointConnectionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateEndpointConnectionsClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client PrivateEndpointConnectionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) UpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go new file mode 100644 index 000000000000..0b898090ea61 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/privatelinkresources.go @@ -0,0 +1,122 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// PrivateLinkResourcesClient is the the Container Service Client. +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List to learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateLinkResourcesListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result PrivateLinkResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go new file mode 100644 index 000000000000..f4472650fce6 --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/resolveprivatelinkserviceid.go @@ -0,0 +1,126 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ResolvePrivateLinkServiceIDClient is the the Container Service Client. +type ResolvePrivateLinkServiceIDClient struct { + BaseClient +} + +// NewResolvePrivateLinkServiceIDClient creates an instance of the ResolvePrivateLinkServiceIDClient client. +func NewResolvePrivateLinkServiceIDClient(subscriptionID string) ResolvePrivateLinkServiceIDClient { + return NewResolvePrivateLinkServiceIDClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResolvePrivateLinkServiceIDClientWithBaseURI creates an instance of the ResolvePrivateLinkServiceIDClient client +// using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign +// clouds, Azure stack). +func NewResolvePrivateLinkServiceIDClientWithBaseURI(baseURI string, subscriptionID string) ResolvePrivateLinkServiceIDClient { + return ResolvePrivateLinkServiceIDClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// POST sends the post request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters required in order to resolve a private link service ID. +func (client ResolvePrivateLinkServiceIDClient) POST(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (result PrivateLinkResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResolvePrivateLinkServiceIDClient.POST") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.ResolvePrivateLinkServiceIDClient", "POST", err.Error()) + } + + req, err := client.POSTPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", nil, "Failure preparing request") + return + } + + resp, err := client.POSTSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure sending request") + return + } + + result, err = client.POSTResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.ResolvePrivateLinkServiceIDClient", "POST", resp, "Failure responding to request") + return + } + + return +} + +// POSTPreparer prepares the POST request. +func (client ResolvePrivateLinkServiceIDClient) POSTPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters PrivateLinkResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.PrivateLinkServiceID = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// POSTSender sends the POST request. The method will close the +// http.Response Body if it receives an error. +func (client ResolvePrivateLinkServiceIDClient) POSTSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// POSTResponder handles the response to the POST request. The method always +// closes the http.Response Body. +func (client ResolvePrivateLinkServiceIDClient) POSTResponder(resp *http.Response) (result PrivateLinkResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go new file mode 100644 index 000000000000..eebb40b76edd --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/snapshots.go @@ -0,0 +1,637 @@ +package containerservice + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// SnapshotsClient is the the Container Service Client. +type SnapshotsClient struct { + BaseClient +} + +// NewSnapshotsClient creates an instance of the SnapshotsClient client. +func NewSnapshotsClient(subscriptionID string) SnapshotsClient { + return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { + return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - the snapshot to create or update. +func (client SnapshotsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SnapshotsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters Snapshot) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) CreateOrUpdateResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +func (client SnapshotsClient) List(ctx context.Context) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure sending request") + return + } + + result.slr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "List", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SnapshotsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListComplete(ctx context.Context) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup sends the list by resource group request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client SnapshotsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result SnapshotListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.slr.hasNextLink() && result.slr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SnapshotsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) ListByResourceGroupResponder(resp *http.Response) (result SnapshotListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client SnapshotsClient) listByResourceGroupNextResults(ctx context.Context, lastResults SnapshotListResult) (result SnapshotListResult, err error) { + req, err := lastResults.snapshotListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SnapshotsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result SnapshotListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// UpdateTags sends the update tags request. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceName - the name of the managed cluster resource. +// parameters - parameters supplied to the Update snapshot Tags operation. +func (client SnapshotsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (result Snapshot, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.UpdateTags") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("containerservice.SnapshotsClient", "UpdateTags", err.Error()) + } + + req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateTagsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure sending request") + return + } + + result, err = client.UpdateTagsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "containerservice.SnapshotsClient", "UpdateTags", resp, "Failure responding to request") + return + } + + return +} + +// UpdateTagsPreparer prepares the UpdateTags request. +func (client SnapshotsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters TagsObject) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-03-02-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateTagsSender sends the UpdateTags request. The method will close the +// http.Response Body if it receives an error. +func (client SnapshotsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateTagsResponder handles the response to the UpdateTags request. The method always +// closes the http.Response Body. +func (client SnapshotsClient) UpdateTagsResponder(resp *http.Response) (result Snapshot, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go new file mode 100644 index 000000000000..23c92ba7393f --- /dev/null +++ b/services/preview/containerservice/mgmt/2022-03-02-preview/containerservice/version.go @@ -0,0 +1,19 @@ +package containerservice + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " containerservice/2022-03-02-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/synapse/mgmt/v2.0/synapse/CHANGELOG.md b/services/preview/synapse/mgmt/v2.0/synapse/CHANGELOG.md index 92c7b637a920..d13e71f24bc6 100644 --- a/services/preview/synapse/mgmt/v2.0/synapse/CHANGELOG.md +++ b/services/preview/synapse/mgmt/v2.0/synapse/CHANGELOG.md @@ -1,49 +1,51 @@ # Change History -## Breaking Changes - -### Removed Constants - -1. StorageAccountType.StorageAccountTypeZRS - ## Additive Changes -### New Constants - -1. Kind.KindReadOnlyFollowing -1. PrincipalsModificationKind.PrincipalsModificationKindNone -1. PrincipalsModificationKind.PrincipalsModificationKindReplace -1. PrincipalsModificationKind.PrincipalsModificationKindUnion - ### New Funcs -1. *ReadOnlyFollowingDatabase.UnmarshalJSON([]byte) error -1. Database.AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) -1. PossiblePrincipalsModificationKindValues() []PrincipalsModificationKind -1. ReadOnlyFollowingDatabase.AsBasicDatabase() (BasicDatabase, bool) -1. ReadOnlyFollowingDatabase.AsDatabase() (*Database, bool) -1. ReadOnlyFollowingDatabase.AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) -1. ReadOnlyFollowingDatabase.AsReadWriteDatabase() (*ReadWriteDatabase, bool) -1. ReadOnlyFollowingDatabase.MarshalJSON() ([]byte, error) -1. ReadOnlyFollowingDatabaseProperties.MarshalJSON() ([]byte, error) -1. ReadWriteDatabase.AsReadOnlyFollowingDatabase() (*ReadOnlyFollowingDatabase, bool) -1. SQLPoolResourceProperties.MarshalJSON() ([]byte, error) +1. *DedicatedSQLminimalTLSSettings.UnmarshalJSON([]byte) error +1. *DedicatedSQLminimalTLSSettingsListResultIterator.Next() error +1. *DedicatedSQLminimalTLSSettingsListResultIterator.NextWithContext(context.Context) error +1. *DedicatedSQLminimalTLSSettingsListResultPage.Next() error +1. *DedicatedSQLminimalTLSSettingsListResultPage.NextWithContext(context.Context) error +1. *WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture.UnmarshalJSON([]byte) error +1. DedicatedSQLminimalTLSSettings.MarshalJSON() ([]byte, error) +1. DedicatedSQLminimalTLSSettingsListResult.IsEmpty() bool +1. DedicatedSQLminimalTLSSettingsListResult.MarshalJSON() ([]byte, error) +1. DedicatedSQLminimalTLSSettingsListResultIterator.NotDone() bool +1. DedicatedSQLminimalTLSSettingsListResultIterator.Response() DedicatedSQLminimalTLSSettingsListResult +1. DedicatedSQLminimalTLSSettingsListResultIterator.Value() DedicatedSQLminimalTLSSettings +1. DedicatedSQLminimalTLSSettingsListResultPage.NotDone() bool +1. DedicatedSQLminimalTLSSettingsListResultPage.Response() DedicatedSQLminimalTLSSettingsListResult +1. DedicatedSQLminimalTLSSettingsListResultPage.Values() []DedicatedSQLminimalTLSSettings +1. NewDedicatedSQLminimalTLSSettingsListResultIterator(DedicatedSQLminimalTLSSettingsListResultPage) DedicatedSQLminimalTLSSettingsListResultIterator +1. NewDedicatedSQLminimalTLSSettingsListResultPage(DedicatedSQLminimalTLSSettingsListResult, func(context.Context, DedicatedSQLminimalTLSSettingsListResult) (DedicatedSQLminimalTLSSettingsListResult, error)) DedicatedSQLminimalTLSSettingsListResultPage +1. NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient(string) WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient +1. NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientWithBaseURI(string, string) WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.Get(context.Context, string, string, string) (DedicatedSQLminimalTLSSettings, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.GetResponder(*http.Response) (DedicatedSQLminimalTLSSettings, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.GetSender(*http.Request) (*http.Response, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.List(context.Context, string, string) (DedicatedSQLminimalTLSSettingsListResultPage, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.ListComplete(context.Context, string, string) (DedicatedSQLminimalTLSSettingsListResultIterator, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.ListPreparer(context.Context, string, string) (*http.Request, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.ListResponder(*http.Response) (DedicatedSQLminimalTLSSettingsListResult, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.ListSender(*http.Request) (*http.Response, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.Update(context.Context, string, string, DedicatedSQLminimalTLSSettings) (WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.UpdatePreparer(context.Context, string, string, DedicatedSQLminimalTLSSettings) (*http.Request, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.UpdateResponder(*http.Response) (DedicatedSQLminimalTLSSettings, error) +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.UpdateSender(*http.Request) (WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture, error) ### Struct Changes #### New Structs -1. ManagedIntegrationRuntimeManagedVirtualNetworkReference -1. ReadOnlyFollowingDatabase -1. ReadOnlyFollowingDatabaseProperties - -#### New Struct Fields - -1. DynamicExecutorAllocation.MaxExecutors -1. DynamicExecutorAllocation.MinExecutors -1. ExtendedServerBlobAuditingPolicyProperties.IsDevopsAuditEnabled -1. ManagedIntegrationRuntime.*ManagedIntegrationRuntimeManagedVirtualNetworkReference -1. SelfHostedIntegrationRuntimeStatusTypeProperties.NewerVersions -1. SelfHostedIntegrationRuntimeStatusTypeProperties.ServiceRegion -1. ServerBlobAuditingPolicyProperties.IsDevopsAuditEnabled -1. WorkspaceProperties.TrustedServiceBypassEnabled +1. DedicatedSQLminimalTLSSettings +1. DedicatedSQLminimalTLSSettingsListResult +1. DedicatedSQLminimalTLSSettingsListResultIterator +1. DedicatedSQLminimalTLSSettingsListResultPage +1. DedicatedSQLminimalTLSSettingsPatchInfo +1. DedicatedSQLminimalTLSSettingsProperties +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient +1. WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture diff --git a/services/preview/synapse/mgmt/v2.0/synapse/_meta.json b/services/preview/synapse/mgmt/v2.0/synapse/_meta.json index ee185ae0cec2..e89201e309d4 100644 --- a/services/preview/synapse/mgmt/v2.0/synapse/_meta.json +++ b/services/preview/synapse/mgmt/v2.0/synapse/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3587a60ea8f18e76a41e4b56b72aeddce879aae9", + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", "readme": "/_/azure-rest-api-specs/specification/synapse/resource-manager/readme.md", "tag": "package-composite-v2", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/synapse/mgmt/v2.0/synapse/models.go b/services/preview/synapse/mgmt/v2.0/synapse/models.go index f7dff3b90dca..d949c04cd15e 100644 --- a/services/preview/synapse/mgmt/v2.0/synapse/models.go +++ b/services/preview/synapse/mgmt/v2.0/synapse/models.go @@ -2529,6 +2529,268 @@ func (dwuap DataWarehouseUserActivitiesProperties) MarshalJSON() ([]byte, error) return json.Marshal(objectMap) } +// DedicatedSQLminimalTLSSettings dedicated Sql Minimal Tls Settings Info +type DedicatedSQLminimalTLSSettings struct { + autorest.Response `json:"-"` + // Location - READ-ONLY; Resource location. + Location *string `json:"location,omitempty"` + // DedicatedSQLminimalTLSSettingsProperties - Resource properties. + *DedicatedSQLminimalTLSSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DedicatedSQLminimalTLSSettings. +func (dslts DedicatedSQLminimalTLSSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dslts.DedicatedSQLminimalTLSSettingsProperties != nil { + objectMap["properties"] = dslts.DedicatedSQLminimalTLSSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DedicatedSQLminimalTLSSettings struct. +func (dslts *DedicatedSQLminimalTLSSettings) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + dslts.Location = &location + } + case "properties": + if v != nil { + var dedicatedSQLminimalTLSSettingsProperties DedicatedSQLminimalTLSSettingsProperties + err = json.Unmarshal(*v, &dedicatedSQLminimalTLSSettingsProperties) + if err != nil { + return err + } + dslts.DedicatedSQLminimalTLSSettingsProperties = &dedicatedSQLminimalTLSSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dslts.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dslts.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dslts.Type = &typeVar + } + } + } + + return nil +} + +// DedicatedSQLminimalTLSSettingsListResult a list of the server's dedicated sql minimal tls settings. +type DedicatedSQLminimalTLSSettingsListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; Array of results. + Value *[]DedicatedSQLminimalTLSSettings `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for DedicatedSQLminimalTLSSettingsListResult. +func (dsltslr DedicatedSQLminimalTLSSettingsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// DedicatedSQLminimalTLSSettingsListResultIterator provides access to a complete listing of +// DedicatedSQLminimalTLSSettings values. +type DedicatedSQLminimalTLSSettingsListResultIterator struct { + i int + page DedicatedSQLminimalTLSSettingsListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DedicatedSQLminimalTLSSettingsListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedSQLminimalTLSSettingsListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DedicatedSQLminimalTLSSettingsListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DedicatedSQLminimalTLSSettingsListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DedicatedSQLminimalTLSSettingsListResultIterator) Response() DedicatedSQLminimalTLSSettingsListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DedicatedSQLminimalTLSSettingsListResultIterator) Value() DedicatedSQLminimalTLSSettings { + if !iter.page.NotDone() { + return DedicatedSQLminimalTLSSettings{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DedicatedSQLminimalTLSSettingsListResultIterator type. +func NewDedicatedSQLminimalTLSSettingsListResultIterator(page DedicatedSQLminimalTLSSettingsListResultPage) DedicatedSQLminimalTLSSettingsListResultIterator { + return DedicatedSQLminimalTLSSettingsListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dsltslr DedicatedSQLminimalTLSSettingsListResult) IsEmpty() bool { + return dsltslr.Value == nil || len(*dsltslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dsltslr DedicatedSQLminimalTLSSettingsListResult) hasNextLink() bool { + return dsltslr.NextLink != nil && len(*dsltslr.NextLink) != 0 +} + +// dedicatedSQLminimalTLSSettingsListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dsltslr DedicatedSQLminimalTLSSettingsListResult) dedicatedSQLminimalTLSSettingsListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dsltslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dsltslr.NextLink))) +} + +// DedicatedSQLminimalTLSSettingsListResultPage contains a page of DedicatedSQLminimalTLSSettings values. +type DedicatedSQLminimalTLSSettingsListResultPage struct { + fn func(context.Context, DedicatedSQLminimalTLSSettingsListResult) (DedicatedSQLminimalTLSSettingsListResult, error) + dsltslr DedicatedSQLminimalTLSSettingsListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DedicatedSQLminimalTLSSettingsListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DedicatedSQLminimalTLSSettingsListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dsltslr) + if err != nil { + return err + } + page.dsltslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DedicatedSQLminimalTLSSettingsListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DedicatedSQLminimalTLSSettingsListResultPage) NotDone() bool { + return !page.dsltslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DedicatedSQLminimalTLSSettingsListResultPage) Response() DedicatedSQLminimalTLSSettingsListResult { + return page.dsltslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DedicatedSQLminimalTLSSettingsListResultPage) Values() []DedicatedSQLminimalTLSSettings { + if page.dsltslr.IsEmpty() { + return nil + } + return *page.dsltslr.Value +} + +// Creates a new instance of the DedicatedSQLminimalTLSSettingsListResultPage type. +func NewDedicatedSQLminimalTLSSettingsListResultPage(cur DedicatedSQLminimalTLSSettingsListResult, getNextPage func(context.Context, DedicatedSQLminimalTLSSettingsListResult) (DedicatedSQLminimalTLSSettingsListResult, error)) DedicatedSQLminimalTLSSettingsListResultPage { + return DedicatedSQLminimalTLSSettingsListResultPage{ + fn: getNextPage, + dsltslr: cur, + } +} + +// DedicatedSQLminimalTLSSettingsPatchInfo dedicated SQL minimal tls settings patch info +type DedicatedSQLminimalTLSSettingsPatchInfo struct { + // MinimalTLSVersion - minimal tls version + MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` +} + +// DedicatedSQLminimalTLSSettingsProperties properties of a dedicated sql minimal tls settings. +type DedicatedSQLminimalTLSSettingsProperties struct { + // MinimalTLSVersion - The minimal tls version of the sql server. + MinimalTLSVersion *string `json:"minimalTlsVersion,omitempty"` +} + // DynamicExecutorAllocation dynamic Executor Allocation Properties type DynamicExecutorAllocation struct { // Enabled - Indicates whether Dynamic Executor Allocation is enabled or not. @@ -19608,6 +19870,49 @@ func (future *WorkspaceManagedSQLServerBlobAuditingPoliciesCreateOrUpdateFuture) return } +// WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture an abstraction for monitoring and +// retrieving the results of a long-running operation. +type WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) (DedicatedSQLminimalTLSSettings, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture.Result. +func (future *WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture) result(client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) (dslts DedicatedSQLminimalTLSSettings, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + dslts.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if dslts.Response.Response, err = future.GetResult(sender); err == nil && dslts.Response.Response.StatusCode != http.StatusNoContent { + dslts, err = client.UpdateResponder(dslts.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture", "Result", dslts.Response.Response, "Failure responding to request") + } + } + return +} + // WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture an abstraction for monitoring and // retrieving the results of a long-running operation. type WorkspaceManagedSQLServerEncryptionProtectorCreateOrUpdateFuture struct { diff --git a/services/preview/synapse/mgmt/v2.0/synapse/synapseapi/interfaces.go b/services/preview/synapse/mgmt/v2.0/synapse/synapseapi/interfaces.go index 1af2dd2092d0..da5dbfbadcd8 100644 --- a/services/preview/synapse/mgmt/v2.0/synapse/synapseapi/interfaces.go +++ b/services/preview/synapse/mgmt/v2.0/synapse/synapseapi/interfaces.go @@ -446,6 +446,16 @@ type WorkspaceManagedSQLServerRecoverableSQLPoolsClientAPI interface { var _ WorkspaceManagedSQLServerRecoverableSQLPoolsClientAPI = (*synapse.WorkspaceManagedSQLServerRecoverableSQLPoolsClient)(nil) +// WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientAPI contains the set of methods on the WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient type. +type WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, workspaceName string, dedicatedSQLminimalTLSSettingsName string) (result synapse.DedicatedSQLminimalTLSSettings, err error) + List(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.DedicatedSQLminimalTLSSettingsListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result synapse.DedicatedSQLminimalTLSSettingsListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters synapse.DedicatedSQLminimalTLSSettings) (result synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture, err error) +} + +var _ WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientAPI = (*synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient)(nil) + // WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. type WorkspacesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, workspaceInfo synapse.Workspace) (result synapse.WorkspacesCreateOrUpdateFuture, err error) diff --git a/services/preview/synapse/mgmt/v2.0/synapse/workspacemanagedsqlserverdedicatedsqlminimaltlssettings.go b/services/preview/synapse/mgmt/v2.0/synapse/workspacemanagedsqlserverdedicatedsqlminimaltlssettings.go new file mode 100644 index 000000000000..46dc45fe22ad --- /dev/null +++ b/services/preview/synapse/mgmt/v2.0/synapse/workspacemanagedsqlserverdedicatedsqlminimaltlssettings.go @@ -0,0 +1,341 @@ +package synapse + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient is the azure Synapse Analytics Management Client +type WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient struct { + BaseClient +} + +// NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient creates an instance of the +// WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient client. +func NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient(subscriptionID string) WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient { + return NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientWithBaseURI creates an instance of the +// WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClientWithBaseURI(baseURI string, subscriptionID string) WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient { + return WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get workspace managed sql server's minimal tls settings. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// dedicatedSQLminimalTLSSettingsName - the name of the dedicated sql minimal tls settings. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, dedicatedSQLminimalTLSSettingsName string) (result DedicatedSQLminimalTLSSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, workspaceName, dedicatedSQLminimalTLSSettingsName) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) GetPreparer(ctx context.Context, resourceGroupName string, workspaceName string, dedicatedSQLminimalTLSSettingsName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedSQLminimalTlsSettingsName": autorest.Encode("path", dedicatedSQLminimalTLSSettingsName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings/{dedicatedSQLminimalTlsSettingsName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) GetResponder(resp *http.Response) (result DedicatedSQLminimalTLSSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list workspace managed sql server's minimal tls settings. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) List(ctx context.Context, resourceGroupName string, workspaceName string) (result DedicatedSQLminimalTLSSettingsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.List") + defer func() { + sc := -1 + if result.dsltslr.Response.Response != nil { + sc = result.dsltslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dsltslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "List", resp, "Failure sending request") + return + } + + result.dsltslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "List", resp, "Failure responding to request") + return + } + if result.dsltslr.hasNextLink() && result.dsltslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) ListPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) ListResponder(resp *http.Response) (result DedicatedSQLminimalTLSSettingsListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) listNextResults(ctx context.Context, lastResults DedicatedSQLminimalTLSSettingsListResult) (result DedicatedSQLminimalTLSSettingsListResult, err error) { + req, err := lastResults.dedicatedSQLminimalTLSSettingsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) ListComplete(ctx context.Context, resourceGroupName string, workspaceName string) (result DedicatedSQLminimalTLSSettingsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, workspaceName) + return +} + +// Update update workspace managed sql server's minimal tls settings. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// workspaceName - the name of the workspace. +// parameters - minimal tls settings +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, parameters DedicatedSQLminimalTLSSettings) (result WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, workspaceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "synapse.WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, workspaceName string, parameters DedicatedSQLminimalTLSSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "dedicatedSQLminimalTlsSettingsName": autorest.Encode("path", "default"), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2021-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.Location = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/dedicatedSQLminimalTlsSettings/{dedicatedSQLminimalTlsSettingsName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) UpdateSender(req *http.Request) (future WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkspaceManagedSQLServerDedicatedSQLMinimalTLSSettingsClient) UpdateResponder(resp *http.Response) (result DedicatedSQLminimalTLSSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/CHANGELOG.md b/services/reservations/mgmt/2022-03-01/reservations/CHANGELOG.md new file mode 100644 index 000000000000..52911e4cc5e4 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/CHANGELOG.md @@ -0,0 +1,2 @@ +# Change History + diff --git a/services/reservations/mgmt/2022-03-01/reservations/_meta.json b/services/reservations/mgmt/2022-03-01/reservations/_meta.json new file mode 100644 index 000000000000..07635c577942 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "fc9d4d2798f755bea848ac1c29b2730d31002cb8", + "readme": "/_/azure-rest-api-specs/specification/reservations/resource-manager/readme.md", + "tag": "package-2022-03", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2022-03 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/reservations/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" + } +} \ No newline at end of file diff --git a/services/reservations/mgmt/2022-03-01/reservations/calculateexchange.go b/services/reservations/mgmt/2022-03-01/reservations/calculateexchange.go new file mode 100644 index 000000000000..f46356074298 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/calculateexchange.go @@ -0,0 +1,106 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// CalculateExchangeClient is the client for the CalculateExchange methods of the Reservations service. +type CalculateExchangeClient struct { + BaseClient +} + +// NewCalculateExchangeClient creates an instance of the CalculateExchangeClient client. +func NewCalculateExchangeClient() CalculateExchangeClient { + return NewCalculateExchangeClientWithBaseURI(DefaultBaseURI) +} + +// NewCalculateExchangeClientWithBaseURI creates an instance of the CalculateExchangeClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewCalculateExchangeClientWithBaseURI(baseURI string) CalculateExchangeClient { + return CalculateExchangeClient{NewWithBaseURI(baseURI)} +} + +// Post calculates price for exchanging `Reservations` if there are no policy errors. +// Parameters: +// body - request containing purchases and refunds that need to be executed. +func (client CalculateExchangeClient) Post(ctx context.Context, body CalculateExchangeRequest) (result CalculateExchangePostFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/CalculateExchangeClient.Post") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PostPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.CalculateExchangeClient", "Post", nil, "Failure preparing request") + return + } + + result, err = client.PostSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.CalculateExchangeClient", "Post", result.Response(), "Failure sending request") + return + } + + return +} + +// PostPreparer prepares the Post request. +func (client CalculateExchangeClient) PostPreparer(ctx context.Context, body CalculateExchangeRequest) (*http.Request, error) { + const APIVersion = "2022-03-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.WithPath("/providers/Microsoft.Capacity/calculateExchange"), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostSender sends the Post request. The method will close the +// http.Response Body if it receives an error. +func (client CalculateExchangeClient) PostSender(req *http.Request) (future CalculateExchangePostFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PostResponder handles the response to the Post request. The method always +// closes the http.Response Body. +func (client CalculateExchangeClient) PostResponder(resp *http.Response) (result CalculateExchangeOperationResultResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/client.go b/services/reservations/mgmt/2022-03-01/reservations/client.go new file mode 100644 index 000000000000..7afcc4445f2e --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/client.go @@ -0,0 +1,211 @@ +// Package reservations implements the Azure ARM Reservations service API version . +// +// +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Reservations + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Reservations. +type BaseClient struct { + autorest.Client + BaseURI string +} + +// New creates an instance of the BaseClient client. +func New() BaseClient { + return NewWithBaseURI(DefaultBaseURI) +} + +// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with +// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWithBaseURI(baseURI string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + } +} + +// GetAppliedReservationList get applicable `Reservation`s that are applied to this subscription or a resource group +// under this subscription. +// Parameters: +// subscriptionID - id of the subscription +func (client BaseClient) GetAppliedReservationList(ctx context.Context, subscriptionID string) (result AppliedReservations, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetAppliedReservationList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetAppliedReservationListPreparer(ctx, subscriptionID) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetAppliedReservationList", nil, "Failure preparing request") + return + } + + resp, err := client.GetAppliedReservationListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetAppliedReservationList", resp, "Failure sending request") + return + } + + result, err = client.GetAppliedReservationListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetAppliedReservationList", resp, "Failure responding to request") + return + } + + return +} + +// GetAppliedReservationListPreparer prepares the GetAppliedReservationList request. +func (client BaseClient) GetAppliedReservationListPreparer(ctx context.Context, subscriptionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetAppliedReservationListSender sends the GetAppliedReservationList request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetAppliedReservationListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetAppliedReservationListResponder handles the response to the GetAppliedReservationList request. The method always +// closes the http.Response Body. +func (client BaseClient) GetAppliedReservationListResponder(resp *http.Response) (result AppliedReservations, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetCatalog sends the get catalog request. +// Parameters: +// subscriptionID - id of the subscription +// reservedResourceType - the type of the resource for which the skus should be provided. +// location - filters the skus based on the location specified in this parameter. This can be an azure region +// or global +// publisherID - publisher id used to get the third party products +// offerID - offer id used to get the third party products +// planID - plan id used to get the third party products +func (client BaseClient) GetCatalog(ctx context.Context, subscriptionID string, reservedResourceType string, location string, publisherID string, offerID string, planID string) (result ListCatalog, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.GetCatalog") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetCatalogPreparer(ctx, subscriptionID, reservedResourceType, location, publisherID, offerID, planID) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetCatalog", nil, "Failure preparing request") + return + } + + resp, err := client.GetCatalogSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetCatalog", resp, "Failure sending request") + return + } + + result, err = client.GetCatalogResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.BaseClient", "GetCatalog", resp, "Failure responding to request") + return + } + + return +} + +// GetCatalogPreparer prepares the GetCatalog request. +func (client BaseClient) GetCatalogPreparer(ctx context.Context, subscriptionID string, reservedResourceType string, location string, publisherID string, offerID string, planID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(reservedResourceType) > 0 { + queryParameters["reservedResourceType"] = autorest.Encode("query", reservedResourceType) + } + if len(location) > 0 { + queryParameters["location"] = autorest.Encode("query", location) + } + if len(publisherID) > 0 { + queryParameters["publisherId"] = autorest.Encode("query", publisherID) + } + if len(offerID) > 0 { + queryParameters["offerId"] = autorest.Encode("query", offerID) + } + if len(planID) > 0 { + queryParameters["planId"] = autorest.Encode("query", planID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetCatalogSender sends the GetCatalog request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) GetCatalogSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetCatalogResponder handles the response to the GetCatalog request. The method always +// closes the http.Response Body. +func (client BaseClient) GetCatalogResponder(resp *http.Response) (result ListCatalog, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/enums.go b/services/reservations/mgmt/2022-03-01/reservations/enums.go new file mode 100644 index 000000000000..f42c6d62abe4 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/enums.go @@ -0,0 +1,512 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AppliedScopeType enumerates the values for applied scope type. +type AppliedScopeType string + +const ( + // AppliedScopeTypeShared ... + AppliedScopeTypeShared AppliedScopeType = "Shared" + // AppliedScopeTypeSingle ... + AppliedScopeTypeSingle AppliedScopeType = "Single" +) + +// PossibleAppliedScopeTypeValues returns an array of possible values for the AppliedScopeType const type. +func PossibleAppliedScopeTypeValues() []AppliedScopeType { + return []AppliedScopeType{AppliedScopeTypeShared, AppliedScopeTypeSingle} +} + +// CalculateExchangeOperationResultStatus enumerates the values for calculate exchange operation result status. +type CalculateExchangeOperationResultStatus string + +const ( + // CalculateExchangeOperationResultStatusCancelled ... + CalculateExchangeOperationResultStatusCancelled CalculateExchangeOperationResultStatus = "Cancelled" + // CalculateExchangeOperationResultStatusFailed ... + CalculateExchangeOperationResultStatusFailed CalculateExchangeOperationResultStatus = "Failed" + // CalculateExchangeOperationResultStatusPending ... + CalculateExchangeOperationResultStatusPending CalculateExchangeOperationResultStatus = "Pending" + // CalculateExchangeOperationResultStatusSucceeded ... + CalculateExchangeOperationResultStatusSucceeded CalculateExchangeOperationResultStatus = "Succeeded" +) + +// PossibleCalculateExchangeOperationResultStatusValues returns an array of possible values for the CalculateExchangeOperationResultStatus const type. +func PossibleCalculateExchangeOperationResultStatusValues() []CalculateExchangeOperationResultStatus { + return []CalculateExchangeOperationResultStatus{CalculateExchangeOperationResultStatusCancelled, CalculateExchangeOperationResultStatusFailed, CalculateExchangeOperationResultStatusPending, CalculateExchangeOperationResultStatusSucceeded} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// ErrorResponseCode enumerates the values for error response code. +type ErrorResponseCode string + +const ( + // ErrorResponseCodeActivateQuoteFailed ... + ErrorResponseCodeActivateQuoteFailed ErrorResponseCode = "ActivateQuoteFailed" + // ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount ... + ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount ErrorResponseCode = "AppliedScopesNotAssociatedWithCommerceAccount" + // ErrorResponseCodeAppliedScopesSameAsExisting ... + ErrorResponseCodeAppliedScopesSameAsExisting ErrorResponseCode = "AppliedScopesSameAsExisting" + // ErrorResponseCodeAuthorizationFailed ... + ErrorResponseCodeAuthorizationFailed ErrorResponseCode = "AuthorizationFailed" + // ErrorResponseCodeBadRequest ... + ErrorResponseCodeBadRequest ErrorResponseCode = "BadRequest" + // ErrorResponseCodeBillingCustomerInputError ... + ErrorResponseCodeBillingCustomerInputError ErrorResponseCode = "BillingCustomerInputError" + // ErrorResponseCodeBillingError ... + ErrorResponseCodeBillingError ErrorResponseCode = "BillingError" + // ErrorResponseCodeBillingPaymentInstrumentHardError ... + ErrorResponseCodeBillingPaymentInstrumentHardError ErrorResponseCode = "BillingPaymentInstrumentHardError" + // ErrorResponseCodeBillingPaymentInstrumentSoftError ... + ErrorResponseCodeBillingPaymentInstrumentSoftError ErrorResponseCode = "BillingPaymentInstrumentSoftError" + // ErrorResponseCodeBillingScopeIDCannotBeChanged ... + ErrorResponseCodeBillingScopeIDCannotBeChanged ErrorResponseCode = "BillingScopeIdCannotBeChanged" + // ErrorResponseCodeBillingTransientError ... + ErrorResponseCodeBillingTransientError ErrorResponseCode = "BillingTransientError" + // ErrorResponseCodeCalculatePriceFailed ... + ErrorResponseCodeCalculatePriceFailed ErrorResponseCode = "CalculatePriceFailed" + // ErrorResponseCodeCapacityUpdateScopesFailed ... + ErrorResponseCodeCapacityUpdateScopesFailed ErrorResponseCode = "CapacityUpdateScopesFailed" + // ErrorResponseCodeClientCertificateThumbprintNotSet ... + ErrorResponseCodeClientCertificateThumbprintNotSet ErrorResponseCode = "ClientCertificateThumbprintNotSet" + // ErrorResponseCodeCreateQuoteFailed ... + ErrorResponseCodeCreateQuoteFailed ErrorResponseCode = "CreateQuoteFailed" + // ErrorResponseCodeForbidden ... + ErrorResponseCodeForbidden ErrorResponseCode = "Forbidden" + // ErrorResponseCodeFulfillmentConfigurationError ... + ErrorResponseCodeFulfillmentConfigurationError ErrorResponseCode = "FulfillmentConfigurationError" + // ErrorResponseCodeFulfillmentError ... + ErrorResponseCodeFulfillmentError ErrorResponseCode = "FulfillmentError" + // ErrorResponseCodeFulfillmentOutOfStockError ... + ErrorResponseCodeFulfillmentOutOfStockError ErrorResponseCode = "FulfillmentOutOfStockError" + // ErrorResponseCodeFulfillmentTransientError ... + ErrorResponseCodeFulfillmentTransientError ErrorResponseCode = "FulfillmentTransientError" + // ErrorResponseCodeHTTPMethodNotSupported ... + ErrorResponseCodeHTTPMethodNotSupported ErrorResponseCode = "HttpMethodNotSupported" + // ErrorResponseCodeInternalServerError ... + ErrorResponseCodeInternalServerError ErrorResponseCode = "InternalServerError" + // ErrorResponseCodeInvalidAccessToken ... + ErrorResponseCodeInvalidAccessToken ErrorResponseCode = "InvalidAccessToken" + // ErrorResponseCodeInvalidFulfillmentRequestParameters ... + ErrorResponseCodeInvalidFulfillmentRequestParameters ErrorResponseCode = "InvalidFulfillmentRequestParameters" + // ErrorResponseCodeInvalidHealthCheckType ... + ErrorResponseCodeInvalidHealthCheckType ErrorResponseCode = "InvalidHealthCheckType" + // ErrorResponseCodeInvalidLocationID ... + ErrorResponseCodeInvalidLocationID ErrorResponseCode = "InvalidLocationId" + // ErrorResponseCodeInvalidRefundQuantity ... + ErrorResponseCodeInvalidRefundQuantity ErrorResponseCode = "InvalidRefundQuantity" + // ErrorResponseCodeInvalidRequestContent ... + ErrorResponseCodeInvalidRequestContent ErrorResponseCode = "InvalidRequestContent" + // ErrorResponseCodeInvalidRequestURI ... + ErrorResponseCodeInvalidRequestURI ErrorResponseCode = "InvalidRequestUri" + // ErrorResponseCodeInvalidReservationID ... + ErrorResponseCodeInvalidReservationID ErrorResponseCode = "InvalidReservationId" + // ErrorResponseCodeInvalidReservationOrderID ... + ErrorResponseCodeInvalidReservationOrderID ErrorResponseCode = "InvalidReservationOrderId" + // ErrorResponseCodeInvalidSingleAppliedScopesCount ... + ErrorResponseCodeInvalidSingleAppliedScopesCount ErrorResponseCode = "InvalidSingleAppliedScopesCount" + // ErrorResponseCodeInvalidSubscriptionID ... + ErrorResponseCodeInvalidSubscriptionID ErrorResponseCode = "InvalidSubscriptionId" + // ErrorResponseCodeInvalidTenantID ... + ErrorResponseCodeInvalidTenantID ErrorResponseCode = "InvalidTenantId" + // ErrorResponseCodeMissingAppliedScopesForSingle ... + ErrorResponseCodeMissingAppliedScopesForSingle ErrorResponseCode = "MissingAppliedScopesForSingle" + // ErrorResponseCodeMissingTenantID ... + ErrorResponseCodeMissingTenantID ErrorResponseCode = "MissingTenantId" + // ErrorResponseCodeNonsupportedAccountID ... + ErrorResponseCodeNonsupportedAccountID ErrorResponseCode = "NonsupportedAccountId" + // ErrorResponseCodeNotSpecified ... + ErrorResponseCodeNotSpecified ErrorResponseCode = "NotSpecified" + // ErrorResponseCodeNotSupportedCountry ... + ErrorResponseCodeNotSupportedCountry ErrorResponseCode = "NotSupportedCountry" + // ErrorResponseCodeNoValidReservationsToReRate ... + ErrorResponseCodeNoValidReservationsToReRate ErrorResponseCode = "NoValidReservationsToReRate" + // ErrorResponseCodeOperationCannotBePerformedInCurrentState ... + ErrorResponseCodeOperationCannotBePerformedInCurrentState ErrorResponseCode = "OperationCannotBePerformedInCurrentState" + // ErrorResponseCodeOperationFailed ... + ErrorResponseCodeOperationFailed ErrorResponseCode = "OperationFailed" + // ErrorResponseCodePatchValuesSameAsExisting ... + ErrorResponseCodePatchValuesSameAsExisting ErrorResponseCode = "PatchValuesSameAsExisting" + // ErrorResponseCodePaymentInstrumentNotFound ... + ErrorResponseCodePaymentInstrumentNotFound ErrorResponseCode = "PaymentInstrumentNotFound" + // ErrorResponseCodePurchaseError ... + ErrorResponseCodePurchaseError ErrorResponseCode = "PurchaseError" + // ErrorResponseCodeReRateOnlyAllowedForEA ... + ErrorResponseCodeReRateOnlyAllowedForEA ErrorResponseCode = "ReRateOnlyAllowedForEA" + // ErrorResponseCodeReservationIDNotInReservationOrder ... + ErrorResponseCodeReservationIDNotInReservationOrder ErrorResponseCode = "ReservationIdNotInReservationOrder" + // ErrorResponseCodeReservationOrderCreationFailed ... + ErrorResponseCodeReservationOrderCreationFailed ErrorResponseCode = "ReservationOrderCreationFailed" + // ErrorResponseCodeReservationOrderIDAlreadyExists ... + ErrorResponseCodeReservationOrderIDAlreadyExists ErrorResponseCode = "ReservationOrderIdAlreadyExists" + // ErrorResponseCodeReservationOrderNotEnabled ... + ErrorResponseCodeReservationOrderNotEnabled ErrorResponseCode = "ReservationOrderNotEnabled" + // ErrorResponseCodeReservationOrderNotFound ... + ErrorResponseCodeReservationOrderNotFound ErrorResponseCode = "ReservationOrderNotFound" + // ErrorResponseCodeRiskCheckFailed ... + ErrorResponseCodeRiskCheckFailed ErrorResponseCode = "RiskCheckFailed" + // ErrorResponseCodeRoleAssignmentCreationFailed ... + ErrorResponseCodeRoleAssignmentCreationFailed ErrorResponseCode = "RoleAssignmentCreationFailed" + // ErrorResponseCodeServerTimeout ... + ErrorResponseCodeServerTimeout ErrorResponseCode = "ServerTimeout" + // ErrorResponseCodeUnauthenticatedRequestsThrottled ... + ErrorResponseCodeUnauthenticatedRequestsThrottled ErrorResponseCode = "UnauthenticatedRequestsThrottled" + // ErrorResponseCodeUnsupportedReservationTerm ... + ErrorResponseCodeUnsupportedReservationTerm ErrorResponseCode = "UnsupportedReservationTerm" +) + +// PossibleErrorResponseCodeValues returns an array of possible values for the ErrorResponseCode const type. +func PossibleErrorResponseCodeValues() []ErrorResponseCode { + return []ErrorResponseCode{ErrorResponseCodeActivateQuoteFailed, ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount, ErrorResponseCodeAppliedScopesSameAsExisting, ErrorResponseCodeAuthorizationFailed, ErrorResponseCodeBadRequest, ErrorResponseCodeBillingCustomerInputError, ErrorResponseCodeBillingError, ErrorResponseCodeBillingPaymentInstrumentHardError, ErrorResponseCodeBillingPaymentInstrumentSoftError, ErrorResponseCodeBillingScopeIDCannotBeChanged, ErrorResponseCodeBillingTransientError, ErrorResponseCodeCalculatePriceFailed, ErrorResponseCodeCapacityUpdateScopesFailed, ErrorResponseCodeClientCertificateThumbprintNotSet, ErrorResponseCodeCreateQuoteFailed, ErrorResponseCodeForbidden, ErrorResponseCodeFulfillmentConfigurationError, ErrorResponseCodeFulfillmentError, ErrorResponseCodeFulfillmentOutOfStockError, ErrorResponseCodeFulfillmentTransientError, ErrorResponseCodeHTTPMethodNotSupported, ErrorResponseCodeInternalServerError, ErrorResponseCodeInvalidAccessToken, ErrorResponseCodeInvalidFulfillmentRequestParameters, ErrorResponseCodeInvalidHealthCheckType, ErrorResponseCodeInvalidLocationID, ErrorResponseCodeInvalidRefundQuantity, ErrorResponseCodeInvalidRequestContent, ErrorResponseCodeInvalidRequestURI, ErrorResponseCodeInvalidReservationID, ErrorResponseCodeInvalidReservationOrderID, ErrorResponseCodeInvalidSingleAppliedScopesCount, ErrorResponseCodeInvalidSubscriptionID, ErrorResponseCodeInvalidTenantID, ErrorResponseCodeMissingAppliedScopesForSingle, ErrorResponseCodeMissingTenantID, ErrorResponseCodeNonsupportedAccountID, ErrorResponseCodeNotSpecified, ErrorResponseCodeNotSupportedCountry, ErrorResponseCodeNoValidReservationsToReRate, ErrorResponseCodeOperationCannotBePerformedInCurrentState, ErrorResponseCodeOperationFailed, ErrorResponseCodePatchValuesSameAsExisting, ErrorResponseCodePaymentInstrumentNotFound, ErrorResponseCodePurchaseError, ErrorResponseCodeReRateOnlyAllowedForEA, ErrorResponseCodeReservationIDNotInReservationOrder, ErrorResponseCodeReservationOrderCreationFailed, ErrorResponseCodeReservationOrderIDAlreadyExists, ErrorResponseCodeReservationOrderNotEnabled, ErrorResponseCodeReservationOrderNotFound, ErrorResponseCodeRiskCheckFailed, ErrorResponseCodeRoleAssignmentCreationFailed, ErrorResponseCodeServerTimeout, ErrorResponseCodeUnauthenticatedRequestsThrottled, ErrorResponseCodeUnsupportedReservationTerm} +} + +// ExchangeOperationResultStatus enumerates the values for exchange operation result status. +type ExchangeOperationResultStatus string + +const ( + // ExchangeOperationResultStatusCancelled ... + ExchangeOperationResultStatusCancelled ExchangeOperationResultStatus = "Cancelled" + // ExchangeOperationResultStatusFailed ... + ExchangeOperationResultStatusFailed ExchangeOperationResultStatus = "Failed" + // ExchangeOperationResultStatusPendingPurchases ... + ExchangeOperationResultStatusPendingPurchases ExchangeOperationResultStatus = "PendingPurchases" + // ExchangeOperationResultStatusPendingRefunds ... + ExchangeOperationResultStatusPendingRefunds ExchangeOperationResultStatus = "PendingRefunds" + // ExchangeOperationResultStatusSucceeded ... + ExchangeOperationResultStatusSucceeded ExchangeOperationResultStatus = "Succeeded" +) + +// PossibleExchangeOperationResultStatusValues returns an array of possible values for the ExchangeOperationResultStatus const type. +func PossibleExchangeOperationResultStatusValues() []ExchangeOperationResultStatus { + return []ExchangeOperationResultStatus{ExchangeOperationResultStatusCancelled, ExchangeOperationResultStatusFailed, ExchangeOperationResultStatusPendingPurchases, ExchangeOperationResultStatusPendingRefunds, ExchangeOperationResultStatusSucceeded} +} + +// InstanceFlexibility enumerates the values for instance flexibility. +type InstanceFlexibility string + +const ( + // InstanceFlexibilityOff ... + InstanceFlexibilityOff InstanceFlexibility = "Off" + // InstanceFlexibilityOn ... + InstanceFlexibilityOn InstanceFlexibility = "On" +) + +// PossibleInstanceFlexibilityValues returns an array of possible values for the InstanceFlexibility const type. +func PossibleInstanceFlexibilityValues() []InstanceFlexibility { + return []InstanceFlexibility{InstanceFlexibilityOff, InstanceFlexibilityOn} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindMicrosoftCompute ... + KindMicrosoftCompute Kind = "Microsoft.Compute" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindMicrosoftCompute} +} + +// OperationStatus enumerates the values for operation status. +type OperationStatus string + +const ( + // OperationStatusCancelled ... + OperationStatusCancelled OperationStatus = "Cancelled" + // OperationStatusFailed ... + OperationStatusFailed OperationStatus = "Failed" + // OperationStatusPending ... + OperationStatusPending OperationStatus = "Pending" + // OperationStatusSucceeded ... + OperationStatusSucceeded OperationStatus = "Succeeded" +) + +// PossibleOperationStatusValues returns an array of possible values for the OperationStatus const type. +func PossibleOperationStatusValues() []OperationStatus { + return []OperationStatus{OperationStatusCancelled, OperationStatusFailed, OperationStatusPending, OperationStatusSucceeded} +} + +// PaymentStatus enumerates the values for payment status. +type PaymentStatus string + +const ( + // PaymentStatusCancelled ... + PaymentStatusCancelled PaymentStatus = "Cancelled" + // PaymentStatusFailed ... + PaymentStatusFailed PaymentStatus = "Failed" + // PaymentStatusScheduled ... + PaymentStatusScheduled PaymentStatus = "Scheduled" + // PaymentStatusSucceeded ... + PaymentStatusSucceeded PaymentStatus = "Succeeded" +) + +// PossiblePaymentStatusValues returns an array of possible values for the PaymentStatus const type. +func PossiblePaymentStatusValues() []PaymentStatus { + return []PaymentStatus{PaymentStatusCancelled, PaymentStatusFailed, PaymentStatusScheduled, PaymentStatusSucceeded} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateBillingFailed ... + ProvisioningStateBillingFailed ProvisioningState = "BillingFailed" + // ProvisioningStateCancelled ... + ProvisioningStateCancelled ProvisioningState = "Cancelled" + // ProvisioningStateConfirmedBilling ... + ProvisioningStateConfirmedBilling ProvisioningState = "ConfirmedBilling" + // ProvisioningStateConfirmedResourceHold ... + ProvisioningStateConfirmedResourceHold ProvisioningState = "ConfirmedResourceHold" + // ProvisioningStateCreated ... + ProvisioningStateCreated ProvisioningState = "Created" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateExpired ... + ProvisioningStateExpired ProvisioningState = "Expired" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMerged ... + ProvisioningStateMerged ProvisioningState = "Merged" + // ProvisioningStatePendingBilling ... + ProvisioningStatePendingBilling ProvisioningState = "PendingBilling" + // ProvisioningStatePendingResourceHold ... + ProvisioningStatePendingResourceHold ProvisioningState = "PendingResourceHold" + // ProvisioningStateSplit ... + ProvisioningStateSplit ProvisioningState = "Split" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateBillingFailed, ProvisioningStateCancelled, ProvisioningStateConfirmedBilling, ProvisioningStateConfirmedResourceHold, ProvisioningStateCreated, ProvisioningStateCreating, ProvisioningStateExpired, ProvisioningStateFailed, ProvisioningStateMerged, ProvisioningStatePendingBilling, ProvisioningStatePendingResourceHold, ProvisioningStateSplit, ProvisioningStateSucceeded} +} + +// ProvisioningState1 enumerates the values for provisioning state 1. +type ProvisioningState1 string + +const ( + // ProvisioningState1BillingFailed ... + ProvisioningState1BillingFailed ProvisioningState1 = "BillingFailed" + // ProvisioningState1Cancelled ... + ProvisioningState1Cancelled ProvisioningState1 = "Cancelled" + // ProvisioningState1ConfirmedBilling ... + ProvisioningState1ConfirmedBilling ProvisioningState1 = "ConfirmedBilling" + // ProvisioningState1ConfirmedResourceHold ... + ProvisioningState1ConfirmedResourceHold ProvisioningState1 = "ConfirmedResourceHold" + // ProvisioningState1Created ... + ProvisioningState1Created ProvisioningState1 = "Created" + // ProvisioningState1Creating ... + ProvisioningState1Creating ProvisioningState1 = "Creating" + // ProvisioningState1Expired ... + ProvisioningState1Expired ProvisioningState1 = "Expired" + // ProvisioningState1Failed ... + ProvisioningState1Failed ProvisioningState1 = "Failed" + // ProvisioningState1Merged ... + ProvisioningState1Merged ProvisioningState1 = "Merged" + // ProvisioningState1PendingBilling ... + ProvisioningState1PendingBilling ProvisioningState1 = "PendingBilling" + // ProvisioningState1PendingResourceHold ... + ProvisioningState1PendingResourceHold ProvisioningState1 = "PendingResourceHold" + // ProvisioningState1Split ... + ProvisioningState1Split ProvisioningState1 = "Split" + // ProvisioningState1Succeeded ... + ProvisioningState1Succeeded ProvisioningState1 = "Succeeded" +) + +// PossibleProvisioningState1Values returns an array of possible values for the ProvisioningState1 const type. +func PossibleProvisioningState1Values() []ProvisioningState1 { + return []ProvisioningState1{ProvisioningState1BillingFailed, ProvisioningState1Cancelled, ProvisioningState1ConfirmedBilling, ProvisioningState1ConfirmedResourceHold, ProvisioningState1Created, ProvisioningState1Creating, ProvisioningState1Expired, ProvisioningState1Failed, ProvisioningState1Merged, ProvisioningState1PendingBilling, ProvisioningState1PendingResourceHold, ProvisioningState1Split, ProvisioningState1Succeeded} +} + +// QuotaRequestState enumerates the values for quota request state. +type QuotaRequestState string + +const ( + // QuotaRequestStateAccepted ... + QuotaRequestStateAccepted QuotaRequestState = "Accepted" + // QuotaRequestStateFailed ... + QuotaRequestStateFailed QuotaRequestState = "Failed" + // QuotaRequestStateInProgress ... + QuotaRequestStateInProgress QuotaRequestState = "InProgress" + // QuotaRequestStateInvalid ... + QuotaRequestStateInvalid QuotaRequestState = "Invalid" + // QuotaRequestStateSucceeded ... + QuotaRequestStateSucceeded QuotaRequestState = "Succeeded" +) + +// PossibleQuotaRequestStateValues returns an array of possible values for the QuotaRequestState const type. +func PossibleQuotaRequestStateValues() []QuotaRequestState { + return []QuotaRequestState{QuotaRequestStateAccepted, QuotaRequestStateFailed, QuotaRequestStateInProgress, QuotaRequestStateInvalid, QuotaRequestStateSucceeded} +} + +// ReservationBillingPlan enumerates the values for reservation billing plan. +type ReservationBillingPlan string + +const ( + // ReservationBillingPlanMonthly ... + ReservationBillingPlanMonthly ReservationBillingPlan = "Monthly" + // ReservationBillingPlanUpfront ... + ReservationBillingPlanUpfront ReservationBillingPlan = "Upfront" +) + +// PossibleReservationBillingPlanValues returns an array of possible values for the ReservationBillingPlan const type. +func PossibleReservationBillingPlanValues() []ReservationBillingPlan { + return []ReservationBillingPlan{ReservationBillingPlanMonthly, ReservationBillingPlanUpfront} +} + +// ReservationTerm enumerates the values for reservation term. +type ReservationTerm string + +const ( + // ReservationTermP1Y ... + ReservationTermP1Y ReservationTerm = "P1Y" + // ReservationTermP3Y ... + ReservationTermP3Y ReservationTerm = "P3Y" + // ReservationTermP5Y ... + ReservationTermP5Y ReservationTerm = "P5Y" +) + +// PossibleReservationTermValues returns an array of possible values for the ReservationTerm const type. +func PossibleReservationTermValues() []ReservationTerm { + return []ReservationTerm{ReservationTermP1Y, ReservationTermP3Y, ReservationTermP5Y} +} + +// ReservedResourceType enumerates the values for reserved resource type. +type ReservedResourceType string + +const ( + // ReservedResourceTypeAppService ... + ReservedResourceTypeAppService ReservedResourceType = "AppService" + // ReservedResourceTypeAVS ... + ReservedResourceTypeAVS ReservedResourceType = "AVS" + // ReservedResourceTypeAzureDataExplorer ... + ReservedResourceTypeAzureDataExplorer ReservedResourceType = "AzureDataExplorer" + // ReservedResourceTypeAzureFiles ... + ReservedResourceTypeAzureFiles ReservedResourceType = "AzureFiles" + // ReservedResourceTypeBlockBlob ... + ReservedResourceTypeBlockBlob ReservedResourceType = "BlockBlob" + // ReservedResourceTypeCosmosDb ... + ReservedResourceTypeCosmosDb ReservedResourceType = "CosmosDb" + // ReservedResourceTypeDatabricks ... + ReservedResourceTypeDatabricks ReservedResourceType = "Databricks" + // ReservedResourceTypeDataFactory ... + ReservedResourceTypeDataFactory ReservedResourceType = "DataFactory" + // ReservedResourceTypeDedicatedHost ... + ReservedResourceTypeDedicatedHost ReservedResourceType = "DedicatedHost" + // ReservedResourceTypeManagedDisk ... + ReservedResourceTypeManagedDisk ReservedResourceType = "ManagedDisk" + // ReservedResourceTypeMariaDb ... + ReservedResourceTypeMariaDb ReservedResourceType = "MariaDb" + // ReservedResourceTypeMySQL ... + ReservedResourceTypeMySQL ReservedResourceType = "MySql" + // ReservedResourceTypeNetAppStorage ... + ReservedResourceTypeNetAppStorage ReservedResourceType = "NetAppStorage" + // ReservedResourceTypePostgreSQL ... + ReservedResourceTypePostgreSQL ReservedResourceType = "PostgreSql" + // ReservedResourceTypeRedHat ... + ReservedResourceTypeRedHat ReservedResourceType = "RedHat" + // ReservedResourceTypeRedHatOsa ... + ReservedResourceTypeRedHatOsa ReservedResourceType = "RedHatOsa" + // ReservedResourceTypeRedisCache ... + ReservedResourceTypeRedisCache ReservedResourceType = "RedisCache" + // ReservedResourceTypeSapHana ... + ReservedResourceTypeSapHana ReservedResourceType = "SapHana" + // ReservedResourceTypeSQLAzureHybridBenefit ... + ReservedResourceTypeSQLAzureHybridBenefit ReservedResourceType = "SqlAzureHybridBenefit" + // ReservedResourceTypeSQLDatabases ... + ReservedResourceTypeSQLDatabases ReservedResourceType = "SqlDatabases" + // ReservedResourceTypeSQLDataWarehouse ... + ReservedResourceTypeSQLDataWarehouse ReservedResourceType = "SqlDataWarehouse" + // ReservedResourceTypeSQLEdge ... + ReservedResourceTypeSQLEdge ReservedResourceType = "SqlEdge" + // ReservedResourceTypeSuseLinux ... + ReservedResourceTypeSuseLinux ReservedResourceType = "SuseLinux" + // ReservedResourceTypeVirtualMachines ... + ReservedResourceTypeVirtualMachines ReservedResourceType = "VirtualMachines" + // ReservedResourceTypeVirtualMachineSoftware ... + ReservedResourceTypeVirtualMachineSoftware ReservedResourceType = "VirtualMachineSoftware" + // ReservedResourceTypeVMwareCloudSimple ... + ReservedResourceTypeVMwareCloudSimple ReservedResourceType = "VMwareCloudSimple" +) + +// PossibleReservedResourceTypeValues returns an array of possible values for the ReservedResourceType const type. +func PossibleReservedResourceTypeValues() []ReservedResourceType { + return []ReservedResourceType{ReservedResourceTypeAppService, ReservedResourceTypeAVS, ReservedResourceTypeAzureDataExplorer, ReservedResourceTypeAzureFiles, ReservedResourceTypeBlockBlob, ReservedResourceTypeCosmosDb, ReservedResourceTypeDatabricks, ReservedResourceTypeDataFactory, ReservedResourceTypeDedicatedHost, ReservedResourceTypeManagedDisk, ReservedResourceTypeMariaDb, ReservedResourceTypeMySQL, ReservedResourceTypeNetAppStorage, ReservedResourceTypePostgreSQL, ReservedResourceTypeRedHat, ReservedResourceTypeRedHatOsa, ReservedResourceTypeRedisCache, ReservedResourceTypeSapHana, ReservedResourceTypeSQLAzureHybridBenefit, ReservedResourceTypeSQLDatabases, ReservedResourceTypeSQLDataWarehouse, ReservedResourceTypeSQLEdge, ReservedResourceTypeSuseLinux, ReservedResourceTypeVirtualMachines, ReservedResourceTypeVirtualMachineSoftware, ReservedResourceTypeVMwareCloudSimple} +} + +// ResourceType enumerates the values for resource type. +type ResourceType string + +const ( + // ResourceTypeDedicated ... + ResourceTypeDedicated ResourceType = "dedicated" + // ResourceTypeLowPriority ... + ResourceTypeLowPriority ResourceType = "lowPriority" + // ResourceTypeServiceSpecific ... + ResourceTypeServiceSpecific ResourceType = "serviceSpecific" + // ResourceTypeShared ... + ResourceTypeShared ResourceType = "shared" + // ResourceTypeStandard ... + ResourceTypeStandard ResourceType = "standard" +) + +// PossibleResourceTypeValues returns an array of possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ResourceTypeDedicated, ResourceTypeLowPriority, ResourceTypeServiceSpecific, ResourceTypeShared, ResourceTypeStandard} +} + +// StatusCode enumerates the values for status code. +type StatusCode string + +const ( + // StatusCodeActive ... + StatusCodeActive StatusCode = "Active" + // StatusCodeExpired ... + StatusCodeExpired StatusCode = "Expired" + // StatusCodeMerged ... + StatusCodeMerged StatusCode = "Merged" + // StatusCodeNone ... + StatusCodeNone StatusCode = "None" + // StatusCodePaymentInstrumentError ... + StatusCodePaymentInstrumentError StatusCode = "PaymentInstrumentError" + // StatusCodePending ... + StatusCodePending StatusCode = "Pending" + // StatusCodeProcessing ... + StatusCodeProcessing StatusCode = "Processing" + // StatusCodePurchaseError ... + StatusCodePurchaseError StatusCode = "PurchaseError" + // StatusCodeSplit ... + StatusCodeSplit StatusCode = "Split" + // StatusCodeSucceeded ... + StatusCodeSucceeded StatusCode = "Succeeded" +) + +// PossibleStatusCodeValues returns an array of possible values for the StatusCode const type. +func PossibleStatusCodeValues() []StatusCode { + return []StatusCode{StatusCodeActive, StatusCodeExpired, StatusCodeMerged, StatusCodeNone, StatusCodePaymentInstrumentError, StatusCodePending, StatusCodeProcessing, StatusCodePurchaseError, StatusCodeSplit, StatusCodeSucceeded} +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/exchange.go b/services/reservations/mgmt/2022-03-01/reservations/exchange.go new file mode 100644 index 000000000000..3d532ca685e2 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/exchange.go @@ -0,0 +1,105 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ExchangeClient is the client for the Exchange methods of the Reservations service. +type ExchangeClient struct { + BaseClient +} + +// NewExchangeClient creates an instance of the ExchangeClient client. +func NewExchangeClient() ExchangeClient { + return NewExchangeClientWithBaseURI(DefaultBaseURI) +} + +// NewExchangeClientWithBaseURI creates an instance of the ExchangeClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewExchangeClientWithBaseURI(baseURI string) ExchangeClient { + return ExchangeClient{NewWithBaseURI(baseURI)} +} + +// Post returns one or more `Reservations` in exchange for one or more `Reservation` purchases. +// Parameters: +// body - request containing the refunds and purchases that need to be executed. +func (client ExchangeClient) Post(ctx context.Context, body ExchangeRequest) (result ExchangePostFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExchangeClient.Post") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PostPreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ExchangeClient", "Post", nil, "Failure preparing request") + return + } + + result, err = client.PostSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ExchangeClient", "Post", result.Response(), "Failure sending request") + return + } + + return +} + +// PostPreparer prepares the Post request. +func (client ExchangeClient) PostPreparer(ctx context.Context, body ExchangeRequest) (*http.Request, error) { + const APIVersion = "2022-03-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.WithPath("/providers/Microsoft.Capacity/exchange"), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PostSender sends the Post request. The method will close the +// http.Response Body if it receives an error. +func (client ExchangeClient) PostSender(req *http.Request) (future ExchangePostFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PostResponder handles the response to the Post request. The method always +// closes the http.Response Body. +func (client ExchangeClient) PostResponder(resp *http.Response) (result ExchangeOperationResultResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/models.go b/services/reservations/mgmt/2022-03-01/reservations/models.go new file mode 100644 index 000000000000..622e68dfdc22 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/models.go @@ -0,0 +1,3119 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations" + +// AppliedReservationList ... +type AppliedReservationList struct { + Value *[]string `json:"value,omitempty"` + // NextLink - Url to get the next page of reservations + NextLink *string `json:"nextLink,omitempty"` +} + +// AppliedReservations ... +type AppliedReservations struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Identifier of the applied reservations + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/AppliedReservations" + Type *string `json:"type,omitempty"` + *AppliedReservationsProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AppliedReservations. +func (ar AppliedReservations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ar.AppliedReservationsProperties != nil { + objectMap["properties"] = ar.AppliedReservationsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AppliedReservations struct. +func (ar *AppliedReservations) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ar.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ar.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ar.Type = &typeVar + } + case "properties": + if v != nil { + var appliedReservationsProperties AppliedReservationsProperties + err = json.Unmarshal(*v, &appliedReservationsProperties) + if err != nil { + return err + } + ar.AppliedReservationsProperties = &appliedReservationsProperties + } + } + } + + return nil +} + +// AppliedReservationsProperties ... +type AppliedReservationsProperties struct { + ReservationOrderIds *AppliedReservationList `json:"reservationOrderIds,omitempty"` +} + +// AvailableScopeProperties ... +type AvailableScopeProperties struct { + autorest.Response `json:"-"` + Properties *SubscriptionScopeProperties `json:"properties,omitempty"` +} + +// AvailableScopeRequest available scope +type AvailableScopeRequest struct { + Properties *AvailableScopeRequestProperties `json:"properties,omitempty"` +} + +// AvailableScopeRequestProperties available scope request properties +type AvailableScopeRequestProperties struct { + Scopes *[]string `json:"scopes,omitempty"` +} + +// BillingInformation billing information +type BillingInformation struct { + BillingCurrencyTotalPaidAmount *Price `json:"billingCurrencyTotalPaidAmount,omitempty"` + BillingCurrencyProratedAmount *Price `json:"billingCurrencyProratedAmount,omitempty"` + BillingCurrencyRemainingCommitmentAmount *Price `json:"billingCurrencyRemainingCommitmentAmount,omitempty"` +} + +// CalculateExchangeOperationResultResponse calculateExchange operation result +type CalculateExchangeOperationResultResponse struct { + autorest.Response `json:"-"` + // ID - It should match what is used to GET the operation result. + ID *string `json:"id,omitempty"` + // Name - It must match the last segment of the id field, and will typically be a GUID / system generated value. + Name *string `json:"name,omitempty"` + // Status - Status of the operation. Possible values include: 'CalculateExchangeOperationResultStatusSucceeded', 'CalculateExchangeOperationResultStatusFailed', 'CalculateExchangeOperationResultStatusCancelled', 'CalculateExchangeOperationResultStatusPending' + Status CalculateExchangeOperationResultStatus `json:"status,omitempty"` + Properties *CalculateExchangeResponseProperties `json:"properties,omitempty"` + Error *OperationResultError `json:"error,omitempty"` +} + +// CalculateExchangePostFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CalculateExchangePostFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(CalculateExchangeClient) (CalculateExchangeOperationResultResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CalculateExchangePostFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CalculateExchangePostFuture.Result. +func (future *CalculateExchangePostFuture) result(client CalculateExchangeClient) (ceorr CalculateExchangeOperationResultResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.CalculateExchangePostFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ceorr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.CalculateExchangePostFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ceorr.Response.Response, err = future.GetResult(sender); err == nil && ceorr.Response.Response.StatusCode != http.StatusNoContent { + ceorr, err = client.PostResponder(ceorr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.CalculateExchangePostFuture", "Result", ceorr.Response.Response, "Failure responding to request") + } + } + return +} + +// CalculateExchangeRequest calculate exchange request +type CalculateExchangeRequest struct { + Properties *CalculateExchangeRequestProperties `json:"properties,omitempty"` +} + +// CalculateExchangeRequestProperties calculate exchange request properties +type CalculateExchangeRequestProperties struct { + // ReservationsToPurchase - List of reservations that are being purchased in this exchange. + ReservationsToPurchase *[]PurchaseRequest `json:"reservationsToPurchase,omitempty"` + // ReservationsToExchange - List of reservations that are being returned in this exchange. + ReservationsToExchange *[]ToReturn `json:"reservationsToExchange,omitempty"` +} + +// CalculateExchangeResponseProperties calculateExchange response properties +type CalculateExchangeResponseProperties struct { + // SessionID - Exchange session identifier + SessionID *string `json:"sessionId,omitempty"` + NetPayable *Price `json:"netPayable,omitempty"` + RefundsTotal *Price `json:"refundsTotal,omitempty"` + PurchasesTotal *Price `json:"purchasesTotal,omitempty"` + // ReservationsToPurchase - Details of the reservations being purchased + ReservationsToPurchase *[]ToPurchaseCalculateExchange `json:"reservationsToPurchase,omitempty"` + // ReservationsToExchange - Details of the reservations being returned + ReservationsToExchange *[]ToExchange `json:"reservationsToExchange,omitempty"` + PolicyResult *ExchangePolicyErrors `json:"policyResult,omitempty"` +} + +// CalculatePriceResponse ... +type CalculatePriceResponse struct { + autorest.Response `json:"-"` + Properties *CalculatePriceResponseProperties `json:"properties,omitempty"` +} + +// CalculatePriceResponseProperties ... +type CalculatePriceResponseProperties struct { + // BillingCurrencyTotal - Currency and amount that customer will be charged in customer's local currency. Tax is not included. + BillingCurrencyTotal *CalculatePriceResponsePropertiesBillingCurrencyTotal `json:"billingCurrencyTotal,omitempty"` + // NetTotal - Net total amount in pricing currency. + NetTotal *float64 `json:"netTotal,omitempty"` + // TaxTotal - Tax amount in pricing currency. + TaxTotal *float64 `json:"taxTotal,omitempty"` + // GrandTotal - Total amount in pricing currency. + GrandTotal *float64 `json:"grandTotal,omitempty"` + // IsTaxIncluded - Whether or not tax is included in grand total + IsTaxIncluded *bool `json:"isTaxIncluded,omitempty"` + // IsBillingPartnerManaged - True if billing is managed by Microsoft Partner. Used only for CSP accounts. + IsBillingPartnerManaged *bool `json:"isBillingPartnerManaged,omitempty"` + // ReservationOrderID - GUID that represents reservation order that can be placed after calculating price. + ReservationOrderID *string `json:"reservationOrderId,omitempty"` + // SkuTitle - Title of SKU that is being purchased. + SkuTitle *string `json:"skuTitle,omitempty"` + // SkuDescription - Description of SKU that is being purchased. + SkuDescription *string `json:"skuDescription,omitempty"` + // PricingCurrencyTotal - Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. + PricingCurrencyTotal *CalculatePriceResponsePropertiesPricingCurrencyTotal `json:"pricingCurrencyTotal,omitempty"` + PaymentSchedule *[]PaymentDetail `json:"paymentSchedule,omitempty"` +} + +// CalculatePriceResponsePropertiesBillingCurrencyTotal currency and amount that customer will be charged +// in customer's local currency. Tax is not included. +type CalculatePriceResponsePropertiesBillingCurrencyTotal struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + // Amount - Amount in pricing currency. Tax is not included. + Amount *float64 `json:"amount,omitempty"` +} + +// CalculatePriceResponsePropertiesPricingCurrencyTotal amount that Microsoft uses for record. Used during +// refund for calculating refund limit. Tax is not included. +type CalculatePriceResponsePropertiesPricingCurrencyTotal struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + Amount *float64 `json:"amount,omitempty"` +} + +// Catalog ... +type Catalog struct { + // ResourceType - READ-ONLY; The type of resource the SKU applies to. + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY; The name of SKU + Name *string `json:"name,omitempty"` + // BillingPlans - The billing plan options available for this SKU. + BillingPlans map[string][]ReservationBillingPlan `json:"billingPlans"` + // Terms - READ-ONLY; Available reservation terms for this resource + Terms *[]ReservationTerm `json:"terms,omitempty"` + // Locations - READ-ONLY + Locations *[]string `json:"locations,omitempty"` + // SkuProperties - READ-ONLY + SkuProperties *[]SkuProperty `json:"skuProperties,omitempty"` + // Msrp - READ-ONLY; Pricing information about the SKU + Msrp *CatalogMsrp `json:"msrp,omitempty"` + // Restrictions - READ-ONLY + Restrictions *[]SkuRestriction `json:"restrictions,omitempty"` + // Tier - READ-ONLY; The tier of this SKU + Tier *string `json:"tier,omitempty"` + // Size - READ-ONLY; The size of this SKU + Size *string `json:"size,omitempty"` + // Capabilities - READ-ONLY + Capabilities *[]SkuCapability `json:"capabilities,omitempty"` +} + +// MarshalJSON is the custom marshaler for Catalog. +func (c Catalog) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.BillingPlans != nil { + objectMap["billingPlans"] = c.BillingPlans + } + return json.Marshal(objectMap) +} + +// CatalogMsrp pricing information about the SKU +type CatalogMsrp struct { + // P1Y - Amount in pricing currency. Tax not included. + P1Y *Price `json:"p1Y,omitempty"` +} + +// ChangeDirectoryRequest ... +type ChangeDirectoryRequest struct { + // DestinationTenantID - Tenant id GUID that reservation order is to be transferred to + DestinationTenantID *string `json:"destinationTenantId,omitempty"` +} + +// ChangeDirectoryResponse change directory response +type ChangeDirectoryResponse struct { + autorest.Response `json:"-"` + ReservationOrder *ChangeDirectoryResult `json:"reservationOrder,omitempty"` + ReservationsProperty *[]ChangeDirectoryResult `json:"reservations,omitempty"` +} + +// ChangeDirectoryResult change directory result for reservation order or reservation +type ChangeDirectoryResult struct { + // ID - Identifier of the reservation order or reservation + ID *string `json:"id,omitempty"` + // Name - Name of the reservation order or reservation + Name *string `json:"name,omitempty"` + // IsSucceeded - True if change directory operation succeeded on this reservation order or reservation + IsSucceeded *bool `json:"isSucceeded,omitempty"` + // Error - Error reason if operation failed. Null otherwise + Error *string `json:"error,omitempty"` +} + +// CreateGenericQuotaRequestParameters quota change requests information. +type CreateGenericQuotaRequestParameters struct { + // Value - Quota change requests. + Value *[]CurrentQuotaLimitBase `json:"value,omitempty"` +} + +// CurrentQuotaLimit current quota limits. +type CurrentQuotaLimit struct { + // CurrentQuotaLimitBase - Quota details. + *CurrentQuotaLimitBase `json:"quotaInformation,omitempty"` + // QuotaRequestStatusDetails - Additional properties for the quota status for the resource. + *QuotaRequestStatusDetails `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CurrentQuotaLimit. +func (cql CurrentQuotaLimit) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cql.CurrentQuotaLimitBase != nil { + objectMap["quotaInformation"] = cql.CurrentQuotaLimitBase + } + if cql.QuotaRequestStatusDetails != nil { + objectMap["properties"] = cql.QuotaRequestStatusDetails + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for CurrentQuotaLimit struct. +func (cql *CurrentQuotaLimit) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "quotaInformation": + if v != nil { + var currentQuotaLimitBase CurrentQuotaLimitBase + err = json.Unmarshal(*v, ¤tQuotaLimitBase) + if err != nil { + return err + } + cql.CurrentQuotaLimitBase = ¤tQuotaLimitBase + } + case "properties": + if v != nil { + var quotaRequestStatusDetails QuotaRequestStatusDetails + err = json.Unmarshal(*v, "aRequestStatusDetails) + if err != nil { + return err + } + cql.QuotaRequestStatusDetails = "aRequestStatusDetails + } + } + } + + return nil +} + +// CurrentQuotaLimitBase quota properties. +type CurrentQuotaLimitBase struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The quota request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the quota request. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/ServiceLimits" + Type *string `json:"type,omitempty"` + // Properties - Quota properties for the resource. + Properties *QuotaProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for CurrentQuotaLimitBase. +func (cqlb CurrentQuotaLimitBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cqlb.Properties != nil { + objectMap["properties"] = cqlb.Properties + } + return json.Marshal(objectMap) +} + +// Error ... +type Error struct { + Error *ExtendedErrorInfo `json:"error,omitempty"` +} + +// ErrorDetails the details of the error. +type ErrorDetails struct { + // Code - READ-ONLY; Error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Error message indicating why the operation failed. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The target of the particular error. + Target *string `json:"target,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetails. +func (ed ErrorDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response indicates that the service is not able to process the incoming request. The +// reason is provided in the error message. +type ErrorResponse struct { + // Error - The details of the error. + Error *ErrorDetails `json:"error,omitempty"` +} + +// ExceptionResponse the API error. +type ExceptionResponse struct { + // Error - The API error details. + Error *ServiceError `json:"error,omitempty"` +} + +// ExchangeOperationResultResponse exchange operation result +type ExchangeOperationResultResponse struct { + autorest.Response `json:"-"` + // ID - It should match what is used to GET the operation result. + ID *string `json:"id,omitempty"` + // Name - It must match the last segment of the id field, and will typically be a GUID / system generated value. + Name *string `json:"name,omitempty"` + // Status - Status of the operation. Possible values include: 'ExchangeOperationResultStatusSucceeded', 'ExchangeOperationResultStatusFailed', 'ExchangeOperationResultStatusCancelled', 'ExchangeOperationResultStatusPendingRefunds', 'ExchangeOperationResultStatusPendingPurchases' + Status ExchangeOperationResultStatus `json:"status,omitempty"` + Properties *ExchangeResponseProperties `json:"properties,omitempty"` + Error *OperationResultError `json:"error,omitempty"` +} + +// ExchangePolicyError error details +type ExchangePolicyError struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ExchangePolicyErrors exchange policy errors +type ExchangePolicyErrors struct { + // PolicyErrors - Exchange Policy errors + PolicyErrors *[]ExchangePolicyError `json:"policyErrors,omitempty"` +} + +// ExchangePostFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type ExchangePostFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExchangeClient) (ExchangeOperationResultResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExchangePostFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExchangePostFuture.Result. +func (future *ExchangePostFuture) result(client ExchangeClient) (eorr ExchangeOperationResultResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ExchangePostFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + eorr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.ExchangePostFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if eorr.Response.Response, err = future.GetResult(sender); err == nil && eorr.Response.Response.StatusCode != http.StatusNoContent { + eorr, err = client.PostResponder(eorr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ExchangePostFuture", "Result", eorr.Response.Response, "Failure responding to request") + } + } + return +} + +// ExchangeRequest exchange request +type ExchangeRequest struct { + Properties *ExchangeRequestProperties `json:"properties,omitempty"` +} + +// ExchangeRequestProperties exchange request properties +type ExchangeRequestProperties struct { + // SessionID - SessionId that was returned by CalculateExchange API. + SessionID *string `json:"sessionId,omitempty"` +} + +// ExchangeResponseProperties exchange response properties +type ExchangeResponseProperties struct { + // SessionID - Exchange session identifier + SessionID *string `json:"sessionId,omitempty"` + NetPayable *Price `json:"netPayable,omitempty"` + RefundsTotal *Price `json:"refundsTotal,omitempty"` + PurchasesTotal *Price `json:"purchasesTotal,omitempty"` + // ReservationsToPurchase - Details of the reservations being purchased + ReservationsToPurchase *[]ToPurchaseExchange `json:"reservationsToPurchase,omitempty"` + // ReservationsToExchange - Details of the reservations being returned + ReservationsToExchange *[]ToReturnForExchange `json:"reservationsToExchange,omitempty"` + PolicyResult *ExchangePolicyErrors `json:"policyResult,omitempty"` +} + +// ExtendedErrorInfo ... +type ExtendedErrorInfo struct { + // Code - Possible values include: 'ErrorResponseCodeNotSpecified', 'ErrorResponseCodeInternalServerError', 'ErrorResponseCodeServerTimeout', 'ErrorResponseCodeAuthorizationFailed', 'ErrorResponseCodeBadRequest', 'ErrorResponseCodeClientCertificateThumbprintNotSet', 'ErrorResponseCodeInvalidRequestContent', 'ErrorResponseCodeOperationFailed', 'ErrorResponseCodeHTTPMethodNotSupported', 'ErrorResponseCodeInvalidRequestURI', 'ErrorResponseCodeMissingTenantID', 'ErrorResponseCodeInvalidTenantID', 'ErrorResponseCodeInvalidReservationOrderID', 'ErrorResponseCodeInvalidReservationID', 'ErrorResponseCodeReservationIDNotInReservationOrder', 'ErrorResponseCodeReservationOrderNotFound', 'ErrorResponseCodeInvalidSubscriptionID', 'ErrorResponseCodeInvalidAccessToken', 'ErrorResponseCodeInvalidLocationID', 'ErrorResponseCodeUnauthenticatedRequestsThrottled', 'ErrorResponseCodeInvalidHealthCheckType', 'ErrorResponseCodeForbidden', 'ErrorResponseCodeBillingScopeIDCannotBeChanged', 'ErrorResponseCodeAppliedScopesNotAssociatedWithCommerceAccount', 'ErrorResponseCodePatchValuesSameAsExisting', 'ErrorResponseCodeRoleAssignmentCreationFailed', 'ErrorResponseCodeReservationOrderCreationFailed', 'ErrorResponseCodeReservationOrderNotEnabled', 'ErrorResponseCodeCapacityUpdateScopesFailed', 'ErrorResponseCodeUnsupportedReservationTerm', 'ErrorResponseCodeReservationOrderIDAlreadyExists', 'ErrorResponseCodeRiskCheckFailed', 'ErrorResponseCodeCreateQuoteFailed', 'ErrorResponseCodeActivateQuoteFailed', 'ErrorResponseCodeNonsupportedAccountID', 'ErrorResponseCodePaymentInstrumentNotFound', 'ErrorResponseCodeMissingAppliedScopesForSingle', 'ErrorResponseCodeNoValidReservationsToReRate', 'ErrorResponseCodeReRateOnlyAllowedForEA', 'ErrorResponseCodeOperationCannotBePerformedInCurrentState', 'ErrorResponseCodeInvalidSingleAppliedScopesCount', 'ErrorResponseCodeInvalidFulfillmentRequestParameters', 'ErrorResponseCodeNotSupportedCountry', 'ErrorResponseCodeInvalidRefundQuantity', 'ErrorResponseCodePurchaseError', 'ErrorResponseCodeBillingCustomerInputError', 'ErrorResponseCodeBillingPaymentInstrumentSoftError', 'ErrorResponseCodeBillingPaymentInstrumentHardError', 'ErrorResponseCodeBillingTransientError', 'ErrorResponseCodeBillingError', 'ErrorResponseCodeFulfillmentConfigurationError', 'ErrorResponseCodeFulfillmentOutOfStockError', 'ErrorResponseCodeFulfillmentTransientError', 'ErrorResponseCodeFulfillmentError', 'ErrorResponseCodeCalculatePriceFailed', 'ErrorResponseCodeAppliedScopesSameAsExisting' + Code ErrorResponseCode `json:"code,omitempty"` + Message *string `json:"message,omitempty"` +} + +// ExtendedStatusInfo ... +type ExtendedStatusInfo struct { + // StatusCode - Possible values include: 'StatusCodeNone', 'StatusCodePending', 'StatusCodeProcessing', 'StatusCodeActive', 'StatusCodePurchaseError', 'StatusCodePaymentInstrumentError', 'StatusCodeSplit', 'StatusCodeMerged', 'StatusCodeExpired', 'StatusCodeSucceeded' + StatusCode StatusCode `json:"statusCode,omitempty"` + // Message - The message giving detailed information about the status code. + Message *string `json:"message,omitempty"` +} + +// List ... +type List struct { + autorest.Response `json:"-"` + Value *[]Response `json:"value,omitempty"` + // NextLink - Url to get the next page of reservations. + NextLink *string `json:"nextLink,omitempty"` +} + +// ListCatalog ... +type ListCatalog struct { + autorest.Response `json:"-"` + Value *[]Catalog `json:"value,omitempty"` +} + +// ListIterator provides access to a complete listing of Response values. +type ListIterator struct { + i int + page ListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListIterator) Response() List { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListIterator) Value() Response { + if !iter.page.NotDone() { + return Response{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListIterator type. +func NewListIterator(page ListPage) ListIterator { + return ListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (l List) IsEmpty() bool { + return l.Value == nil || len(*l.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (l List) hasNextLink() bool { + return l.NextLink != nil && len(*l.NextLink) != 0 +} + +// listPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (l List) listPreparer(ctx context.Context) (*http.Request, error) { + if !l.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(l.NextLink))) +} + +// ListPage contains a page of Response values. +type ListPage struct { + fn func(context.Context, List) (List, error) + l List +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.l) + if err != nil { + return err + } + page.l = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListPage) NotDone() bool { + return !page.l.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListPage) Response() List { + return page.l +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListPage) Values() []Response { + if page.l.IsEmpty() { + return nil + } + return *page.l.Value +} + +// Creates a new instance of the ListPage type. +func NewListPage(cur List, getNextPage func(context.Context, List) (List, error)) ListPage { + return ListPage{ + fn: getNextPage, + l: cur, + } +} + +// ListResponse ... +type ListResponse struct { + autorest.Response `json:"-"` + Value *[]Response `json:"value,omitempty"` +} + +// ListResult the list of reservations and summary of roll out count of reservations in each state. +type ListResult struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of reservations. + Value *[]Response `json:"value,omitempty"` + // NextLink - READ-ONLY; The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` + // Summary - The roll out count summary of the reservations + Summary *Summary `json:"summary,omitempty"` +} + +// MarshalJSON is the custom marshaler for ListResult. +func (lr ListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if lr.Summary != nil { + objectMap["summary"] = lr.Summary + } + return json.Marshal(objectMap) +} + +// ListResultIterator provides access to a complete listing of Response values. +type ListResultIterator struct { + i int + page ListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ListResultIterator) Response() ListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ListResultIterator) Value() Response { + if !iter.page.NotDone() { + return Response{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ListResultIterator type. +func NewListResultIterator(page ListResultPage) ListResultIterator { + return ListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (lr ListResult) IsEmpty() bool { + return lr.Value == nil || len(*lr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (lr ListResult) hasNextLink() bool { + return lr.NextLink != nil && len(*lr.NextLink) != 0 +} + +// listResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) { + if !lr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lr.NextLink))) +} + +// ListResultPage contains a page of Response values. +type ListResultPage struct { + fn func(context.Context, ListResult) (ListResult, error) + lr ListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.lr) + if err != nil { + return err + } + page.lr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ListResultPage) NotDone() bool { + return !page.lr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ListResultPage) Response() ListResult { + return page.lr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ListResultPage) Values() []Response { + if page.lr.IsEmpty() { + return nil + } + return *page.lr.Value +} + +// Creates a new instance of the ListResultPage type. +func NewListResultPage(cur ListResult, getNextPage func(context.Context, ListResult) (ListResult, error)) ListResultPage { + return ListResultPage{ + fn: getNextPage, + lr: cur, + } +} + +// MergeProperties ... +type MergeProperties struct { + // Sources - Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + Sources *[]string `json:"sources,omitempty"` +} + +// MergePropertiesType ... +type MergePropertiesType struct { + // MergeDestination - Reservation Resource Id Created due to the merge. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + MergeDestination *string `json:"mergeDestination,omitempty"` + // MergeSources - Resource Ids of the Source Reservation's merged to form this Reservation. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + MergeSources *[]string `json:"mergeSources,omitempty"` +} + +// MergeRequest ... +type MergeRequest struct { + *MergeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for MergeRequest. +func (mr MergeRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mr.MergeProperties != nil { + objectMap["properties"] = mr.MergeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MergeRequest struct. +func (mr *MergeRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var mergeProperties MergeProperties + err = json.Unmarshal(*v, &mergeProperties) + if err != nil { + return err + } + mr.MergeProperties = &mergeProperties + } + } + } + + return nil +} + +// OperationDisplay ... +type OperationDisplay struct { + Provider *string `json:"provider,omitempty"` + Resource *string `json:"resource,omitempty"` + Operation *string `json:"operation,omitempty"` + Description *string `json:"description,omitempty"` +} + +// OperationList ... +type OperationList struct { + autorest.Response `json:"-"` + Value *[]OperationResponse `json:"value,omitempty"` + // NextLink - Url to get the next page of items. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListIterator provides access to a complete listing of OperationResponse values. +type OperationListIterator struct { + i int + page OperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListIterator) Response() OperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListIterator) Value() OperationResponse { + if !iter.page.NotDone() { + return OperationResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListIterator type. +func NewOperationListIterator(page OperationListPage) OperationListIterator { + return OperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationList) operationListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationListPage contains a page of OperationResponse values. +type OperationListPage struct { + fn func(context.Context, OperationList) (OperationList, error) + ol OperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListPage) Response() OperationList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListPage) Values() []OperationResponse { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationListPage type. +func NewOperationListPage(cur OperationList, getNextPage func(context.Context, OperationList) (OperationList, error)) OperationListPage { + return OperationListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OperationResponse ... +type OperationResponse struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` + // Properties - Properties of the operation + Properties interface{} `json:"properties,omitempty"` +} + +// OperationResultError required if status == failed or status == canceled. +type OperationResultError struct { + // Code - Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis. + Code *string `json:"code,omitempty"` + // Message - Required if status == failed. Localized. If status == failed, provide an actionable error message indicating what error occurred, and what the user can do to address the issue. + Message *string `json:"message,omitempty"` +} + +// OrderBillingPlanInformation information describing the type of billing plan for this reservation. +type OrderBillingPlanInformation struct { + // PricingCurrencyTotal - Amount of money to be paid for the Order. Tax is not included. + PricingCurrencyTotal *Price `json:"pricingCurrencyTotal,omitempty"` + // StartDate - Date when the billing plan has started. + StartDate *date.Date `json:"startDate,omitempty"` + // NextPaymentDueDate - For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. + NextPaymentDueDate *date.Date `json:"nextPaymentDueDate,omitempty"` + Transactions *[]PaymentDetail `json:"transactions,omitempty"` +} + +// OrderList ... +type OrderList struct { + autorest.Response `json:"-"` + Value *[]OrderResponse `json:"value,omitempty"` + // NextLink - Url to get the next page of reservationOrders. + NextLink *string `json:"nextLink,omitempty"` +} + +// OrderListIterator provides access to a complete listing of OrderResponse values. +type OrderListIterator struct { + i int + page OrderListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OrderListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OrderListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OrderListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OrderListIterator) Response() OrderList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OrderListIterator) Value() OrderResponse { + if !iter.page.NotDone() { + return OrderResponse{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OrderListIterator type. +func NewOrderListIterator(page OrderListPage) OrderListIterator { + return OrderListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OrderList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OrderList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// orderListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OrderList) orderListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OrderListPage contains a page of OrderResponse values. +type OrderListPage struct { + fn func(context.Context, OrderList) (OrderList, error) + ol OrderList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OrderListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OrderListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OrderListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OrderListPage) Response() OrderList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OrderListPage) Values() []OrderResponse { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OrderListPage type. +func NewOrderListPage(cur OrderList, getNextPage func(context.Context, OrderList) (OrderList, error)) OrderListPage { + return OrderListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OrderProperties ... +type OrderProperties struct { + // DisplayName - Friendly name for user to easily identified the reservation. + DisplayName *string `json:"displayName,omitempty"` + // RequestDateTime - This is the DateTime when the reservation was initially requested for purchase. + RequestDateTime *date.Time `json:"requestDateTime,omitempty"` + // CreatedDateTime - This is the DateTime when the reservation was created. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` + // ExpiryDate - This is the date when the Reservation will expire. + ExpiryDate *date.Date `json:"expiryDate,omitempty"` + // BenefitStartTime - This is the DateTime when the reservation benefit started. + BenefitStartTime *date.Time `json:"benefitStartTime,omitempty"` + // OriginalQuantity - Total Quantity of the SKUs purchased in the Reservation. + OriginalQuantity *int32 `json:"originalQuantity,omitempty"` + // Term - Possible values include: 'ReservationTermP1Y', 'ReservationTermP3Y', 'ReservationTermP5Y' + Term ReservationTerm `json:"term,omitempty"` + // ProvisioningState - Current state of the reservation. Possible values include: 'ProvisioningState1Creating', 'ProvisioningState1PendingResourceHold', 'ProvisioningState1ConfirmedResourceHold', 'ProvisioningState1PendingBilling', 'ProvisioningState1ConfirmedBilling', 'ProvisioningState1Created', 'ProvisioningState1Succeeded', 'ProvisioningState1Cancelled', 'ProvisioningState1Expired', 'ProvisioningState1BillingFailed', 'ProvisioningState1Failed', 'ProvisioningState1Split', 'ProvisioningState1Merged' + ProvisioningState ProvisioningState1 `json:"provisioningState,omitempty"` + // BillingPlan - Possible values include: 'ReservationBillingPlanUpfront', 'ReservationBillingPlanMonthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + PlanInformation *OrderBillingPlanInformation `json:"planInformation,omitempty"` + ReservationsProperty *[]Response `json:"reservations,omitempty"` +} + +// OrderPurchaseFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OrderPurchaseFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OrderClient) (OrderResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OrderPurchaseFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for OrderPurchaseFuture.Result. +func (future *OrderPurchaseFuture) result(client OrderClient) (or OrderResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderPurchaseFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + or.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.OrderPurchaseFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if or.Response.Response, err = future.GetResult(sender); err == nil && or.Response.Response.StatusCode != http.StatusNoContent { + or, err = client.PurchaseResponder(or.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderPurchaseFuture", "Result", or.Response.Response, "Failure responding to request") + } + } + return +} + +// OrderResponse ... +type OrderResponse struct { + autorest.Response `json:"-"` + Etag *int32 `json:"etag,omitempty"` + // ID - READ-ONLY; Identifier of the reservation + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the reservation + Name *string `json:"name,omitempty"` + *OrderProperties `json:"properties,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/reservations" + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrderResponse. +func (or OrderResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if or.Etag != nil { + objectMap["etag"] = or.Etag + } + if or.OrderProperties != nil { + objectMap["properties"] = or.OrderProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for OrderResponse struct. +func (or *OrderResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "etag": + if v != nil { + var etag int32 + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + or.Etag = &etag + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + or.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + or.Name = &name + } + case "properties": + if v != nil { + var orderProperties OrderProperties + err = json.Unmarshal(*v, &orderProperties) + if err != nil { + return err + } + or.OrderProperties = &orderProperties + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + or.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + or.SystemData = &systemData + } + } + } + + return nil +} + +// Patch ... +type Patch struct { + *PatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Patch. +func (p Patch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PatchProperties != nil { + objectMap["properties"] = p.PatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Patch struct. +func (p *Patch) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var patchProperties PatchProperties + err = json.Unmarshal(*v, &patchProperties) + if err != nil { + return err + } + p.PatchProperties = &patchProperties + } + } + } + + return nil +} + +// PatchProperties ... +type PatchProperties struct { + // AppliedScopeType - Possible values include: 'AppliedScopeTypeSingle', 'AppliedScopeTypeShared' + AppliedScopeType AppliedScopeType `json:"appliedScopeType,omitempty"` + AppliedScopes *[]string `json:"appliedScopes,omitempty"` + // InstanceFlexibility - Possible values include: 'InstanceFlexibilityOn', 'InstanceFlexibilityOff' + InstanceFlexibility InstanceFlexibility `json:"instanceFlexibility,omitempty"` + // Name - Name of the Reservation + Name *string `json:"name,omitempty"` + Renew *bool `json:"renew,omitempty"` + RenewProperties *PatchPropertiesRenewProperties `json:"renewProperties,omitempty"` +} + +// PatchPropertiesRenewProperties ... +type PatchPropertiesRenewProperties struct { + PurchaseProperties *PurchaseRequest `json:"purchaseProperties,omitempty"` +} + +// PaymentDetail information about payment related to a reservation order. +type PaymentDetail struct { + // DueDate - Date when the payment needs to be done. + DueDate *date.Date `json:"dueDate,omitempty"` + // PaymentDate - Date when the transaction is completed. Is null when it is scheduled. + PaymentDate *date.Date `json:"paymentDate,omitempty"` + // PricingCurrencyTotal - Amount in pricing currency. Tax not included. + PricingCurrencyTotal *Price `json:"pricingCurrencyTotal,omitempty"` + // BillingCurrencyTotal - Amount charged in Billing currency. Tax not included. Is null for future payments + BillingCurrencyTotal *Price `json:"billingCurrencyTotal,omitempty"` + // BillingAccount - Shows the Account that is charged for this payment. + BillingAccount *string `json:"billingAccount,omitempty"` + // Status - Possible values include: 'PaymentStatusSucceeded', 'PaymentStatusFailed', 'PaymentStatusScheduled', 'PaymentStatusCancelled' + Status PaymentStatus `json:"status,omitempty"` + ExtendedStatusInfo *ExtendedStatusInfo `json:"extendedStatusInfo,omitempty"` +} + +// Price ... +type Price struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + Amount *float64 `json:"amount,omitempty"` +} + +// Properties the properties of the reservations +type Properties struct { + // ReservedResourceType - The type of the resource that is being reserved. Possible values include: 'ReservedResourceTypeVirtualMachines', 'ReservedResourceTypeSQLDatabases', 'ReservedResourceTypeSuseLinux', 'ReservedResourceTypeCosmosDb', 'ReservedResourceTypeRedHat', 'ReservedResourceTypeSQLDataWarehouse', 'ReservedResourceTypeVMwareCloudSimple', 'ReservedResourceTypeRedHatOsa', 'ReservedResourceTypeDatabricks', 'ReservedResourceTypeAppService', 'ReservedResourceTypeManagedDisk', 'ReservedResourceTypeBlockBlob', 'ReservedResourceTypeRedisCache', 'ReservedResourceTypeAzureDataExplorer', 'ReservedResourceTypeMySQL', 'ReservedResourceTypeMariaDb', 'ReservedResourceTypePostgreSQL', 'ReservedResourceTypeDedicatedHost', 'ReservedResourceTypeSapHana', 'ReservedResourceTypeSQLAzureHybridBenefit', 'ReservedResourceTypeAVS', 'ReservedResourceTypeDataFactory', 'ReservedResourceTypeNetAppStorage', 'ReservedResourceTypeAzureFiles', 'ReservedResourceTypeSQLEdge', 'ReservedResourceTypeVirtualMachineSoftware' + ReservedResourceType ReservedResourceType `json:"reservedResourceType,omitempty"` + // InstanceFlexibility - Allows reservation discount to be applied across skus within the same Autofit group. Not all skus support instance size flexibility. Possible values include: 'InstanceFlexibilityOn', 'InstanceFlexibilityOff' + InstanceFlexibility InstanceFlexibility `json:"instanceFlexibility,omitempty"` + // DisplayName - Friendly name for user to easily identify the reservation + DisplayName *string `json:"displayName,omitempty"` + // AppliedScopes - The list of applied scopes + AppliedScopes *[]string `json:"appliedScopes,omitempty"` + // AppliedScopeType - The applied scope type. Possible values include: 'AppliedScopeTypeSingle', 'AppliedScopeTypeShared' + AppliedScopeType AppliedScopeType `json:"appliedScopeType,omitempty"` + // Archived - Indicates if the reservation is archived + Archived *bool `json:"archived,omitempty"` + // Capabilities - Capabilities of the reservation + Capabilities *string `json:"capabilities,omitempty"` + // Quantity - Quantity of the SKUs that are part of the Reservation. + Quantity *int32 `json:"quantity,omitempty"` + // ProvisioningState - Current state of the reservation. Possible values include: 'ProvisioningStateCreating', 'ProvisioningStatePendingResourceHold', 'ProvisioningStateConfirmedResourceHold', 'ProvisioningStatePendingBilling', 'ProvisioningStateConfirmedBilling', 'ProvisioningStateCreated', 'ProvisioningStateSucceeded', 'ProvisioningStateCancelled', 'ProvisioningStateExpired', 'ProvisioningStateBillingFailed', 'ProvisioningStateFailed', 'ProvisioningStateSplit', 'ProvisioningStateMerged' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // EffectiveDateTime - DateTime of the Reservation starting when this version is effective from. + EffectiveDateTime *date.Time `json:"effectiveDateTime,omitempty"` + // BenefitStartTime - This is the DateTime when the reservation benefit started. + BenefitStartTime *date.Time `json:"benefitStartTime,omitempty"` + // LastUpdatedDateTime - READ-ONLY; DateTime of the last time the Reservation was updated. + LastUpdatedDateTime *date.Time `json:"lastUpdatedDateTime,omitempty"` + // ExpiryDate - This is the date when the Reservation will expire. + ExpiryDate *date.Date `json:"expiryDate,omitempty"` + // SkuDescription - Description of the SKU in english. + SkuDescription *string `json:"skuDescription,omitempty"` + // ExtendedStatusInfo - The message giving detailed information about the status code. + ExtendedStatusInfo *ExtendedStatusInfo `json:"extendedStatusInfo,omitempty"` + // BillingPlan - The billing plan options available for this SKU. Possible values include: 'ReservationBillingPlanUpfront', 'ReservationBillingPlanMonthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + // DisplayProvisioningState - READ-ONLY; The provisioning state of the reservation for display, e.g. Succeeded + DisplayProvisioningState *string `json:"displayProvisioningState,omitempty"` + // ProvisioningSubState - READ-ONLY; The provisioning state of the reservation, e.g. Succeeded + ProvisioningSubState *string `json:"provisioningSubState,omitempty"` + // PurchaseDate - This is the date when the Reservation was purchased. + PurchaseDate *date.Date `json:"purchaseDate,omitempty"` + SplitProperties *SplitPropertiesType `json:"splitProperties,omitempty"` + MergeProperties *MergePropertiesType `json:"mergeProperties,omitempty"` + BillingScopeID *string `json:"billingScopeId,omitempty"` + // Renew - Setting this to true will automatically purchase a new reservation on the expiration date time. + Renew *bool `json:"renew,omitempty"` + // RenewSource - Reservation Id of the reservation from which this reservation is renewed. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + RenewSource *string `json:"renewSource,omitempty"` + // RenewDestination - Reservation Id of the reservation which is purchased because of renew. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + RenewDestination *string `json:"renewDestination,omitempty"` + RenewProperties *RenewPropertiesResponse `json:"renewProperties,omitempty"` + // Term - Represent the term of Reservation. Possible values include: 'ReservationTermP1Y', 'ReservationTermP3Y', 'ReservationTermP5Y' + Term ReservationTerm `json:"term,omitempty"` + // UserFriendlyAppliedScopeType - READ-ONLY; The applied scope type of the reservation for display, e.g. Shared + UserFriendlyAppliedScopeType *string `json:"userFriendlyAppliedScopeType,omitempty"` + // UserFriendlyRenewState - READ-ONLY; The renew state of the reservation for display, e.g. On + UserFriendlyRenewState *string `json:"userFriendlyRenewState,omitempty"` + // Utilization - READ-ONLY; Reservation utilization + Utilization *PropertiesUtilization `json:"utilization,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.ReservedResourceType != "" { + objectMap["reservedResourceType"] = p.ReservedResourceType + } + if p.InstanceFlexibility != "" { + objectMap["instanceFlexibility"] = p.InstanceFlexibility + } + if p.DisplayName != nil { + objectMap["displayName"] = p.DisplayName + } + if p.AppliedScopes != nil { + objectMap["appliedScopes"] = p.AppliedScopes + } + if p.AppliedScopeType != "" { + objectMap["appliedScopeType"] = p.AppliedScopeType + } + if p.Archived != nil { + objectMap["archived"] = p.Archived + } + if p.Capabilities != nil { + objectMap["capabilities"] = p.Capabilities + } + if p.Quantity != nil { + objectMap["quantity"] = p.Quantity + } + if p.ProvisioningState != "" { + objectMap["provisioningState"] = p.ProvisioningState + } + if p.EffectiveDateTime != nil { + objectMap["effectiveDateTime"] = p.EffectiveDateTime + } + if p.BenefitStartTime != nil { + objectMap["benefitStartTime"] = p.BenefitStartTime + } + if p.ExpiryDate != nil { + objectMap["expiryDate"] = p.ExpiryDate + } + if p.SkuDescription != nil { + objectMap["skuDescription"] = p.SkuDescription + } + if p.ExtendedStatusInfo != nil { + objectMap["extendedStatusInfo"] = p.ExtendedStatusInfo + } + if p.BillingPlan != "" { + objectMap["billingPlan"] = p.BillingPlan + } + if p.PurchaseDate != nil { + objectMap["purchaseDate"] = p.PurchaseDate + } + if p.SplitProperties != nil { + objectMap["splitProperties"] = p.SplitProperties + } + if p.MergeProperties != nil { + objectMap["mergeProperties"] = p.MergeProperties + } + if p.BillingScopeID != nil { + objectMap["billingScopeId"] = p.BillingScopeID + } + if p.Renew != nil { + objectMap["renew"] = p.Renew + } + if p.RenewSource != nil { + objectMap["renewSource"] = p.RenewSource + } + if p.RenewDestination != nil { + objectMap["renewDestination"] = p.RenewDestination + } + if p.RenewProperties != nil { + objectMap["renewProperties"] = p.RenewProperties + } + if p.Term != "" { + objectMap["term"] = p.Term + } + return json.Marshal(objectMap) +} + +// PropertiesUtilization reservation utilization +type PropertiesUtilization struct { + // Trend - READ-ONLY; The number of days trend for a reservation + Trend *string `json:"trend,omitempty"` + // Aggregates - The array of aggregates of a reservation's utilization + Aggregates *[]UtilizationAggregates `json:"aggregates,omitempty"` +} + +// MarshalJSON is the custom marshaler for PropertiesUtilization. +func (p PropertiesUtilization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Aggregates != nil { + objectMap["aggregates"] = p.Aggregates + } + return json.Marshal(objectMap) +} + +// PurchaseRequest ... +type PurchaseRequest struct { + Sku *SkuName `json:"sku,omitempty"` + // Location - The Azure Region where the reserved resource lives. + Location *string `json:"location,omitempty"` + *PurchaseRequestProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PurchaseRequest. +func (pr PurchaseRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.Sku != nil { + objectMap["sku"] = pr.Sku + } + if pr.Location != nil { + objectMap["location"] = pr.Location + } + if pr.PurchaseRequestProperties != nil { + objectMap["properties"] = pr.PurchaseRequestProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PurchaseRequest struct. +func (pr *PurchaseRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "sku": + if v != nil { + var sku SkuName + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + pr.Sku = &sku + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + pr.Location = &location + } + case "properties": + if v != nil { + var purchaseRequestProperties PurchaseRequestProperties + err = json.Unmarshal(*v, &purchaseRequestProperties) + if err != nil { + return err + } + pr.PurchaseRequestProperties = &purchaseRequestProperties + } + } + } + + return nil +} + +// PurchaseRequestProperties ... +type PurchaseRequestProperties struct { + // ReservedResourceType - Possible values include: 'ReservedResourceTypeVirtualMachines', 'ReservedResourceTypeSQLDatabases', 'ReservedResourceTypeSuseLinux', 'ReservedResourceTypeCosmosDb', 'ReservedResourceTypeRedHat', 'ReservedResourceTypeSQLDataWarehouse', 'ReservedResourceTypeVMwareCloudSimple', 'ReservedResourceTypeRedHatOsa', 'ReservedResourceTypeDatabricks', 'ReservedResourceTypeAppService', 'ReservedResourceTypeManagedDisk', 'ReservedResourceTypeBlockBlob', 'ReservedResourceTypeRedisCache', 'ReservedResourceTypeAzureDataExplorer', 'ReservedResourceTypeMySQL', 'ReservedResourceTypeMariaDb', 'ReservedResourceTypePostgreSQL', 'ReservedResourceTypeDedicatedHost', 'ReservedResourceTypeSapHana', 'ReservedResourceTypeSQLAzureHybridBenefit', 'ReservedResourceTypeAVS', 'ReservedResourceTypeDataFactory', 'ReservedResourceTypeNetAppStorage', 'ReservedResourceTypeAzureFiles', 'ReservedResourceTypeSQLEdge', 'ReservedResourceTypeVirtualMachineSoftware' + ReservedResourceType ReservedResourceType `json:"reservedResourceType,omitempty"` + BillingScopeID *string `json:"billingScopeId,omitempty"` + // Term - Possible values include: 'ReservationTermP1Y', 'ReservationTermP3Y', 'ReservationTermP5Y' + Term ReservationTerm `json:"term,omitempty"` + // BillingPlan - Possible values include: 'ReservationBillingPlanUpfront', 'ReservationBillingPlanMonthly' + BillingPlan ReservationBillingPlan `json:"billingPlan,omitempty"` + // Quantity - Quantity of the SKUs that are part of the Reservation. + Quantity *int32 `json:"quantity,omitempty"` + // DisplayName - Friendly name of the Reservation + DisplayName *string `json:"displayName,omitempty"` + // AppliedScopeType - Possible values include: 'AppliedScopeTypeSingle', 'AppliedScopeTypeShared' + AppliedScopeType AppliedScopeType `json:"appliedScopeType,omitempty"` + AppliedScopes *[]string `json:"appliedScopes,omitempty"` + Renew *bool `json:"renew,omitempty"` + // ReservedResourceProperties - Properties specific to each reserved resource type. Not required if not applicable. + ReservedResourceProperties *PurchaseRequestPropertiesReservedResourceProperties `json:"reservedResourceProperties,omitempty"` +} + +// PurchaseRequestPropertiesReservedResourceProperties properties specific to each reserved resource type. +// Not required if not applicable. +type PurchaseRequestPropertiesReservedResourceProperties struct { + // InstanceFlexibility - Possible values include: 'InstanceFlexibilityOn', 'InstanceFlexibilityOff' + InstanceFlexibility InstanceFlexibility `json:"instanceFlexibility,omitempty"` +} + +// QuotaCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type QuotaCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(QuotaClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *QuotaCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for QuotaCreateOrUpdateFuture.Result. +func (future *QuotaCreateOrUpdateFuture) result(client QuotaClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.QuotaCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.CreateOrUpdateResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaCreateOrUpdateFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// QuotaLimits quota limits. +type QuotaLimits struct { + autorest.Response `json:"-"` + // Value - List of quotas (service limits). + Value *[]CurrentQuotaLimitBase `json:"value,omitempty"` + // NextLink - The URI for fetching the next page of quotas (service limits). When no more pages exist, the value is null. + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaLimitsIterator provides access to a complete listing of CurrentQuotaLimitBase values. +type QuotaLimitsIterator struct { + i int + page QuotaLimitsPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *QuotaLimitsIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaLimitsIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *QuotaLimitsIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter QuotaLimitsIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter QuotaLimitsIterator) Response() QuotaLimits { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter QuotaLimitsIterator) Value() CurrentQuotaLimitBase { + if !iter.page.NotDone() { + return CurrentQuotaLimitBase{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the QuotaLimitsIterator type. +func NewQuotaLimitsIterator(page QuotaLimitsPage) QuotaLimitsIterator { + return QuotaLimitsIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ql QuotaLimits) IsEmpty() bool { + return ql.Value == nil || len(*ql.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ql QuotaLimits) hasNextLink() bool { + return ql.NextLink != nil && len(*ql.NextLink) != 0 +} + +// quotaLimitsPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ql QuotaLimits) quotaLimitsPreparer(ctx context.Context) (*http.Request, error) { + if !ql.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ql.NextLink))) +} + +// QuotaLimitsPage contains a page of CurrentQuotaLimitBase values. +type QuotaLimitsPage struct { + fn func(context.Context, QuotaLimits) (QuotaLimits, error) + ql QuotaLimits +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *QuotaLimitsPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaLimitsPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ql) + if err != nil { + return err + } + page.ql = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *QuotaLimitsPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page QuotaLimitsPage) NotDone() bool { + return !page.ql.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page QuotaLimitsPage) Response() QuotaLimits { + return page.ql +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page QuotaLimitsPage) Values() []CurrentQuotaLimitBase { + if page.ql.IsEmpty() { + return nil + } + return *page.ql.Value +} + +// Creates a new instance of the QuotaLimitsPage type. +func NewQuotaLimitsPage(cur QuotaLimits, getNextPage func(context.Context, QuotaLimits) (QuotaLimits, error)) QuotaLimitsPage { + return QuotaLimitsPage{ + fn: getNextPage, + ql: cur, + } +} + +// QuotaLimitsResponse quotas (service limits) in the request response. +type QuotaLimitsResponse struct { + // Value - List of quotas with the quota request status. + Value *[]CurrentQuotaLimit `json:"value,omitempty"` + // NextLink - The URI for fetching the next page of quota limits. When no more pages exist, the value is null. + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaProperties quota properties for the resource. +type QuotaProperties struct { + // Limit - Quota properties. + Limit *int32 `json:"limit,omitempty"` + // CurrentValue - READ-ONLY; Current usage value for the resource. + CurrentValue *int32 `json:"currentValue,omitempty"` + // Unit - The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. + Unit *string `json:"unit,omitempty"` + // Name - Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations. + Name *ResourceName `json:"name,omitempty"` + // ResourceType - The name of the resource type. Possible values include: 'ResourceTypeStandard', 'ResourceTypeDedicated', 'ResourceTypeLowPriority', 'ResourceTypeShared', 'ResourceTypeServiceSpecific' + ResourceType ResourceType `json:"resourceType,omitempty"` + // QuotaPeriod - READ-ONLY; The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the time period is irrelevant. + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + // Properties - Additional properties for the specified resource provider. + Properties interface{} `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaProperties. +func (qp QuotaProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qp.Limit != nil { + objectMap["limit"] = qp.Limit + } + if qp.Unit != nil { + objectMap["unit"] = qp.Unit + } + if qp.Name != nil { + objectMap["name"] = qp.Name + } + if qp.ResourceType != "" { + objectMap["resourceType"] = qp.ResourceType + } + if qp.Properties != nil { + objectMap["properties"] = qp.Properties + } + return json.Marshal(objectMap) +} + +// QuotaRequestDetails quota request details. +type QuotaRequestDetails struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; Quota request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Quota request name. + Name *string `json:"name,omitempty"` + // QuotaRequestProperties - Quota request details. + *QuotaRequestProperties `json:"properties,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestDetails. +func (qrd QuotaRequestDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrd.QuotaRequestProperties != nil { + objectMap["properties"] = qrd.QuotaRequestProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for QuotaRequestDetails struct. +func (qrd *QuotaRequestDetails) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + qrd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + qrd.Name = &name + } + case "properties": + if v != nil { + var quotaRequestProperties QuotaRequestProperties + err = json.Unmarshal(*v, "aRequestProperties) + if err != nil { + return err + } + qrd.QuotaRequestProperties = "aRequestProperties + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + qrd.Type = &typeVar + } + } + } + + return nil +} + +// QuotaRequestDetailsList quota request details. +type QuotaRequestDetailsList struct { + autorest.Response `json:"-"` + // Value - The quota requests. + Value *[]QuotaRequestDetails `json:"value,omitempty"` + // NextLink - The URI to fetch the next page of quota limits. When there are no more pages, this is null. + NextLink *string `json:"nextLink,omitempty"` +} + +// QuotaRequestDetailsListIterator provides access to a complete listing of QuotaRequestDetails values. +type QuotaRequestDetailsListIterator struct { + i int + page QuotaRequestDetailsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *QuotaRequestDetailsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaRequestDetailsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *QuotaRequestDetailsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter QuotaRequestDetailsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter QuotaRequestDetailsListIterator) Response() QuotaRequestDetailsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter QuotaRequestDetailsListIterator) Value() QuotaRequestDetails { + if !iter.page.NotDone() { + return QuotaRequestDetails{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the QuotaRequestDetailsListIterator type. +func NewQuotaRequestDetailsListIterator(page QuotaRequestDetailsListPage) QuotaRequestDetailsListIterator { + return QuotaRequestDetailsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (qrdl QuotaRequestDetailsList) IsEmpty() bool { + return qrdl.Value == nil || len(*qrdl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (qrdl QuotaRequestDetailsList) hasNextLink() bool { + return qrdl.NextLink != nil && len(*qrdl.NextLink) != 0 +} + +// quotaRequestDetailsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (qrdl QuotaRequestDetailsList) quotaRequestDetailsListPreparer(ctx context.Context) (*http.Request, error) { + if !qrdl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(qrdl.NextLink))) +} + +// QuotaRequestDetailsListPage contains a page of QuotaRequestDetails values. +type QuotaRequestDetailsListPage struct { + fn func(context.Context, QuotaRequestDetailsList) (QuotaRequestDetailsList, error) + qrdl QuotaRequestDetailsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *QuotaRequestDetailsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaRequestDetailsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.qrdl) + if err != nil { + return err + } + page.qrdl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *QuotaRequestDetailsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page QuotaRequestDetailsListPage) NotDone() bool { + return !page.qrdl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page QuotaRequestDetailsListPage) Response() QuotaRequestDetailsList { + return page.qrdl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page QuotaRequestDetailsListPage) Values() []QuotaRequestDetails { + if page.qrdl.IsEmpty() { + return nil + } + return *page.qrdl.Value +} + +// Creates a new instance of the QuotaRequestDetailsListPage type. +func NewQuotaRequestDetailsListPage(cur QuotaRequestDetailsList, getNextPage func(context.Context, QuotaRequestDetailsList) (QuotaRequestDetailsList, error)) QuotaRequestDetailsListPage { + return QuotaRequestDetailsListPage{ + fn: getNextPage, + qrdl: cur, + } +} + +// QuotaRequestOneResourceProperties the details of quota request. +type QuotaRequestOneResourceProperties struct { + // ProvisioningState - READ-ONLY; The quota request status. Possible values include: 'QuotaRequestStateAccepted', 'QuotaRequestStateInvalid', 'QuotaRequestStateSucceeded', 'QuotaRequestStateFailed', 'QuotaRequestStateInProgress' + ProvisioningState QuotaRequestState `json:"provisioningState,omitempty"` + // Message - READ-ONLY; User friendly status message. + Message *string `json:"message,omitempty"` + // RequestSubmitTime - READ-ONLY; The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + RequestSubmitTime *date.Time `json:"requestSubmitTime,omitempty"` + // CurrentQuotaLimitBase - The quota request addition properties. + *CurrentQuotaLimitBase `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestOneResourceProperties. +func (qrorp QuotaRequestOneResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrorp.CurrentQuotaLimitBase != nil { + objectMap["properties"] = qrorp.CurrentQuotaLimitBase + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for QuotaRequestOneResourceProperties struct. +func (qrorp *QuotaRequestOneResourceProperties) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "provisioningState": + if v != nil { + var provisioningState QuotaRequestState + err = json.Unmarshal(*v, &provisioningState) + if err != nil { + return err + } + qrorp.ProvisioningState = provisioningState + } + case "message": + if v != nil { + var message string + err = json.Unmarshal(*v, &message) + if err != nil { + return err + } + qrorp.Message = &message + } + case "requestSubmitTime": + if v != nil { + var requestSubmitTime date.Time + err = json.Unmarshal(*v, &requestSubmitTime) + if err != nil { + return err + } + qrorp.RequestSubmitTime = &requestSubmitTime + } + case "properties": + if v != nil { + var currentQuotaLimitBase CurrentQuotaLimitBase + err = json.Unmarshal(*v, ¤tQuotaLimitBase) + if err != nil { + return err + } + qrorp.CurrentQuotaLimitBase = ¤tQuotaLimitBase + } + } + } + + return nil +} + +// QuotaRequestOneResourceSubmitResponse response for the quota submission request. +type QuotaRequestOneResourceSubmitResponse struct { + // ID - READ-ONLY; The quota request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the quota request. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/ServiceLimits" + Type *string `json:"type,omitempty"` + // QuotaRequestOneResourceProperties - The details for quota request. + *QuotaRequestOneResourceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestOneResourceSubmitResponse. +func (qrorsr QuotaRequestOneResourceSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrorsr.QuotaRequestOneResourceProperties != nil { + objectMap["properties"] = qrorsr.QuotaRequestOneResourceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for QuotaRequestOneResourceSubmitResponse struct. +func (qrorsr *QuotaRequestOneResourceSubmitResponse) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + qrorsr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + qrorsr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + qrorsr.Type = &typeVar + } + case "properties": + if v != nil { + var quotaRequestOneResourceProperties QuotaRequestOneResourceProperties + err = json.Unmarshal(*v, "aRequestOneResourceProperties) + if err != nil { + return err + } + qrorsr.QuotaRequestOneResourceProperties = "aRequestOneResourceProperties + } + } + } + + return nil +} + +// QuotaRequestProperties the details of quota request. +type QuotaRequestProperties struct { + // ProvisioningState - The quota request status. Possible values include: 'QuotaRequestStateAccepted', 'QuotaRequestStateInvalid', 'QuotaRequestStateSucceeded', 'QuotaRequestStateFailed', 'QuotaRequestStateInProgress' + ProvisioningState QuotaRequestState `json:"provisioningState,omitempty"` + // Message - READ-ONLY; User friendly status message. + Message *string `json:"message,omitempty"` + // RequestSubmitTime - READ-ONLY; The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + RequestSubmitTime *date.Time `json:"requestSubmitTime,omitempty"` + // Value - The quotaRequests. + Value *[]SubRequest `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestProperties. +func (qrp QuotaRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrp.ProvisioningState != "" { + objectMap["provisioningState"] = qrp.ProvisioningState + } + if qrp.Value != nil { + objectMap["value"] = qrp.Value + } + return json.Marshal(objectMap) +} + +// QuotaRequestStatusDetails quota request status details. +type QuotaRequestStatusDetails struct { + // ProvisioningState - READ-ONLY; The details of the quota request status. Possible values include: 'QuotaRequestStateAccepted', 'QuotaRequestStateInvalid', 'QuotaRequestStateSucceeded', 'QuotaRequestStateFailed', 'QuotaRequestStateInProgress' + ProvisioningState QuotaRequestState `json:"provisioningState,omitempty"` + // Message - READ-ONLY; A user friendly message. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestStatusDetails. +func (qrsd QuotaRequestStatusDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// QuotaRequestSubmitResponse response for the quota submission request. +type QuotaRequestSubmitResponse struct { + // ID - READ-ONLY; The quota request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the quota request. + Name *string `json:"name,omitempty"` + // Properties - The quota request details. + Properties *QuotaRequestProperties `json:"properties,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/serviceLimits" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestSubmitResponse. +func (qrsr QuotaRequestSubmitResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrsr.Properties != nil { + objectMap["properties"] = qrsr.Properties + } + return json.Marshal(objectMap) +} + +// QuotaRequestSubmitResponse201 response with request ID that the quota request was accepted. +type QuotaRequestSubmitResponse201 struct { + // ID - READ-ONLY; The quota request ID. Use the requestId parameter to check the request status. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Operation ID + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // QuotaRequestStatusDetails - Quota request status. + *QuotaRequestStatusDetails `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for QuotaRequestSubmitResponse201. +func (qrsr2 QuotaRequestSubmitResponse201) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if qrsr2.QuotaRequestStatusDetails != nil { + objectMap["properties"] = qrsr2.QuotaRequestStatusDetails + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for QuotaRequestSubmitResponse201 struct. +func (qrsr2 *QuotaRequestSubmitResponse201) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + qrsr2.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + qrsr2.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + qrsr2.Type = &typeVar + } + case "properties": + if v != nil { + var quotaRequestStatusDetails QuotaRequestStatusDetails + err = json.Unmarshal(*v, "aRequestStatusDetails) + if err != nil { + return err + } + qrsr2.QuotaRequestStatusDetails = "aRequestStatusDetails + } + } + } + + return nil +} + +// QuotaUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type QuotaUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(QuotaClient) (SetObject, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *QuotaUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for QuotaUpdateFuture.Result. +func (future *QuotaUpdateFuture) result(client QuotaClient) (so SetObject, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + so.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.QuotaUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent { + so, err = client.UpdateResponder(so.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaUpdateFuture", "Result", so.Response.Response, "Failure responding to request") + } + } + return +} + +// RenewPropertiesResponse ... +type RenewPropertiesResponse struct { + PurchaseProperties *PurchaseRequest `json:"purchaseProperties,omitempty"` + // PricingCurrencyTotal - Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. + PricingCurrencyTotal *RenewPropertiesResponsePricingCurrencyTotal `json:"pricingCurrencyTotal,omitempty"` + // BillingCurrencyTotal - Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. + BillingCurrencyTotal *RenewPropertiesResponseBillingCurrencyTotal `json:"billingCurrencyTotal,omitempty"` +} + +// RenewPropertiesResponseBillingCurrencyTotal currency and amount that customer will be charged in +// customer's local currency for renewal purchase. Tax is not included. +type RenewPropertiesResponseBillingCurrencyTotal struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + Amount *float64 `json:"amount,omitempty"` +} + +// RenewPropertiesResponsePricingCurrencyTotal amount that Microsoft uses for record. Used during refund +// for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. +type RenewPropertiesResponsePricingCurrencyTotal struct { + // CurrencyCode - The ISO 4217 3-letter currency code for the currency used by this purchase record. + CurrencyCode *string `json:"currencyCode,omitempty"` + Amount *float64 `json:"amount,omitempty"` +} + +// ReservationAvailableScopesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ReservationAvailableScopesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (AvailableScopeProperties, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReservationAvailableScopesFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ReservationAvailableScopesFuture.Result. +func (future *ReservationAvailableScopesFuture) result(client Client) (asp AvailableScopeProperties, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationAvailableScopesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + asp.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.ReservationAvailableScopesFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if asp.Response.Response, err = future.GetResult(sender); err == nil && asp.Response.Response.StatusCode != http.StatusNoContent { + asp, err = client.AvailableScopesResponder(asp.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationAvailableScopesFuture", "Result", asp.Response.Response, "Failure responding to request") + } + } + return +} + +// ReservationMergeFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ReservationMergeFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ListResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReservationMergeFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ReservationMergeFuture.Result. +func (future *ReservationMergeFuture) result(client Client) (lr ListResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationMergeFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.ReservationMergeFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lr.Response.Response, err = future.GetResult(sender); err == nil && lr.Response.Response.StatusCode != http.StatusNoContent { + lr, err = client.MergeResponder(lr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationMergeFuture", "Result", lr.Response.Response, "Failure responding to request") + } + } + return +} + +// ReservationUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ReservationUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ReservationUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ReservationUpdateFuture.Result. +func (future *ReservationUpdateFuture) result(client Client) (r Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.ReservationUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.ReservationUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// ResourceName resource name provided by the resource provider. Use this property for quotaRequest +// parameter. +type ResourceName struct { + // Value - Resource name. + Value *string `json:"value,omitempty"` + // LocalizedValue - READ-ONLY; Resource display localized name. + LocalizedValue *string `json:"localizedValue,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceName. +func (rn ResourceName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rn.Value != nil { + objectMap["value"] = rn.Value + } + return json.Marshal(objectMap) +} + +// Response the definition of the reservation. +type Response struct { + autorest.Response `json:"-"` + // Location - The Azure Region where the reserved resource lives. + Location *string `json:"location,omitempty"` + Etag *int32 `json:"etag,omitempty"` + // ID - READ-ONLY; Identifier of the reservation + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Name of the reservation + Name *string `json:"name,omitempty"` + // Sku - The sku information associated to this reservation + Sku *SkuName `json:"sku,omitempty"` + // Properties - The properties associated to this reservation + Properties *Properties `json:"properties,omitempty"` + // Type - READ-ONLY; Type of resource. "Microsoft.Capacity/reservationOrders/reservations" + Type *string `json:"type,omitempty"` + // Kind - Resource Provider type to be reserved. Possible values include: 'KindMicrosoftCompute' + Kind Kind `json:"kind,omitempty"` + // SystemData - READ-ONLY + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Response. +func (r Response) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + if r.Sku != nil { + objectMap["sku"] = r.Sku + } + if r.Properties != nil { + objectMap["properties"] = r.Properties + } + if r.Kind != "" { + objectMap["kind"] = r.Kind + } + return json.Marshal(objectMap) +} + +// ScopeProperties ... +type ScopeProperties struct { + Scope *string `json:"scope,omitempty"` + Valid *bool `json:"valid,omitempty"` +} + +// ServiceError the API error details. +type ServiceError struct { + // Code - The error code. + Code *string `json:"code,omitempty"` + // Message - The error message text. + Message *string `json:"message,omitempty"` + // Details - READ-ONLY; The list of error details. + Details *[]ServiceErrorDetail `json:"details,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceError. +func (se ServiceError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if se.Code != nil { + objectMap["code"] = se.Code + } + if se.Message != nil { + objectMap["message"] = se.Message + } + return json.Marshal(objectMap) +} + +// ServiceErrorDetail the error details. +type ServiceErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceErrorDetail. +func (sed ServiceErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SetObject ... +type SetObject struct { + autorest.Response `json:"-"` + Value interface{} `json:"value,omitempty"` +} + +// SkuCapability ... +type SkuCapability struct { + // Name - An invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// SkuName ... +type SkuName struct { + Name *string `json:"name,omitempty"` +} + +// SkuProperty ... +type SkuProperty struct { + // Name - An invariant to describe the feature. + Name *string `json:"name,omitempty"` + // Value - An invariant if the feature is measured by quantity. + Value *string `json:"value,omitempty"` +} + +// SkuRestriction ... +type SkuRestriction struct { + // Type - The type of restrictions. + Type *string `json:"type,omitempty"` + // Values - The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. + Values *[]string `json:"values,omitempty"` + // ReasonCode - The reason for restriction. + ReasonCode *string `json:"reasonCode,omitempty"` +} + +// SplitFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type SplitFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (ListResponse, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SplitFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SplitFuture.Result. +func (future *SplitFuture) result(client Client) (lr ListResponse, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.SplitFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + lr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("reservations.SplitFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if lr.Response.Response, err = future.GetResult(sender); err == nil && lr.Response.Response.StatusCode != http.StatusNoContent { + lr, err = client.SplitResponder(lr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.SplitFuture", "Result", lr.Response.Response, "Failure responding to request") + } + } + return +} + +// SplitProperties ... +type SplitProperties struct { + // Quantities - List of the quantities in the new reservations to create. + Quantities *[]int32 `json:"quantities,omitempty"` + // ReservationID - Resource id of the reservation to be split. Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + ReservationID *string `json:"reservationId,omitempty"` +} + +// SplitPropertiesType ... +type SplitPropertiesType struct { + // SplitDestinations - List of destination Resource Id that are created due to split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + SplitDestinations *[]string `json:"splitDestinations,omitempty"` + // SplitSource - Resource Id of the Reservation from which this is split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + SplitSource *string `json:"splitSource,omitempty"` +} + +// SplitRequest ... +type SplitRequest struct { + *SplitProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for SplitRequest. +func (sr SplitRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.SplitProperties != nil { + objectMap["properties"] = sr.SplitProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SplitRequest struct. +func (sr *SplitRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var splitProperties SplitProperties + err = json.Unmarshal(*v, &splitProperties) + if err != nil { + return err + } + sr.SplitProperties = &splitProperties + } + } + } + + return nil +} + +// SubRequest the sub-request submitted with the quota request. +type SubRequest struct { + // Limit - READ-ONLY; Quota (resource limit). + Limit *int32 `json:"limit,omitempty"` + // Name - The resource name. + Name *ResourceName `json:"name,omitempty"` + // ResourceType - READ-ONLY; Resource type for which the quota check was made. + ResourceType *string `json:"resourceType,omitempty"` + // Unit - The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. + Unit *string `json:"unit,omitempty"` + // ProvisioningState - The quota request status. Possible values include: 'QuotaRequestStateAccepted', 'QuotaRequestStateInvalid', 'QuotaRequestStateSucceeded', 'QuotaRequestStateFailed', 'QuotaRequestStateInProgress' + ProvisioningState QuotaRequestState `json:"provisioningState,omitempty"` + // Message - READ-ONLY; User-friendly status message. + Message *string `json:"message,omitempty"` + // SubRequestID - READ-ONLY; Sub request ID for individual request. + SubRequestID *string `json:"subRequestId,omitempty"` +} + +// MarshalJSON is the custom marshaler for SubRequest. +func (sr SubRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sr.Name != nil { + objectMap["name"] = sr.Name + } + if sr.Unit != nil { + objectMap["unit"] = sr.Unit + } + if sr.ProvisioningState != "" { + objectMap["provisioningState"] = sr.ProvisioningState + } + return json.Marshal(objectMap) +} + +// SubscriptionScopeProperties ... +type SubscriptionScopeProperties struct { + Scopes *[]ScopeProperties `json:"scopes,omitempty"` +} + +// Summary the roll up count summary of reservations in each state +type Summary struct { + // SucceededCount - READ-ONLY; The number of reservation in Succeeded state + SucceededCount *float64 `json:"succeededCount,omitempty"` + // FailedCount - READ-ONLY; The number of reservation in Failed state + FailedCount *float64 `json:"failedCount,omitempty"` + // ExpiringCount - READ-ONLY; The number of reservation in Expiring state + ExpiringCount *float64 `json:"expiringCount,omitempty"` + // ExpiredCount - READ-ONLY; The number of reservation in Expired state + ExpiredCount *float64 `json:"expiredCount,omitempty"` + // PendingCount - READ-ONLY; The number of reservation in Pending state + PendingCount *float64 `json:"pendingCount,omitempty"` + // CancelledCount - READ-ONLY; The number of reservation in Cancelled state + CancelledCount *float64 `json:"cancelledCount,omitempty"` + // ProcessingCount - READ-ONLY; The number of reservation in Processing state + ProcessingCount *float64 `json:"processingCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for Summary. +func (s Summary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// ToExchange reservation refund details +type ToExchange struct { + // ReservationID - Fully qualified id of the Reservation being returned. + ReservationID *string `json:"reservationId,omitempty"` + // Quantity - Quantity to be returned + Quantity *int32 `json:"quantity,omitempty"` + BillingRefundAmount *Price `json:"billingRefundAmount,omitempty"` + BillingInformation *BillingInformation `json:"billingInformation,omitempty"` +} + +// ToPurchaseCalculateExchange reservation purchase details +type ToPurchaseCalculateExchange struct { + Properties *PurchaseRequest `json:"properties,omitempty"` + BillingCurrencyTotal *Price `json:"billingCurrencyTotal,omitempty"` +} + +// ToPurchaseExchange reservation purchase details +type ToPurchaseExchange struct { + // ReservationOrderID - Fully qualified id of the ReservationOrder being purchased + ReservationOrderID *string `json:"reservationOrderId,omitempty"` + // ReservationID - Fully qualified id of the Reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. + ReservationID *string `json:"reservationId,omitempty"` + Properties *PurchaseRequest `json:"properties,omitempty"` + BillingCurrencyTotal *Price `json:"billingCurrencyTotal,omitempty"` + // Status - Possible values include: 'OperationStatusSucceeded', 'OperationStatusFailed', 'OperationStatusCancelled', 'OperationStatusPending' + Status OperationStatus `json:"status,omitempty"` +} + +// ToReturn reservation to return +type ToReturn struct { + // ReservationID - Fully qualified identifier of the Reservation being returned + ReservationID *string `json:"reservationId,omitempty"` + // Quantity - Quantity to be returned. Must be greater than zero. + Quantity *int32 `json:"quantity,omitempty"` +} + +// ToReturnForExchange reservation refund details +type ToReturnForExchange struct { + // ReservationID - Fully qualified id of the Reservation being returned. + ReservationID *string `json:"reservationId,omitempty"` + // Quantity - Quantity to be returned + Quantity *int32 `json:"quantity,omitempty"` + BillingRefundAmount *Price `json:"billingRefundAmount,omitempty"` + BillingInformation *BillingInformation `json:"billingInformation,omitempty"` + // Status - Possible values include: 'OperationStatusSucceeded', 'OperationStatusFailed', 'OperationStatusCancelled', 'OperationStatusPending' + Status OperationStatus `json:"status,omitempty"` +} + +// UtilizationAggregates the aggregate values of reservation utilization +type UtilizationAggregates struct { + // Grain - READ-ONLY; The grain of the aggregate + Grain *float64 `json:"grain,omitempty"` + // GrainUnit - READ-ONLY; The grain unit of the aggregate + GrainUnit *string `json:"grainUnit,omitempty"` + // Value - READ-ONLY; The aggregate value + Value *float64 `json:"value,omitempty"` + // ValueUnit - READ-ONLY; The aggregate value unit + ValueUnit *string `json:"valueUnit,omitempty"` +} + +// MarshalJSON is the custom marshaler for UtilizationAggregates. +func (ua UtilizationAggregates) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/operation.go b/services/reservations/mgmt/2022-03-01/reservations/operation.go new file mode 100644 index 000000000000..15e1749d5f02 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/operation.go @@ -0,0 +1,140 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OperationClient is the client for the Operation methods of the Reservations service. +type OperationClient struct { + BaseClient +} + +// NewOperationClient creates an instance of the OperationClient client. +func NewOperationClient() OperationClient { + return NewOperationClientWithBaseURI(DefaultBaseURI) +} + +// NewOperationClientWithBaseURI creates an instance of the OperationClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOperationClientWithBaseURI(baseURI string) OperationClient { + return OperationClient{NewWithBaseURI(baseURI)} +} + +// List list all the operations. +func (client OperationClient) List(ctx context.Context) (result OperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OperationClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.OperationClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OperationClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Capacity/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationClient) ListResponder(resp *http.Response) (result OperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationClient) listNextResults(ctx context.Context, lastResults OperationList) (result OperationList, err error) { + req, err := lastResults.operationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.OperationClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.OperationClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OperationClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationClient) ListComplete(ctx context.Context) (result OperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/order.go b/services/reservations/mgmt/2022-03-01/reservations/order.go new file mode 100644 index 000000000000..f24c51dd4f10 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/order.go @@ -0,0 +1,444 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// OrderClient is the client for the Order methods of the Reservations service. +type OrderClient struct { + BaseClient +} + +// NewOrderClient creates an instance of the OrderClient client. +func NewOrderClient() OrderClient { + return NewOrderClientWithBaseURI(DefaultBaseURI) +} + +// NewOrderClientWithBaseURI creates an instance of the OrderClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewOrderClientWithBaseURI(baseURI string) OrderClient { + return OrderClient{NewWithBaseURI(baseURI)} +} + +// Calculate calculate price for placing a `ReservationOrder`. +// Parameters: +// body - information needed for calculate or purchase reservation +func (client OrderClient) Calculate(ctx context.Context, body PurchaseRequest) (result CalculatePriceResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.Calculate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CalculatePreparer(ctx, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Calculate", nil, "Failure preparing request") + return + } + + resp, err := client.CalculateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Calculate", resp, "Failure sending request") + return + } + + result, err = client.CalculateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Calculate", resp, "Failure responding to request") + return + } + + return +} + +// CalculatePreparer prepares the Calculate request. +func (client OrderClient) CalculatePreparer(ctx context.Context, body PurchaseRequest) (*http.Request, error) { + const APIVersion = "2022-03-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.WithPath("/providers/Microsoft.Capacity/calculatePrice"), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CalculateSender sends the Calculate request. The method will close the +// http.Response Body if it receives an error. +func (client OrderClient) CalculateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CalculateResponder handles the response to the Calculate request. The method always +// closes the http.Response Body. +func (client OrderClient) CalculateResponder(resp *http.Response) (result CalculatePriceResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ChangeDirectory change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant +// id +// Parameters: +// reservationOrderID - order Id of the reservation +// body - information needed to change directory of reservation order +func (client OrderClient) ChangeDirectory(ctx context.Context, reservationOrderID string, body ChangeDirectoryRequest) (result ChangeDirectoryResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.ChangeDirectory") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ChangeDirectoryPreparer(ctx, reservationOrderID, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "ChangeDirectory", nil, "Failure preparing request") + return + } + + resp, err := client.ChangeDirectorySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "ChangeDirectory", resp, "Failure sending request") + return + } + + result, err = client.ChangeDirectoryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "ChangeDirectory", resp, "Failure responding to request") + return + } + + return +} + +// ChangeDirectoryPreparer prepares the ChangeDirectory request. +func (client OrderClient) ChangeDirectoryPreparer(ctx context.Context, reservationOrderID string, body ChangeDirectoryRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-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("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ChangeDirectorySender sends the ChangeDirectory request. The method will close the +// http.Response Body if it receives an error. +func (client OrderClient) ChangeDirectorySender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ChangeDirectoryResponder handles the response to the ChangeDirectory request. The method always +// closes the http.Response Body. +func (client OrderClient) ChangeDirectoryResponder(resp *http.Response) (result ChangeDirectoryResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the details of the `ReservationOrder`. +// Parameters: +// reservationOrderID - order Id of the reservation +// expand - may be used to expand the planInformation. +func (client OrderClient) Get(ctx context.Context, reservationOrderID string, expand string) (result OrderResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, reservationOrderID, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OrderClient) GetPreparer(ctx context.Context, reservationOrderID string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client OrderClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OrderClient) GetResponder(resp *http.Response) (result OrderResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list of all the `ReservationOrder`s that the user has access to in the current tenant. +func (client OrderClient) List(ctx context.Context) (result OrderListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OrderClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Capacity/reservationOrders"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OrderClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OrderClient) ListResponder(resp *http.Response) (result OrderList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OrderClient) listNextResults(ctx context.Context, lastResults OrderList) (result OrderList, err error) { + req, err := lastResults.orderListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.OrderClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.OrderClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OrderClient) ListComplete(ctx context.Context) (result OrderListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// Purchase purchase `ReservationOrder` and create resource under the specified URI. +// Parameters: +// reservationOrderID - order Id of the reservation +// body - information needed for calculate or purchase reservation +func (client OrderClient) Purchase(ctx context.Context, reservationOrderID string, body PurchaseRequest) (result OrderPurchaseFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderClient.Purchase") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PurchasePreparer(ctx, reservationOrderID, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Purchase", nil, "Failure preparing request") + return + } + + result, err = client.PurchaseSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.OrderClient", "Purchase", result.Response(), "Failure sending request") + return + } + + return +} + +// PurchasePreparer prepares the Purchase request. +func (client OrderClient) PurchasePreparer(ctx context.Context, reservationOrderID string, body PurchaseRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PurchaseSender sends the Purchase request. The method will close the +// http.Response Body if it receives an error. +func (client OrderClient) PurchaseSender(req *http.Request) (future OrderPurchaseFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// PurchaseResponder handles the response to the Purchase request. The method always +// closes the http.Response Body. +func (client OrderClient) PurchaseResponder(resp *http.Response) (result OrderResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/quota.go b/services/reservations/mgmt/2022-03-01/reservations/quota.go new file mode 100644 index 000000000000..57b3b4cefd8e --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/quota.go @@ -0,0 +1,425 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QuotaClient is the client for the Quota methods of the Reservations service. +type QuotaClient struct { + BaseClient +} + +// NewQuotaClient creates an instance of the QuotaClient client. +func NewQuotaClient() QuotaClient { + return NewQuotaClientWithBaseURI(DefaultBaseURI) +} + +// NewQuotaClientWithBaseURI creates an instance of the QuotaClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewQuotaClientWithBaseURI(baseURI string) QuotaClient { + return QuotaClient{NewWithBaseURI(baseURI)} +} + +// CreateOrUpdate create or update the quota (service limits) of a resource to the requested value. +// Steps: +// +// 1. Make the Get request to get the quota information for specific resource. +// +// 2. To increase the quota, update the limit field in the response from Get request to new value. +// +// 3. Submit the JSON to the quota request API to update the quota. +// The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +// resourceName - the resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or +// TotalLowPriorityCores for Microsoft.MachineLearningServices +// createQuotaRequest - quota requests payload. +func (client QuotaClient) CreateOrUpdate(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest CurrentQuotaLimitBase) (result QuotaCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, subscriptionID, providerID, location, resourceName, createQuotaRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client QuotaClient) CreateOrUpdatePreparer(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest CurrentQuotaLimitBase) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + createQuotaRequest.ID = nil + createQuotaRequest.Name = nil + createQuotaRequest.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", pathParameters), + autorest.WithJSON(createQuotaRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaClient) CreateOrUpdateSender(req *http.Request) (future QuotaCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client QuotaClient) CreateOrUpdateResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the current quota (service limit) and usage of a resource. You can use the response from the GET operation +// to submit quota update request. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +// resourceName - the resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or +// TotalLowPriorityCores for Microsoft.MachineLearningServices +func (client QuotaClient) Get(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string) (result CurrentQuotaLimitBase, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, subscriptionID, providerID, location, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client QuotaClient) GetPreparer(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QuotaClient) GetResponder(resp *http.Response) (result CurrentQuotaLimitBase, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of current quotas (service limits) and usage for all resources. The response from the list quota +// operation can be leveraged to request quota updates. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +func (client QuotaClient) List(ctx context.Context, subscriptionID string, providerID string, location string) (result QuotaLimitsPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaClient.List") + defer func() { + sc := -1 + if result.ql.Response.Response != nil { + sc = result.ql.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, subscriptionID, providerID, location) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ql.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "List", resp, "Failure sending request") + return + } + + result.ql, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "List", resp, "Failure responding to request") + return + } + if result.ql.hasNextLink() && result.ql.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client QuotaClient) ListPreparer(ctx context.Context, subscriptionID string, providerID string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client QuotaClient) ListResponder(resp *http.Response) (result QuotaLimits, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client QuotaClient) listNextResults(ctx context.Context, lastResults QuotaLimits) (result QuotaLimits, err error) { + req, err := lastResults.quotaLimitsPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.QuotaClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.QuotaClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client QuotaClient) ListComplete(ctx context.Context, subscriptionID string, providerID string, location string) (result QuotaLimitsIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, subscriptionID, providerID, location) + return +} + +// Update update the quota (service limits) of this resource to the requested value. +// +// • To get the quota information for specific resource, send a GET request. +// +// • To increase the quota, update the limit field from the GET response to a new value. +// +// • To update the quota value, submit the JSON response to the quota request API to update the quota. +// • To update the quota. use the PATCH operation. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +// resourceName - the resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or +// TotalLowPriorityCores for Microsoft.MachineLearningServices +// createQuotaRequest - payload for the quota request. +func (client QuotaClient) Update(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest CurrentQuotaLimitBase) (result QuotaUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, subscriptionID, providerID, location, resourceName, createQuotaRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client QuotaClient) UpdatePreparer(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest CurrentQuotaLimitBase) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + createQuotaRequest.ID = nil + createQuotaRequest.Name = nil + createQuotaRequest.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", pathParameters), + autorest.WithJSON(createQuotaRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaClient) UpdateSender(req *http.Request) (future QuotaUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client QuotaClient) UpdateResponder(resp *http.Response) (result SetObject, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/quotarequeststatus.go b/services/reservations/mgmt/2022-03-01/reservations/quotarequeststatus.go new file mode 100644 index 000000000000..0cb084e15e2f --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/quotarequeststatus.go @@ -0,0 +1,258 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// QuotaRequestStatusClient is the client for the QuotaRequestStatus methods of the Reservations service. +type QuotaRequestStatusClient struct { + BaseClient +} + +// NewQuotaRequestStatusClient creates an instance of the QuotaRequestStatusClient client. +func NewQuotaRequestStatusClient() QuotaRequestStatusClient { + return NewQuotaRequestStatusClientWithBaseURI(DefaultBaseURI) +} + +// NewQuotaRequestStatusClientWithBaseURI creates an instance of the QuotaRequestStatusClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewQuotaRequestStatusClientWithBaseURI(baseURI string) QuotaRequestStatusClient { + return QuotaRequestStatusClient{NewWithBaseURI(baseURI)} +} + +// Get for the specified Azure region (location), get the details and status of the quota request by the quota request +// ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with +// the requestId parameter. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +// ID - quota Request ID. +func (client QuotaRequestStatusClient) Get(ctx context.Context, subscriptionID string, providerID string, location string, ID string) (result QuotaRequestDetails, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaRequestStatusClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, subscriptionID, providerID, location, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client QuotaRequestStatusClient) GetPreparer(ctx context.Context, subscriptionID string, providerID string, location string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaRequestStatusClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client QuotaRequestStatusClient) GetResponder(resp *http.Response) (result QuotaRequestDetails, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List for the specified Azure region (location), subscription, and resource provider, get the history of the quota +// requests for the past year. To select specific quota requests, use the oData filter. +// Parameters: +// subscriptionID - azure subscription ID. +// providerID - azure resource provider ID. +// location - azure region. +// filter - | Field | Supported operators +// |---------------------|------------------------ +// +// |requestSubmitTime | ge, le, eq, gt, lt +// top - number of records to return. +// skiptoken - skiptoken is only used if a previous operation returned a partial result. If a previous response +// contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies +// a starting point to use for subsequent calls. +func (client QuotaRequestStatusClient) List(ctx context.Context, subscriptionID string, providerID string, location string, filter string, top *int32, skiptoken string) (result QuotaRequestDetailsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaRequestStatusClient.List") + defer func() { + sc := -1 + if result.qrdl.Response.Response != nil { + sc = result.qrdl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: top, + Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil}}}}}}); err != nil { + return result, validation.NewError("reservations.QuotaRequestStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, subscriptionID, providerID, location, filter, top, skiptoken) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.qrdl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "List", resp, "Failure sending request") + return + } + + result.qrdl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "List", resp, "Failure responding to request") + return + } + if result.qrdl.hasNextLink() && result.qrdl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client QuotaRequestStatusClient) ListPreparer(ctx context.Context, subscriptionID string, providerID string, location string, filter string, top *int32, skiptoken string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "providerId": autorest.Encode("path", providerID), + "subscriptionId": autorest.Encode("path", subscriptionID), + } + + const APIVersion = "2020-10-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if top != nil { + queryParameters["$top"] = autorest.Encode("query", *top) + } + if len(skiptoken) > 0 { + queryParameters["$skiptoken"] = autorest.Encode("query", skiptoken) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client QuotaRequestStatusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client QuotaRequestStatusClient) ListResponder(resp *http.Response) (result QuotaRequestDetailsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client QuotaRequestStatusClient) listNextResults(ctx context.Context, lastResults QuotaRequestDetailsList) (result QuotaRequestDetailsList, err error) { + req, err := lastResults.quotaRequestDetailsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.QuotaRequestStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client QuotaRequestStatusClient) ListComplete(ctx context.Context, subscriptionID string, providerID string, location string, filter string, top *int32, skiptoken string) (result QuotaRequestDetailsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/QuotaRequestStatusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, subscriptionID, providerID, location, filter, top, skiptoken) + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/reservation.go b/services/reservations/mgmt/2022-03-01/reservations/reservation.go new file mode 100644 index 000000000000..3b51b2fcb1e8 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/reservation.go @@ -0,0 +1,802 @@ +package reservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// Client is the client for the Reservation methods of the Reservations service. +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient() Client { + return NewClientWithBaseURI(DefaultBaseURI) +} + +// NewClientWithBaseURI creates an instance of the Client client using a custom endpoint. Use this when interacting +// with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewClientWithBaseURI(baseURI string) Client { + return Client{NewWithBaseURI(baseURI)} +} + +// AvailableScopes get Available Scopes for `Reservation`. +// Parameters: +// reservationOrderID - order Id of the reservation +// reservationID - id of the Reservation Item +func (client Client) AvailableScopes(ctx context.Context, reservationOrderID string, reservationID string, body AvailableScopeRequest) (result ReservationAvailableScopesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.AvailableScopes") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AvailableScopesPreparer(ctx, reservationOrderID, reservationID, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "AvailableScopes", nil, "Failure preparing request") + return + } + + result, err = client.AvailableScopesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "AvailableScopes", result.Response(), "Failure sending request") + return + } + + return +} + +// AvailableScopesPreparer prepares the AvailableScopes request. +func (client Client) AvailableScopesPreparer(ctx context.Context, reservationOrderID string, reservationID string, body AvailableScopeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationId": autorest.Encode("path", reservationID), + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-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("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AvailableScopesSender sends the AvailableScopes request. The method will close the +// http.Response Body if it receives an error. +func (client Client) AvailableScopesSender(req *http.Request) (future ReservationAvailableScopesFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// AvailableScopesResponder handles the response to the AvailableScopes request. The method always +// closes the http.Response Body. +func (client Client) AvailableScopesResponder(resp *http.Response) (result AvailableScopeProperties, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get specific `Reservation` details. +// Parameters: +// reservationID - id of the Reservation Item +// reservationOrderID - order Id of the reservation +// expand - supported value of this query is renewProperties +func (client Client) Get(ctx context.Context, reservationID string, reservationOrderID string, expand string) (result Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, reservationID, reservationOrderID, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(ctx context.Context, reservationID string, reservationOrderID string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationId": autorest.Encode("path", reservationID), + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client Client) GetResponder(resp *http.Response) (result Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list `Reservation`s within a single `ReservationOrder`. +// Parameters: +// reservationOrderID - order Id of the reservation +func (client Client) List(ctx context.Context, reservationOrderID string) (result ListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.l.Response.Response != nil { + sc = result.l.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, reservationOrderID) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.l.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.Client", "List", resp, "Failure sending request") + return + } + + result.l, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "List", resp, "Failure responding to request") + return + } + if result.l.hasNextLink() && result.l.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client Client) ListPreparer(ctx context.Context, reservationOrderID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client Client) ListResponder(resp *http.Response) (result List, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client Client) listNextResults(ctx context.Context, lastResults List) (result List, err error) { + req, err := lastResults.listPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.Client", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.Client", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListComplete(ctx context.Context, reservationOrderID string) (result ListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, reservationOrderID) + return +} + +// ListAll list the reservations and the roll up counts of reservations group by provisioning states that the user has +// access to in the current tenant. +// Parameters: +// filter - may be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does +// not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, +// properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, +// expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, +// userFriendlyRenewState} +// orderby - may be used to sort order by reservation properties. +// refreshSummary - to indicate whether to refresh the roll up counts of the reservations group by provisioning +// states +// skiptoken - the number of reservations to skip from the list before returning results +// selectedState - the selected provisioning state +// take - to number of reservations to return +func (client Client) ListAll(ctx context.Context, filter string, orderby string, refreshSummary string, skiptoken *float64, selectedState string, take *float64) (result ListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAll") + defer func() { + sc := -1 + if result.lr.Response.Response != nil { + sc = result.lr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listAllNextResults + req, err := client.ListAllPreparer(ctx, filter, orderby, refreshSummary, skiptoken, selectedState, take) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "ListAll", nil, "Failure preparing request") + return + } + + resp, err := client.ListAllSender(req) + if err != nil { + result.lr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.Client", "ListAll", resp, "Failure sending request") + return + } + + result.lr, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "ListAll", resp, "Failure responding to request") + return + } + if result.lr.hasNextLink() && result.lr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListAllPreparer prepares the ListAll request. +func (client Client) ListAllPreparer(ctx context.Context, filter string, orderby string, refreshSummary string, skiptoken *float64, selectedState string, take *float64) (*http.Request, error) { + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(orderby) > 0 { + queryParameters["$orderby"] = autorest.Encode("query", orderby) + } + if len(refreshSummary) > 0 { + queryParameters["refreshSummary"] = autorest.Encode("query", refreshSummary) + } + if skiptoken != nil { + queryParameters["$skiptoken"] = autorest.Encode("query", *skiptoken) + } + if len(selectedState) > 0 { + queryParameters["selectedState"] = autorest.Encode("query", selectedState) + } + if take != nil { + queryParameters["take"] = autorest.Encode("query", *take) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Capacity/reservations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAllSender sends the ListAll request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListAllSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListAllResponder handles the response to the ListAll request. The method always +// closes the http.Response Body. +func (client Client) ListAllResponder(resp *http.Response) (result ListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listAllNextResults retrieves the next set of results, if any. +func (client Client) listAllNextResults(ctx context.Context, lastResults ListResult) (result ListResult, err error) { + req, err := lastResults.listResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.Client", "listAllNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListAllSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.Client", "listAllNextResults", resp, "Failure sending next results request") + } + result, err = client.ListAllResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "listAllNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListAllComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListAllComplete(ctx context.Context, filter string, orderby string, refreshSummary string, skiptoken *float64, selectedState string, take *float64) (result ListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListAll") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListAll(ctx, filter, orderby, refreshSummary, skiptoken, selectedState, take) + return +} + +// ListRevisions list of all the revisions for the `Reservation`. +// Parameters: +// reservationID - id of the Reservation Item +// reservationOrderID - order Id of the reservation +func (client Client) ListRevisions(ctx context.Context, reservationID string, reservationOrderID string) (result ListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListRevisions") + defer func() { + sc := -1 + if result.l.Response.Response != nil { + sc = result.l.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listRevisionsNextResults + req, err := client.ListRevisionsPreparer(ctx, reservationID, reservationOrderID) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "ListRevisions", nil, "Failure preparing request") + return + } + + resp, err := client.ListRevisionsSender(req) + if err != nil { + result.l.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "reservations.Client", "ListRevisions", resp, "Failure sending request") + return + } + + result.l, err = client.ListRevisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "ListRevisions", resp, "Failure responding to request") + return + } + if result.l.hasNextLink() && result.l.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListRevisionsPreparer prepares the ListRevisions request. +func (client Client) ListRevisionsPreparer(ctx context.Context, reservationID string, reservationOrderID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationId": autorest.Encode("path", reservationID), + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListRevisionsSender sends the ListRevisions request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListRevisionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListRevisionsResponder handles the response to the ListRevisions request. The method always +// closes the http.Response Body. +func (client Client) ListRevisionsResponder(resp *http.Response) (result List, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listRevisionsNextResults retrieves the next set of results, if any. +func (client Client) listRevisionsNextResults(ctx context.Context, lastResults List) (result List, err error) { + req, err := lastResults.listPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "reservations.Client", "listRevisionsNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListRevisionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "reservations.Client", "listRevisionsNextResults", resp, "Failure sending next results request") + } + result, err = client.ListRevisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "listRevisionsNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListRevisionsComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListRevisionsComplete(ctx context.Context, reservationID string, reservationOrderID string) (result ListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListRevisions") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListRevisions(ctx, reservationID, reservationOrderID) + return +} + +// Merge merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have +// same properties. +// Parameters: +// reservationOrderID - order Id of the reservation +// body - information needed for commercial request for a reservation +func (client Client) Merge(ctx context.Context, reservationOrderID string, body MergeRequest) (result ReservationMergeFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Merge") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.MergePreparer(ctx, reservationOrderID, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Merge", nil, "Failure preparing request") + return + } + + result, err = client.MergeSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Merge", result.Response(), "Failure sending request") + return + } + + return +} + +// MergePreparer prepares the Merge request. +func (client Client) MergePreparer(ctx context.Context, reservationOrderID string, body MergeRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-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("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MergeSender sends the Merge request. The method will close the +// http.Response Body if it receives an error. +func (client Client) MergeSender(req *http.Request) (future ReservationMergeFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// MergeResponder handles the response to the Merge request. The method always +// closes the http.Response Body. +func (client Client) MergeResponder(resp *http.Response) (result ListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Split split a `Reservation` into two `Reservation`s with specified quantity distribution. +// Parameters: +// reservationOrderID - order Id of the reservation +// body - information needed to Split a reservation item +func (client Client) Split(ctx context.Context, reservationOrderID string, body SplitRequest) (result SplitFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Split") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SplitPreparer(ctx, reservationOrderID, body) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Split", nil, "Failure preparing request") + return + } + + result, err = client.SplitSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Split", result.Response(), "Failure sending request") + return + } + + return +} + +// SplitPreparer prepares the Split request. +func (client Client) SplitPreparer(ctx context.Context, reservationOrderID string, body SplitRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-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("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SplitSender sends the Split request. The method will close the +// http.Response Body if it receives an error. +func (client Client) SplitSender(req *http.Request) (future SplitFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// SplitResponder handles the response to the Split request. The method always +// closes the http.Response Body. +func (client Client) SplitResponder(resp *http.Response) (result ListResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Update updates the applied scopes of the `Reservation`. +// Parameters: +// reservationOrderID - order Id of the reservation +// reservationID - id of the Reservation Item +// parameters - information needed to patch a reservation item +func (client Client) Update(ctx context.Context, reservationOrderID string, reservationID string, parameters Patch) (result ReservationUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, reservationOrderID, reservationID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "reservations.Client", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(ctx context.Context, reservationOrderID string, reservationID string, parameters Patch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "reservationId": autorest.Encode("path", reservationID), + "reservationOrderId": autorest.Encode("path", reservationOrderID), + } + + const APIVersion = "2022-03-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (future ReservationUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/reservations/mgmt/2022-03-01/reservations/reservationsapi/interfaces.go b/services/reservations/mgmt/2022-03-01/reservations/reservationsapi/interfaces.go new file mode 100644 index 000000000000..d80fc4a43181 --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/reservationsapi/interfaces.go @@ -0,0 +1,91 @@ +package reservationsapi + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/services/reservations/mgmt/2022-03-01/reservations" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + GetAppliedReservationList(ctx context.Context, subscriptionID string) (result reservations.AppliedReservations, err error) + GetCatalog(ctx context.Context, subscriptionID string, reservedResourceType string, location string, publisherID string, offerID string, planID string) (result reservations.ListCatalog, err error) +} + +var _ BaseClientAPI = (*reservations.BaseClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + AvailableScopes(ctx context.Context, reservationOrderID string, reservationID string, body reservations.AvailableScopeRequest) (result reservations.ReservationAvailableScopesFuture, err error) + Get(ctx context.Context, reservationID string, reservationOrderID string, expand string) (result reservations.Response, err error) + List(ctx context.Context, reservationOrderID string) (result reservations.ListPage, err error) + ListComplete(ctx context.Context, reservationOrderID string) (result reservations.ListIterator, err error) + ListAll(ctx context.Context, filter string, orderby string, refreshSummary string, skiptoken *float64, selectedState string, take *float64) (result reservations.ListResultPage, err error) + ListAllComplete(ctx context.Context, filter string, orderby string, refreshSummary string, skiptoken *float64, selectedState string, take *float64) (result reservations.ListResultIterator, err error) + ListRevisions(ctx context.Context, reservationID string, reservationOrderID string) (result reservations.ListPage, err error) + ListRevisionsComplete(ctx context.Context, reservationID string, reservationOrderID string) (result reservations.ListIterator, err error) + Merge(ctx context.Context, reservationOrderID string, body reservations.MergeRequest) (result reservations.ReservationMergeFuture, err error) + Split(ctx context.Context, reservationOrderID string, body reservations.SplitRequest) (result reservations.SplitFuture, err error) + Update(ctx context.Context, reservationOrderID string, reservationID string, parameters reservations.Patch) (result reservations.ReservationUpdateFuture, err error) +} + +var _ ClientAPI = (*reservations.Client)(nil) + +// OrderClientAPI contains the set of methods on the OrderClient type. +type OrderClientAPI interface { + Calculate(ctx context.Context, body reservations.PurchaseRequest) (result reservations.CalculatePriceResponse, err error) + ChangeDirectory(ctx context.Context, reservationOrderID string, body reservations.ChangeDirectoryRequest) (result reservations.ChangeDirectoryResponse, err error) + Get(ctx context.Context, reservationOrderID string, expand string) (result reservations.OrderResponse, err error) + List(ctx context.Context) (result reservations.OrderListPage, err error) + ListComplete(ctx context.Context) (result reservations.OrderListIterator, err error) + Purchase(ctx context.Context, reservationOrderID string, body reservations.PurchaseRequest) (result reservations.OrderPurchaseFuture, err error) +} + +var _ OrderClientAPI = (*reservations.OrderClient)(nil) + +// OperationClientAPI contains the set of methods on the OperationClient type. +type OperationClientAPI interface { + List(ctx context.Context) (result reservations.OperationListPage, err error) + ListComplete(ctx context.Context) (result reservations.OperationListIterator, err error) +} + +var _ OperationClientAPI = (*reservations.OperationClient)(nil) + +// CalculateExchangeClientAPI contains the set of methods on the CalculateExchangeClient type. +type CalculateExchangeClientAPI interface { + Post(ctx context.Context, body reservations.CalculateExchangeRequest) (result reservations.CalculateExchangePostFuture, err error) +} + +var _ CalculateExchangeClientAPI = (*reservations.CalculateExchangeClient)(nil) + +// ExchangeClientAPI contains the set of methods on the ExchangeClient type. +type ExchangeClientAPI interface { + Post(ctx context.Context, body reservations.ExchangeRequest) (result reservations.ExchangePostFuture, err error) +} + +var _ ExchangeClientAPI = (*reservations.ExchangeClient)(nil) + +// QuotaClientAPI contains the set of methods on the QuotaClient type. +type QuotaClientAPI interface { + CreateOrUpdate(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest reservations.CurrentQuotaLimitBase) (result reservations.QuotaCreateOrUpdateFuture, err error) + Get(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string) (result reservations.CurrentQuotaLimitBase, err error) + List(ctx context.Context, subscriptionID string, providerID string, location string) (result reservations.QuotaLimitsPage, err error) + ListComplete(ctx context.Context, subscriptionID string, providerID string, location string) (result reservations.QuotaLimitsIterator, err error) + Update(ctx context.Context, subscriptionID string, providerID string, location string, resourceName string, createQuotaRequest reservations.CurrentQuotaLimitBase) (result reservations.QuotaUpdateFuture, err error) +} + +var _ QuotaClientAPI = (*reservations.QuotaClient)(nil) + +// QuotaRequestStatusClientAPI contains the set of methods on the QuotaRequestStatusClient type. +type QuotaRequestStatusClientAPI interface { + Get(ctx context.Context, subscriptionID string, providerID string, location string, ID string) (result reservations.QuotaRequestDetails, err error) + List(ctx context.Context, subscriptionID string, providerID string, location string, filter string, top *int32, skiptoken string) (result reservations.QuotaRequestDetailsListPage, err error) + ListComplete(ctx context.Context, subscriptionID string, providerID string, location string, filter string, top *int32, skiptoken string) (result reservations.QuotaRequestDetailsListIterator, err error) +} + +var _ QuotaRequestStatusClientAPI = (*reservations.QuotaRequestStatusClient)(nil) diff --git a/services/reservations/mgmt/2022-03-01/reservations/version.go b/services/reservations/mgmt/2022-03-01/reservations/version.go new file mode 100644 index 000000000000..be0fbf6bf26b --- /dev/null +++ b/services/reservations/mgmt/2022-03-01/reservations/version.go @@ -0,0 +1,19 @@ +package reservations + +import "github.com/Azure/azure-sdk-for-go/version" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " reservations/2022-03-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/version/version.go b/version/version.go index 71037169c409..2c4bd1693b51 100644 --- a/version/version.go +++ b/version/version.go @@ -4,4 +4,4 @@ package version // Licensed under the MIT License. See License.txt in the project root for license information. // Number contains the semantic version of this SDK. -const Number = "v63.3.0" +const Number = "v63.4.0"