diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index 455c4142f984..f0a8c69de982 100644 --- a/profiles/preview/network/mgmt/network/models.go +++ b/profiles/preview/network/mgmt/network/models.go @@ -61,6 +61,7 @@ type LoadBalancerBackendAddressPoolsClient = original.LoadBalancerBackendAddress type LoadBalancerFrontendIPConfigurationsClient = original.LoadBalancerFrontendIPConfigurationsClient type LoadBalancerLoadBalancingRulesClient = original.LoadBalancerLoadBalancingRulesClient type LoadBalancerNetworkInterfacesClient = original.LoadBalancerNetworkInterfacesClient +type LoadBalancerOutboundRulesClient = original.LoadBalancerOutboundRulesClient type LoadBalancerProbesClient = original.LoadBalancerProbesClient type LoadBalancersClient = original.LoadBalancersClient type LocalNetworkGatewaysClient = original.LocalNetworkGatewaysClient @@ -380,8 +381,9 @@ const ( type ExpressRouteCircuitSkuTier = original.ExpressRouteCircuitSkuTier const ( - Premium ExpressRouteCircuitSkuTier = original.Premium - Standard ExpressRouteCircuitSkuTier = original.Standard + ExpressRouteCircuitSkuTierBasic ExpressRouteCircuitSkuTier = original.ExpressRouteCircuitSkuTierBasic + ExpressRouteCircuitSkuTierPremium ExpressRouteCircuitSkuTier = original.ExpressRouteCircuitSkuTierPremium + ExpressRouteCircuitSkuTierStandard ExpressRouteCircuitSkuTier = original.ExpressRouteCircuitSkuTierStandard ) type ExpressRouteLinkAdminState = original.ExpressRouteLinkAdminState @@ -662,7 +664,7 @@ const ( type PublicIPPrefixSkuName = original.PublicIPPrefixSkuName const ( - PublicIPPrefixSkuNameStandard PublicIPPrefixSkuName = original.PublicIPPrefixSkuNameStandard + Standard PublicIPPrefixSkuName = original.Standard ) type RouteNextHopType = original.RouteNextHopType @@ -1236,6 +1238,9 @@ type LoadBalancerListResultPage = original.LoadBalancerListResultPage type LoadBalancerLoadBalancingRuleListResult = original.LoadBalancerLoadBalancingRuleListResult type LoadBalancerLoadBalancingRuleListResultIterator = original.LoadBalancerLoadBalancingRuleListResultIterator type LoadBalancerLoadBalancingRuleListResultPage = original.LoadBalancerLoadBalancingRuleListResultPage +type LoadBalancerOutboundRuleListResult = original.LoadBalancerOutboundRuleListResult +type LoadBalancerOutboundRuleListResultIterator = original.LoadBalancerOutboundRuleListResultIterator +type LoadBalancerOutboundRuleListResultPage = original.LoadBalancerOutboundRuleListResultPage type LoadBalancerProbeListResult = original.LoadBalancerProbeListResult type LoadBalancerProbeListResultIterator = original.LoadBalancerProbeListResultIterator type LoadBalancerProbeListResultPage = original.LoadBalancerProbeListResultPage @@ -1796,6 +1801,12 @@ func NewLoadBalancerNetworkInterfacesClient(subscriptionID string) LoadBalancerN func NewLoadBalancerNetworkInterfacesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerNetworkInterfacesClient { return original.NewLoadBalancerNetworkInterfacesClientWithBaseURI(baseURI, subscriptionID) } +func NewLoadBalancerOutboundRulesClient(subscriptionID string) LoadBalancerOutboundRulesClient { + return original.NewLoadBalancerOutboundRulesClient(subscriptionID) +} +func NewLoadBalancerOutboundRulesClientWithBaseURI(baseURI string, subscriptionID string) LoadBalancerOutboundRulesClient { + return original.NewLoadBalancerOutboundRulesClientWithBaseURI(baseURI, subscriptionID) +} func NewLoadBalancerProbesClient(subscriptionID string) LoadBalancerProbesClient { return original.NewLoadBalancerProbesClient(subscriptionID) } diff --git a/services/network/mgmt/2018-08-01/network/loadbalanceroutboundrules.go b/services/network/mgmt/2018-08-01/network/loadbalanceroutboundrules.go new file mode 100644 index 000000000000..6512affeba7d --- /dev/null +++ b/services/network/mgmt/2018-08-01/network/loadbalanceroutboundrules.go @@ -0,0 +1,204 @@ +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// 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" + "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. +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) { + 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 +} + +// 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 = "2018-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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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) { + 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 +} + +// 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 = "2018-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 autorest.SendWithSender(client, 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, + client.ByInspecting(), + 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(lastResults LoadBalancerOutboundRuleListResult) (result LoadBalancerOutboundRuleListResult, err error) { + req, err := lastResults.loadBalancerOutboundRuleListResultPreparer() + 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) { + result.page, err = client.List(ctx, resourceGroupName, loadBalancerName) + return +} diff --git a/services/network/mgmt/2018-08-01/network/models.go b/services/network/mgmt/2018-08-01/network/models.go index 398c95cdb1a6..e2aeca0572f3 100644 --- a/services/network/mgmt/2018-08-01/network/models.go +++ b/services/network/mgmt/2018-08-01/network/models.go @@ -697,15 +697,17 @@ func PossibleExpressRouteCircuitSkuFamilyValues() []ExpressRouteCircuitSkuFamily type ExpressRouteCircuitSkuTier string const ( - // Premium ... - Premium ExpressRouteCircuitSkuTier = "Premium" - // Standard ... - Standard ExpressRouteCircuitSkuTier = "Standard" + // ExpressRouteCircuitSkuTierBasic ... + ExpressRouteCircuitSkuTierBasic ExpressRouteCircuitSkuTier = "Basic" + // 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{Premium, Standard} + return []ExpressRouteCircuitSkuTier{ExpressRouteCircuitSkuTierBasic, ExpressRouteCircuitSkuTierPremium, ExpressRouteCircuitSkuTierStandard} } // ExpressRouteLinkAdminState enumerates the values for express route link admin state. @@ -1293,13 +1295,13 @@ func PossiblePublicIPAddressSkuNameValues() []PublicIPAddressSkuName { type PublicIPPrefixSkuName string const ( - // PublicIPPrefixSkuNameStandard ... - PublicIPPrefixSkuNameStandard PublicIPPrefixSkuName = "Standard" + // Standard ... + Standard PublicIPPrefixSkuName = "Standard" ) // PossiblePublicIPPrefixSkuNameValues returns an array of possible values for the PublicIPPrefixSkuName const type. func PossiblePublicIPPrefixSkuNameValues() []PublicIPPrefixSkuName { - return []PublicIPPrefixSkuName{PublicIPPrefixSkuNameStandard} + return []PublicIPPrefixSkuName{Standard} } // RouteNextHopType enumerates the values for route next hop type. @@ -8702,7 +8704,7 @@ type ExpressRouteCircuitServiceProviderProperties struct { type ExpressRouteCircuitSku struct { // Name - The name of the SKU. Name *string `json:"name,omitempty"` - // Tier - The tier of the SKU. Possible values are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + // Tier - The tier of the SKU. Possible values are 'Standard', 'Premium' or 'Basic'. Possible values include: 'ExpressRouteCircuitSkuTierStandard', 'ExpressRouteCircuitSkuTierPremium', 'ExpressRouteCircuitSkuTierBasic' Tier ExpressRouteCircuitSkuTier `json:"tier,omitempty"` // Family - The family of the SKU. Possible values are: 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', 'MeteredData' Family ExpressRouteCircuitSkuFamily `json:"family,omitempty"` @@ -14512,6 +14514,108 @@ func (page LoadBalancerLoadBalancingRuleListResultPage) Values() []LoadBalancing return *page.lblbrlr.Value } +// 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 - The URL to get the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// LoadBalancerOutboundRuleListResultIterator provides access to a complete listing of OutboundRule values. +type LoadBalancerOutboundRuleListResultIterator struct { + i int + page LoadBalancerOutboundRuleListResultPage +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *LoadBalancerOutboundRuleListResultIterator) Next() error { + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err := iter.page.Next() + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter 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] +} + +// IsEmpty returns true if the ListResult contains no values. +func (lborlr LoadBalancerOutboundRuleListResult) IsEmpty() bool { + return lborlr.Value == nil || len(*lborlr.Value) == 0 +} + +// loadBalancerOutboundRuleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (lborlr LoadBalancerOutboundRuleListResult) loadBalancerOutboundRuleListResultPreparer() (*http.Request, error) { + if lborlr.NextLink == nil || len(to.String(lborlr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare(&http.Request{}, + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(lborlr.NextLink))) +} + +// LoadBalancerOutboundRuleListResultPage contains a page of OutboundRule values. +type LoadBalancerOutboundRuleListResultPage struct { + fn func(LoadBalancerOutboundRuleListResult) (LoadBalancerOutboundRuleListResult, error) + lborlr LoadBalancerOutboundRuleListResult +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *LoadBalancerOutboundRuleListResultPage) Next() error { + next, err := page.fn(page.lborlr) + if err != nil { + return err + } + page.lborlr = next + return nil +} + +// 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 +} + // LoadBalancerProbeListResult response for ListProbe API service call. type LoadBalancerProbeListResult struct { autorest.Response `json:"-"` @@ -15438,6 +15542,7 @@ type OperationPropertiesFormatServiceSpecification struct { // OutboundRule outbound pool 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 a resource group. This name can be used to access the resource. @@ -17867,7 +17972,7 @@ type PublicIPPrefixPropertiesFormat struct { // PublicIPPrefixSku SKU of a public IP prefix type PublicIPPrefixSku struct { - // Name - Name of a public IP prefix SKU. Possible values include: 'PublicIPPrefixSkuNameStandard' + // Name - Name of a public IP prefix SKU. Possible values include: 'Standard' Name PublicIPPrefixSkuName `json:"name,omitempty"` } diff --git a/services/network/mgmt/2018-08-01/network/virtualnetworks.go b/services/network/mgmt/2018-08-01/network/virtualnetworks.go index f7c798edb474..d0742cf90955 100644 --- a/services/network/mgmt/2018-08-01/network/virtualnetworks.go +++ b/services/network/mgmt/2018-08-01/network/virtualnetworks.go @@ -41,11 +41,11 @@ func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string) // CheckIPAddressAvailability checks whether a private IP address is available for use. // Parameters: +// IPAddress - the private IP address to be verified. // 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) { - req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress) +func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, IPAddress string, resourceGroupName string, virtualNetworkName string) (result IPAddressAvailabilityResult, err error) { + req, err := client.CheckIPAddressAvailabilityPreparer(ctx, IPAddress, resourceGroupName, virtualNetworkName) if err != nil { err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") return @@ -67,7 +67,7 @@ func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Conte } // CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. -func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { +func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, IPAddress string, resourceGroupName string, virtualNetworkName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), @@ -77,9 +77,7 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx conte const APIVersion = "2018-08-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, - } - if len(IPAddress) > 0 { - queryParameters["ipAddress"] = autorest.Encode("query", IPAddress) + "ipAddress": autorest.Encode("query", IPAddress), } preparer := autorest.CreatePreparer(