diff --git a/sdk/resourcemanager/peering/armpeering/CHANGELOG.md b/sdk/resourcemanager/peering/armpeering/CHANGELOG.md index d2612a8f6d54..dec14d342f9c 100644 --- a/sdk/resourcemanager/peering/armpeering/CHANGELOG.md +++ b/sdk/resourcemanager/peering/armpeering/CHANGELOG.md @@ -1,5 +1,278 @@ # Release History +## 0.3.0 (2022-02-22) +### Breaking Changes + +- Function `*LegacyPeeringsClient.List` parameter(s) have been changed from `(string, Enum1, *LegacyPeeringsClientListOptions)` to `(string, LegacyPeeringsKind, *LegacyPeeringsClientListOptions)` +- Function `*LocationsClient.List` parameter(s) have been changed from `(Enum14, *LocationsClientListOptions)` to `(PeeringLocationsKind, *LocationsClientListOptions)` +- Type of `SKU.Name` has been changed from `*Name` to `*string` +- Type of `LocationsClientListOptions.DirectPeeringType` has been changed from `*Enum15` to `*PeeringLocationsDirectPeeringType` +- Const `Enum0UnAvailable` has been removed +- Const `LearnedTypeViaPartner` has been removed +- Const `Enum14Exchange` has been removed +- Const `NamePremiumDirectMetered` has been removed +- Const `NameBasicDirectFree` has been removed +- Const `Enum15Internal` has been removed +- Const `Enum15Cdn` has been removed +- Const `NameBasicExchangeFree` has been removed +- Const `Enum1Exchange` has been removed +- Const `Enum15Edge` has been removed +- Const `NamePremiumDirectFree` has been removed +- Const `NamePremiumExchangeMetered` has been removed +- Const `Enum14Direct` has been removed +- Const `Enum1Direct` has been removed +- Const `NamePremiumDirectUnlimited` has been removed +- Const `Enum15Transit` has been removed +- Function `Enum1.ToPtr` has been removed +- Function `NewServicePrefixesClient` has been removed +- Function `*ServicePrefixesClient.Delete` has been removed +- Function `PossibleNameValues` has been removed +- Function `Enum15.ToPtr` has been removed +- Function `Enum14.ToPtr` has been removed +- Function `PossibleEnum14Values` has been removed +- Function `*ServicePrefixesClient.Get` has been removed +- Function `PossibleEnum1Values` has been removed +- Function `Name.ToPtr` has been removed +- Function `ContactInfo.MarshalJSON` has been removed +- Function `PossibleEnum15Values` has been removed +- Function `*ServicePrefixesClient.CreateOrUpdate` has been removed +- Struct `ContactInfo` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ServicePrefixesClient` has been removed +- Struct `ServicePrefixesClientCreateOrUpdateOptions` has been removed +- Struct `ServicePrefixesClientCreateOrUpdateResponse` has been removed +- Struct `ServicePrefixesClientCreateOrUpdateResult` has been removed +- Struct `ServicePrefixesClientDeleteOptions` has been removed +- Struct `ServicePrefixesClientDeleteResponse` has been removed +- Struct `ServicePrefixesClientGetOptions` has been removed +- Struct `ServicePrefixesClientGetResponse` has been removed +- Struct `ServicePrefixesClientGetResult` has been removed +- Field `PeerContactInfo` of struct `PeerAsnProperties` has been removed + +### Features Added + +- New const `RoleEscalation` +- New const `DirectPeeringTypeVoice` +- New const `LookingGlassCommandTraceroute` +- New const `PeeringLocationsKindDirect` +- New const `PeeringLocationsDirectPeeringTypeInternal` +- New const `RoleService` +- New const `PeeringLocationsDirectPeeringTypeCdn` +- New const `RoleNoc` +- New const `PeeringLocationsDirectPeeringTypeEdge` +- New const `PeeringLocationsDirectPeeringTypeIx` +- New const `RoleOther` +- New const `PeeringLocationsKindExchange` +- New const `LookingGlassSourceTypeAzureRegion` +- New const `LegacyPeeringsKindDirect` +- New const `LegacyPeeringsKindExchange` +- New const `PrefixValidationStateWarning` +- New const `DirectPeeringTypeIx` +- New const `CommandTraceroute` +- New const `DirectPeeringTypeIxRs` +- New const `LookingGlassCommandPing` +- New const `CommandPing` +- New const `PeeringLocationsDirectPeeringTypeTransit` +- New const `RoleTechnical` +- New const `PeeringLocationsDirectPeeringTypeIxRs` +- New const `RolePolicy` +- New const `Enum0Unavailable` +- New const `PeeringLocationsDirectPeeringTypeVoice` +- New const `LearnedTypeViaServiceProvider` +- New const `LookingGlassCommandBgpRoute` +- New const `CommandBgpRoute` +- New const `LookingGlassSourceTypeEdgeSite` +- New function `ServicePrefixProperties.MarshalJSON() ([]byte, error)` +- New function `*timeRFC3339.Parse(string) error` +- New function `*RegisteredAsnsClientListByPeeringPager.Err() error` +- New function `*RegisteredAsnsClientListByPeeringPager.NextPage(context.Context) bool` +- New function `NewCdnPeeringPrefixesClient(string, azcore.TokenCredential, *arm.ClientOptions) *CdnPeeringPrefixesClient` +- New function `PossibleLookingGlassCommandValues() []LookingGlassCommand` +- New function `NewLookingGlassClient(string, azcore.TokenCredential, *arm.ClientOptions) *LookingGlassClient` +- New function `timeRFC3339.MarshalJSON() ([]byte, error)` +- New function `*RegisteredPrefixesClient.CreateOrUpdate(context.Context, string, string, string, RegisteredPrefix, *RegisteredPrefixesClientCreateOrUpdateOptions) (RegisteredPrefixesClientCreateOrUpdateResponse, error)` +- New function `ConnectionMonitorTestProperties.MarshalJSON() ([]byte, error)` +- New function `*ConnectionMonitorTestsClient.CreateOrUpdate(context.Context, string, string, string, ConnectionMonitorTest, *ConnectionMonitorTestsClientCreateOrUpdateOptions) (ConnectionMonitorTestsClientCreateOrUpdateResponse, error)` +- New function `MetricSpecification.MarshalJSON() ([]byte, error)` +- New function `PeerAsnProperties.MarshalJSON() ([]byte, error)` +- New function `ConnectionMonitorTestListResult.MarshalJSON() ([]byte, error)` +- New function `ServicePrefixEvent.MarshalJSON() ([]byte, error)` +- New function `*ReceivedRoutesClientListByPeeringPager.Err() error` +- New function `*timeRFC3339.UnmarshalJSON([]byte) error` +- New function `PossibleCommandValues() []Command` +- New function `*ServicePrefixEvent.UnmarshalJSON([]byte) error` +- New function `ServiceProviderProperties.MarshalJSON() ([]byte, error)` +- New function `*LookingGlassClient.Invoke(context.Context, LookingGlassCommand, LookingGlassSourceType, string, string, *LookingGlassClientInvokeOptions) (LookingGlassClientInvokeResponse, error)` +- New function `NewServiceCountriesClient(string, azcore.TokenCredential, *arm.ClientOptions) *ServiceCountriesClient` +- New function `*RegisteredPrefixesClient.Delete(context.Context, string, string, string, *RegisteredPrefixesClientDeleteOptions) (RegisteredPrefixesClientDeleteResponse, error)` +- New function `LegacyPeeringsKind.ToPtr() *LegacyPeeringsKind` +- New function `PeeringLocationsDirectPeeringType.ToPtr() *PeeringLocationsDirectPeeringType` +- New function `PossiblePeeringLocationsKindValues() []PeeringLocationsKind` +- New function `NewConnectionMonitorTestsClient(string, azcore.TokenCredential, *arm.ClientOptions) *ConnectionMonitorTestsClient` +- New function `*RegisteredPrefixesClient.ListByPeering(string, string, *RegisteredPrefixesClientListByPeeringOptions) *RegisteredPrefixesClientListByPeeringPager` +- New function `*ServiceCountriesClientListPager.PageResponse() ServiceCountriesClientListResponse` +- New function `*CdnPeeringPrefixesClientListPager.PageResponse() CdnPeeringPrefixesClientListResponse` +- New function `PossibleRoleValues() []Role` +- New function `Role.ToPtr() *Role` +- New function `CdnPeeringPrefixListResult.MarshalJSON() ([]byte, error)` +- New function `LookingGlassSourceType.ToPtr() *LookingGlassSourceType` +- New function `PossibleLegacyPeeringsKindValues() []LegacyPeeringsKind` +- New function `*RegisteredAsnsClient.CreateOrUpdate(context.Context, string, string, string, RegisteredAsn, *RegisteredAsnsClientCreateOrUpdateOptions) (RegisteredAsnsClientCreateOrUpdateResponse, error)` +- New function `RegisteredAsnListResult.MarshalJSON() ([]byte, error)` +- New function `PossiblePeeringLocationsDirectPeeringTypeValues() []PeeringLocationsDirectPeeringType` +- New function `LogAnalyticsWorkspaceProperties.MarshalJSON() ([]byte, error)` +- New function `ServiceSpecification.MarshalJSON() ([]byte, error)` +- New function `*RegisteredAsnsClientListByPeeringPager.PageResponse() RegisteredAsnsClientListByPeeringResponse` +- New function `*ConnectionMonitorTestsClientListByPeeringServicePager.NextPage(context.Context) bool` +- New function `*CdnPeeringPrefixesClientListPager.Err() error` +- New function `*ConnectionMonitorTestsClient.Get(context.Context, string, string, string, *ConnectionMonitorTestsClientGetOptions) (ConnectionMonitorTestsClientGetResponse, error)` +- New function `*RegisteredAsnsClient.Get(context.Context, string, string, string, *RegisteredAsnsClientGetOptions) (RegisteredAsnsClientGetResponse, error)` +- New function `*CdnPeeringPrefixesClient.List(string, *CdnPeeringPrefixesClientListOptions) *CdnPeeringPrefixesClientListPager` +- New function `RegisteredPrefixListResult.MarshalJSON() ([]byte, error)` +- New function `*ConnectionMonitorTestsClientListByPeeringServicePager.Err() error` +- New function `*ConnectionMonitorTestsClientListByPeeringServicePager.PageResponse() ConnectionMonitorTestsClientListByPeeringServiceResponse` +- New function `*ConnectionMonitorTestsClient.ListByPeeringService(string, string, *ConnectionMonitorTestsClientListByPeeringServiceOptions) *ConnectionMonitorTestsClientListByPeeringServicePager` +- New function `*ServiceCountriesClientListPager.NextPage(context.Context) bool` +- New function `Command.ToPtr() *Command` +- New function `NewRegisteredPrefixesClient(string, azcore.TokenCredential, *arm.ClientOptions) *RegisteredPrefixesClient` +- New function `PossibleLookingGlassSourceTypeValues() []LookingGlassSourceType` +- New function `NewRegisteredAsnsClient(string, azcore.TokenCredential, *arm.ClientOptions) *RegisteredAsnsClient` +- New function `*timeRFC3339.UnmarshalText([]byte) error` +- New function `*PrefixesClient.Delete(context.Context, string, string, string, *PrefixesClientDeleteOptions) (PrefixesClientDeleteResponse, error)` +- New function `NewReceivedRoutesClient(string, azcore.TokenCredential, *arm.ClientOptions) *ReceivedRoutesClient` +- New function `*CdnPeeringPrefixesClientListPager.NextPage(context.Context) bool` +- New function `*ConnectionMonitorTestsClient.Delete(context.Context, string, string, string, *ConnectionMonitorTestsClientDeleteOptions) (ConnectionMonitorTestsClientDeleteResponse, error)` +- New function `*ReceivedRoutesClientListByPeeringPager.NextPage(context.Context) bool` +- New function `*RegisteredPrefixesClient.Get(context.Context, string, string, string, *RegisteredPrefixesClientGetOptions) (RegisteredPrefixesClientGetResponse, error)` +- New function `*RegisteredAsnsClient.Delete(context.Context, string, string, string, *RegisteredAsnsClientDeleteOptions) (RegisteredAsnsClientDeleteResponse, error)` +- New function `*RegisteredPrefixesClientListByPeeringPager.PageResponse() RegisteredPrefixesClientListByPeeringResponse` +- New function `*ReceivedRoutesClientListByPeeringPager.PageResponse() ReceivedRoutesClientListByPeeringResponse` +- New function `*PrefixesClient.CreateOrUpdate(context.Context, string, string, string, ServicePrefix, *PrefixesClientCreateOrUpdateOptions) (PrefixesClientCreateOrUpdateResponse, error)` +- New function `timeRFC3339.MarshalText() ([]byte, error)` +- New function `ServiceCountryListResult.MarshalJSON() ([]byte, error)` +- New function `*RegisteredAsnsClient.ListByPeering(string, string, *RegisteredAsnsClientListByPeeringOptions) *RegisteredAsnsClientListByPeeringPager` +- New function `*PrefixesClient.Get(context.Context, string, string, string, *PrefixesClientGetOptions) (PrefixesClientGetResponse, error)` +- New function `*RegisteredPrefixesClientListByPeeringPager.Err() error` +- New function `*ReceivedRoutesClient.ListByPeering(string, string, *ReceivedRoutesClientListByPeeringOptions) *ReceivedRoutesClientListByPeeringPager` +- New function `PeeringLocationsKind.ToPtr() *PeeringLocationsKind` +- New function `LookingGlassCommand.ToPtr() *LookingGlassCommand` +- New function `*RegisteredPrefixesClientListByPeeringPager.NextPage(context.Context) bool` +- New function `*ServiceCountriesClientListPager.Err() error` +- New function `*ServicesClient.InitializeConnectionMonitor(context.Context, *ServicesClientInitializeConnectionMonitorOptions) (ServicesClientInitializeConnectionMonitorResponse, error)` +- New function `*ServiceCountriesClient.List(*ServiceCountriesClientListOptions) *ServiceCountriesClientListPager` +- New function `ReceivedRouteListResult.MarshalJSON() ([]byte, error)` +- New struct `CdnPeeringPrefix` +- New struct `CdnPeeringPrefixListResult` +- New struct `CdnPeeringPrefixProperties` +- New struct `CdnPeeringPrefixesClient` +- New struct `CdnPeeringPrefixesClientListOptions` +- New struct `CdnPeeringPrefixesClientListPager` +- New struct `CdnPeeringPrefixesClientListResponse` +- New struct `CdnPeeringPrefixesClientListResult` +- New struct `ConnectionMonitorTest` +- New struct `ConnectionMonitorTestListResult` +- New struct `ConnectionMonitorTestProperties` +- New struct `ConnectionMonitorTestsClient` +- New struct `ConnectionMonitorTestsClientCreateOrUpdateOptions` +- New struct `ConnectionMonitorTestsClientCreateOrUpdateResponse` +- New struct `ConnectionMonitorTestsClientCreateOrUpdateResult` +- New struct `ConnectionMonitorTestsClientDeleteOptions` +- New struct `ConnectionMonitorTestsClientDeleteResponse` +- New struct `ConnectionMonitorTestsClientGetOptions` +- New struct `ConnectionMonitorTestsClientGetResponse` +- New struct `ConnectionMonitorTestsClientGetResult` +- New struct `ConnectionMonitorTestsClientListByPeeringServiceOptions` +- New struct `ConnectionMonitorTestsClientListByPeeringServicePager` +- New struct `ConnectionMonitorTestsClientListByPeeringServiceResponse` +- New struct `ConnectionMonitorTestsClientListByPeeringServiceResult` +- New struct `ContactDetail` +- New struct `LogAnalyticsWorkspaceProperties` +- New struct `LookingGlassClient` +- New struct `LookingGlassClientInvokeOptions` +- New struct `LookingGlassClientInvokeResponse` +- New struct `LookingGlassClientInvokeResult` +- New struct `LookingGlassOutput` +- New struct `MetricDimension` +- New struct `MetricSpecification` +- New struct `OperationProperties` +- New struct `PrefixesClientCreateOrUpdateOptions` +- New struct `PrefixesClientCreateOrUpdateResponse` +- New struct `PrefixesClientCreateOrUpdateResult` +- New struct `PrefixesClientDeleteOptions` +- New struct `PrefixesClientDeleteResponse` +- New struct `PrefixesClientGetOptions` +- New struct `PrefixesClientGetResponse` +- New struct `PrefixesClientGetResult` +- New struct `ReceivedRoute` +- New struct `ReceivedRouteListResult` +- New struct `ReceivedRoutesClient` +- New struct `ReceivedRoutesClientListByPeeringOptions` +- New struct `ReceivedRoutesClientListByPeeringPager` +- New struct `ReceivedRoutesClientListByPeeringResponse` +- New struct `ReceivedRoutesClientListByPeeringResult` +- New struct `RegisteredAsn` +- New struct `RegisteredAsnListResult` +- New struct `RegisteredAsnProperties` +- New struct `RegisteredAsnsClient` +- New struct `RegisteredAsnsClientCreateOrUpdateOptions` +- New struct `RegisteredAsnsClientCreateOrUpdateResponse` +- New struct `RegisteredAsnsClientCreateOrUpdateResult` +- New struct `RegisteredAsnsClientDeleteOptions` +- New struct `RegisteredAsnsClientDeleteResponse` +- New struct `RegisteredAsnsClientGetOptions` +- New struct `RegisteredAsnsClientGetResponse` +- New struct `RegisteredAsnsClientGetResult` +- New struct `RegisteredAsnsClientListByPeeringOptions` +- New struct `RegisteredAsnsClientListByPeeringPager` +- New struct `RegisteredAsnsClientListByPeeringResponse` +- New struct `RegisteredAsnsClientListByPeeringResult` +- New struct `RegisteredPrefix` +- New struct `RegisteredPrefixListResult` +- New struct `RegisteredPrefixProperties` +- New struct `RegisteredPrefixesClient` +- New struct `RegisteredPrefixesClientCreateOrUpdateOptions` +- New struct `RegisteredPrefixesClientCreateOrUpdateResponse` +- New struct `RegisteredPrefixesClientCreateOrUpdateResult` +- New struct `RegisteredPrefixesClientDeleteOptions` +- New struct `RegisteredPrefixesClientDeleteResponse` +- New struct `RegisteredPrefixesClientGetOptions` +- New struct `RegisteredPrefixesClientGetResponse` +- New struct `RegisteredPrefixesClientGetResult` +- New struct `RegisteredPrefixesClientListByPeeringOptions` +- New struct `RegisteredPrefixesClientListByPeeringPager` +- New struct `RegisteredPrefixesClientListByPeeringResponse` +- New struct `RegisteredPrefixesClientListByPeeringResult` +- New struct `ServiceCountriesClient` +- New struct `ServiceCountriesClientListOptions` +- New struct `ServiceCountriesClientListPager` +- New struct `ServiceCountriesClientListResponse` +- New struct `ServiceCountriesClientListResult` +- New struct `ServiceCountry` +- New struct `ServiceCountryListResult` +- New struct `ServicePrefixEvent` +- New struct `ServiceSKU` +- New struct `ServiceSpecification` +- New struct `ServicesClientInitializeConnectionMonitorOptions` +- New struct `ServicesClientInitializeConnectionMonitorResponse` +- New field `PeeringServicePrefixKey` in struct `ServicePrefixProperties` +- New field `ErrorMessage` in struct `ServicePrefixProperties` +- New field `Events` in struct `ServicePrefixProperties` +- New field `ProviderBackupPeeringLocation` in struct `ServiceProperties` +- New field `ProviderPrimaryPeeringLocation` in struct `ServiceProperties` +- New field `LogAnalyticsWorkspaceProperties` in struct `ServiceProperties` +- New field `SKU` in struct `Service` +- New field `Properties` in struct `Operation` +- New field `Asn` in struct `LegacyPeeringsClientListOptions` +- New field `MicrosoftTrackingID` in struct `DirectConnection` +- New field `ErrorMessage` in struct `DirectConnection` +- New field `ErrorMessage` in struct `ExchangeConnection` +- New field `PeerContactDetail` in struct `PeerAsnProperties` +- New field `ErrorMessage` in struct `PeerAsnProperties` +- New field `PeeringLocations` in struct `ServiceProviderProperties` +- New field `Country` in struct `ServiceLocationsClientListOptions` +- New field `Expand` in struct `PrefixesClientListByPeeringServiceOptions` + + ## 0.2.1 (2022-02-22) ### Other Changes diff --git a/sdk/resourcemanager/peering/armpeering/autorest.md b/sdk/resourcemanager/peering/armpeering/autorest.md index b4a88bf88149..2df168c6faf5 100644 --- a/sdk/resourcemanager/peering/armpeering/autorest.md +++ b/sdk/resourcemanager/peering/armpeering/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/peering/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8e4746332979ed6ff3577bdc97dd2065a7577598/specification/peering/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/efd3d669a86d2e123f57ac3a43e5af4bb9e3a29f/specification/peering/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/efd3d669a86d2e123f57ac3a43e5af4bb9e3a29f/specification/peering/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.1 +module-version: 0.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/peering/armpeering/go.mod b/sdk/resourcemanager/peering/armpeering/go.mod index 26c1fe5c02fa..ab1ea9db91ba 100644 --- a/sdk/resourcemanager/peering/armpeering/go.mod +++ b/sdk/resourcemanager/peering/armpeering/go.mod @@ -4,5 +4,5 @@ go 1.16 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 ) diff --git a/sdk/resourcemanager/peering/armpeering/go.sum b/sdk/resourcemanager/peering/armpeering/go.sum index 2ce51d3b8174..27c9bd79d559 100644 --- a/sdk/resourcemanager/peering/armpeering/go.sum +++ b/sdk/resourcemanager/peering/armpeering/go.sum @@ -1,9 +1,10 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0 h1:8wVJL0HUP5yDFXvotdewORTw7Yu88JbreWN/mobSvsQ= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.0/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0 h1:bLRntPH25SkY1uZ/YZW+dmxNky9r1fAHvDFrzluo+4Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.0/go.mod h1:TmXReXZ9yPp5D5TBRMTAtyz+UyOl15Py4hL5E5p6igQ= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1 h1:RxemzI2cHD0A8WyMqHu/UnDjfpGES/cmjtPbQoktWqs= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.13.1/go.mod h1:+nVKciyKD2J9TyVcEQ82Bo9b+3F92PiQfHrIE/zqLqM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1 h1:sLZ/Y+P/5RRtsXWylBjB5lkgixYfm0MQPiwrSX//JSo= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.9.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,6 +14,8 @@ github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= +github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_cdnpeeringprefixes_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_cdnpeeringprefixes_client_test.go new file mode 100644 index 000000000000..57369def2d2e --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_cdnpeeringprefixes_client_test.go @@ -0,0 +1,41 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListCdnPeeringPrefixes.json +func ExampleCdnPeeringPrefixesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewCdnPeeringPrefixesClient("", cred, nil) + pager := client.List("", + nil) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_connectionmonitortests_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_connectionmonitortests_client_test.go new file mode 100644 index 000000000000..2993652be596 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_connectionmonitortests_client_test.go @@ -0,0 +1,107 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetConnectionMonitorTest.json +func ExampleConnectionMonitorTestsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewConnectionMonitorTestsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.ConnectionMonitorTestsClientGetResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreateOrUpdateConnectionMonitorTest.json +func ExampleConnectionMonitorTestsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewConnectionMonitorTestsClient("", cred, nil) + res, err := client.CreateOrUpdate(ctx, + "", + "", + "", + armpeering.ConnectionMonitorTest{ + Properties: &armpeering.ConnectionMonitorTestProperties{ + Destination: to.StringPtr(""), + DestinationPort: to.Int32Ptr(443), + SourceAgent: to.StringPtr(""), + TestFrequencyInSec: to.Int32Ptr(30), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.ConnectionMonitorTestsClientCreateOrUpdateResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeleteConnectionMonitorTest.json +func ExampleConnectionMonitorTestsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewConnectionMonitorTestsClient("", cred, nil) + _, err = client.Delete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListConnectionMonitorTestsByPeeringService.json +func ExampleConnectionMonitorTestsClient_ListByPeeringService() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewConnectionMonitorTestsClient("", cred, nil) + pager := client.ListByPeeringService("", + "", + nil) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_legacypeerings_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_legacypeerings_client_test.go index 5ae59925115e..27a118ff026b 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_legacypeerings_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_legacypeerings_client_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListLegacyPeerings.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListLegacyPeerings.json func ExampleLegacyPeeringsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -25,8 +25,8 @@ func ExampleLegacyPeeringsClient_List() { ctx := context.Background() client := armpeering.NewLegacyPeeringsClient("", cred, nil) pager := client.List("", - armpeering.Enum1("Exchange"), - nil) + armpeering.LegacyPeeringsKind("Exchange"), + &armpeering.LegacyPeeringsClientListOptions{Asn: nil}) for { nextResult := pager.NextPage(ctx) if err := pager.Err(); err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_lookingglass_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_lookingglass_client_test.go new file mode 100644 index 000000000000..19cc188cadc8 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_lookingglass_client_test.go @@ -0,0 +1,37 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/LookingGlassInvokeCommand.json +func ExampleLookingGlassClient_Invoke() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewLookingGlassClient("", cred, nil) + res, err := client.Invoke(ctx, + armpeering.LookingGlassCommand("Traceroute"), + armpeering.LookingGlassSourceType("AzureRegion"), + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.LookingGlassClientInvokeResult) +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_operations_client_test.go index 54565740b98a..a9ac807283fb 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_operations_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_operations_client_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringOperations.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringOperations.json func ExampleOperationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerasns_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerasns_client_test.go index 380237fc3d63..da777a58d7d9 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerasns_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerasns_client_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/GetPeerAsn.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetPeerAsn.json func ExamplePeerAsnsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -34,7 +34,7 @@ func ExamplePeerAsnsClient_Get() { log.Printf("Response result: %#v\n", res.PeerAsnsClientGetResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/CreatePeerAsn.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreatePeerAsn.json func ExamplePeerAsnsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -47,13 +47,22 @@ func ExamplePeerAsnsClient_CreateOrUpdate() { armpeering.PeerAsn{ Properties: &armpeering.PeerAsnProperties{ PeerAsn: to.Int32Ptr(65000), - PeerContactInfo: &armpeering.ContactInfo{ - Emails: []*string{ - to.StringPtr("abc@contoso.com"), - to.StringPtr("xyz@contoso.com")}, - Phone: []*string{ - to.StringPtr("+1 (234) 567-8900")}, - }, + PeerContactDetail: []*armpeering.ContactDetail{ + { + Email: to.StringPtr(""), + Phone: to.StringPtr(""), + Role: armpeering.Role("Noc").ToPtr(), + }, + { + Email: to.StringPtr(""), + Phone: to.StringPtr(""), + Role: armpeering.Role("Policy").ToPtr(), + }, + { + Email: to.StringPtr(""), + Phone: to.StringPtr(""), + Role: armpeering.Role("Technical").ToPtr(), + }}, PeerName: to.StringPtr(""), }, }, @@ -64,7 +73,7 @@ func ExamplePeerAsnsClient_CreateOrUpdate() { log.Printf("Response result: %#v\n", res.PeerAsnsClientCreateOrUpdateResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/DeletePeerAsn.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeletePeerAsn.json func ExamplePeerAsnsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -80,7 +89,7 @@ func ExamplePeerAsnsClient_Delete() { } } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeerAsnsBySubscription.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeerAsnsBySubscription.json func ExamplePeerAsnsClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringlocations_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringlocations_client_test.go index da7f44f1f271..819a8925df4e 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringlocations_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringlocations_client_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListDirectPeeringLocations.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListDirectPeeringLocations.json func ExampleLocationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -24,7 +24,7 @@ func ExampleLocationsClient_List() { } ctx := context.Background() client := armpeering.NewLocationsClient("", cred, nil) - pager := client.List(armpeering.Enum14("Direct"), + pager := client.List(armpeering.PeeringLocationsKind("Direct"), &armpeering.LocationsClientListOptions{DirectPeeringType: nil}) for { nextResult := pager.NextPage(ctx) diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringmanagementclient_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringmanagementclient_client_test.go index f177fb8045f5..3a418f7205f0 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringmanagementclient_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringmanagementclient_client_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/CheckServiceProviderAvailability.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CheckServiceProviderAvailability.json func ExampleManagementClient_CheckServiceProviderAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerings_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerings_client_test.go index abeeae524e0c..f27b1c776386 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerings_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peerings_client_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/GetPeering.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetPeering.json func ExamplePeeringsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -35,7 +35,7 @@ func ExamplePeeringsClient_Get() { log.Printf("Response result: %#v\n", res.PeeringsClientGetResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/CreateDirectPeering.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreateDirectPeering.json func ExamplePeeringsClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -67,14 +67,7 @@ func ExamplePeeringsClient_CreateOrUpdate() { UseForPeeringService: to.BoolPtr(false), }, { - BandwidthInMbps: to.Int32Ptr(10000), - BgpSession: &armpeering.BgpSession{ - MaxPrefixesAdvertisedV4: to.Int32Ptr(1000), - MaxPrefixesAdvertisedV6: to.Int32Ptr(100), - MD5AuthenticationKey: to.StringPtr(""), - SessionPrefixV4: to.StringPtr(""), - SessionPrefixV6: to.StringPtr(""), - }, + BandwidthInMbps: to.Int32Ptr(10000), ConnectionIdentifier: to.StringPtr(""), PeeringDBFacilityID: to.Int32Ptr(99999), SessionAddressProvider: armpeering.SessionAddressProvider("Microsoft").ToPtr(), @@ -84,12 +77,11 @@ func ExamplePeeringsClient_CreateOrUpdate() { PeerAsn: &armpeering.SubResource{ ID: to.StringPtr(""), }, - UseForPeeringService: to.BoolPtr(false), }, PeeringLocation: to.StringPtr(""), }, SKU: &armpeering.SKU{ - Name: armpeering.Name("Basic_Direct_Free").ToPtr(), + Name: to.StringPtr(""), }, }, nil) @@ -99,7 +91,7 @@ func ExamplePeeringsClient_CreateOrUpdate() { log.Printf("Response result: %#v\n", res.PeeringsClientCreateOrUpdateResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/DeletePeering.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeletePeering.json func ExamplePeeringsClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -116,7 +108,7 @@ func ExamplePeeringsClient_Delete() { } } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/UpdatePeeringTags.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/UpdatePeeringTags.json func ExamplePeeringsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +132,7 @@ func ExamplePeeringsClient_Update() { log.Printf("Response result: %#v\n", res.PeeringsClientUpdateResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringsByResourceGroup.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringsByResourceGroup.json func ExamplePeeringsClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -164,7 +156,7 @@ func ExamplePeeringsClient_ListByResourceGroup() { } } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringsBySubscription.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringsBySubscription.json func ExamplePeeringsClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicecountries_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicecountries_client_test.go new file mode 100644 index 000000000000..85838a7bd41f --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicecountries_client_test.go @@ -0,0 +1,40 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringServiceCountriesBySubscription.json +func ExampleServiceCountriesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewServiceCountriesClient("", cred, nil) + pager := client.List(nil) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicelocations_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicelocations_client_test.go index 185dee7804b7..d738151b4286 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicelocations_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservicelocations_client_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringServiceLocations.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringServiceLocationsBySubscription.json func ExampleServiceLocationsClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -24,7 +24,7 @@ func ExampleServiceLocationsClient_List() { } ctx := context.Background() client := armpeering.NewServiceLocationsClient("", cred, nil) - pager := client.List(nil) + pager := client.List(&armpeering.ServiceLocationsClientListOptions{Country: nil}) for { nextResult := pager.NextPage(ctx) if err := pager.Err(); err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceprefixes_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceprefixes_client_test.go deleted file mode 100644 index 27b382d72448..000000000000 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceprefixes_client_test.go +++ /dev/null @@ -1,79 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armpeering_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" -) - -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/GetPeeringServicePrefix.json -func ExampleServicePrefixesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armpeering.NewServicePrefixesClient("", cred, nil) - res, err := client.Get(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ServicePrefixesClientGetResult) -} - -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/CreatePeeringServicePrefix.json -func ExampleServicePrefixesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armpeering.NewServicePrefixesClient("", cred, nil) - res, err := client.CreateOrUpdate(ctx, - "", - "", - "", - armpeering.ServicePrefix{ - Properties: &armpeering.ServicePrefixProperties{ - Prefix: to.StringPtr(""), - }, - }, - nil) - if err != nil { - log.Fatal(err) - } - log.Printf("Response result: %#v\n", res.ServicePrefixesClientCreateOrUpdateResult) -} - -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/DeletePeeringServicePrefix.json -func ExampleServicePrefixesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client := armpeering.NewServicePrefixesClient("", cred, nil) - _, err = client.Delete(ctx, - "", - "", - "", - nil) - if err != nil { - log.Fatal(err) - } -} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceproviders_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceproviders_client_test.go index 8110be097955..feb86a2bf1e8 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceproviders_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringserviceproviders_client_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringServiceProviders.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringServiceProviders.json func ExampleServiceProvidersClient_List() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservices_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservices_client_test.go index 582ac150fe75..8d41b88e968a 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservices_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_peeringservices_client_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/GetPeeringService.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetPeeringService.json func ExampleServicesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -35,7 +35,7 @@ func ExampleServicesClient_Get() { log.Printf("Response result: %#v\n", res.ServicesClientGetResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/CreatePeeringService.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreatePeeringService.json func ExampleServicesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -49,8 +49,10 @@ func ExampleServicesClient_CreateOrUpdate() { armpeering.Service{ Location: to.StringPtr(""), Properties: &armpeering.ServiceProperties{ - PeeringServiceLocation: to.StringPtr(""), - PeeringServiceProvider: to.StringPtr(""), + PeeringServiceLocation: to.StringPtr(""), + PeeringServiceProvider: to.StringPtr(""), + ProviderBackupPeeringLocation: to.StringPtr(""), + ProviderPrimaryPeeringLocation: to.StringPtr(""), }, }, nil) @@ -60,7 +62,7 @@ func ExampleServicesClient_CreateOrUpdate() { log.Printf("Response result: %#v\n", res.ServicesClientCreateOrUpdateResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/DeletePeeringService.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeletePeeringService.json func ExampleServicesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -77,7 +79,7 @@ func ExampleServicesClient_Delete() { } } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/UpdatePeeringServiceTags.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/UpdatePeeringServiceTags.json func ExampleServicesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +103,7 @@ func ExampleServicesClient_Update() { log.Printf("Response result: %#v\n", res.ServicesClientUpdateResult) } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringServicesByResourceGroup.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringServicesByResourceGroup.json func ExampleServicesClient_ListByResourceGroup() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -125,7 +127,7 @@ func ExampleServicesClient_ListByResourceGroup() { } } -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPeeringServicesBySubscription.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPeeringServicesBySubscription.json func ExampleServicesClient_ListBySubscription() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -147,3 +149,18 @@ func ExampleServicesClient_ListBySubscription() { } } } + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/InitializeConnectionMonitor.json +func ExampleServicesClient_InitializeConnectionMonitor() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewServicesClient("", cred, nil) + _, err = client.InitializeConnectionMonitor(ctx, + nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_prefixes_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_prefixes_client_test.go index f585be041e02..5589bfd12781 100644 --- a/sdk/resourcemanager/peering/armpeering/ze_generated_example_prefixes_client_test.go +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_prefixes_client_test.go @@ -12,11 +12,74 @@ import ( "context" "log" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" ) -// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/preview/2019-08-01-preview/examples/ListPrefixesByPeeringService.json +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetPeeringServicePrefix.json +func ExamplePrefixesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewPrefixesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + &armpeering.PrefixesClientGetOptions{Expand: nil}) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.PrefixesClientGetResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreatePeeringServicePrefix.json +func ExamplePrefixesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewPrefixesClient("", cred, nil) + res, err := client.CreateOrUpdate(ctx, + "", + "", + "", + armpeering.ServicePrefix{ + Properties: &armpeering.ServicePrefixProperties{ + PeeringServicePrefixKey: to.StringPtr(""), + Prefix: to.StringPtr(""), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.PrefixesClientCreateOrUpdateResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeletePeeringServicePrefix.json +func ExamplePrefixesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewPrefixesClient("", cred, nil) + _, err = client.Delete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListPrefixesByPeeringService.json func ExamplePrefixesClient_ListByPeeringService() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -26,7 +89,7 @@ func ExamplePrefixesClient_ListByPeeringService() { client := armpeering.NewPrefixesClient("", cred, nil) pager := client.ListByPeeringService("", "", - nil) + &armpeering.PrefixesClientListByPeeringServiceOptions{Expand: nil}) for { nextResult := pager.NextPage(ctx) if err := pager.Err(); err != nil { diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_receivedroutes_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_receivedroutes_client_test.go new file mode 100644 index 000000000000..3af2f8139711 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_receivedroutes_client_test.go @@ -0,0 +1,48 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetPeeringReceivedRoutes.json +func ExampleReceivedRoutesClient_ListByPeering() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewReceivedRoutesClient("", cred, nil) + pager := client.ListByPeering("", + "", + &armpeering.ReceivedRoutesClientListByPeeringOptions{Prefix: to.StringPtr(""), + AsPath: to.StringPtr(""), + OriginAsValidationState: to.StringPtr(""), + RpkiValidationState: to.StringPtr(""), + SkipToken: nil, + }) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredasns_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredasns_client_test.go new file mode 100644 index 000000000000..290b63091b11 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredasns_client_test.go @@ -0,0 +1,104 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetRegisteredAsn.json +func ExampleRegisteredAsnsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredAsnsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.RegisteredAsnsClientGetResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreateRegisteredAsn.json +func ExampleRegisteredAsnsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredAsnsClient("", cred, nil) + res, err := client.CreateOrUpdate(ctx, + "", + "", + "", + armpeering.RegisteredAsn{ + Properties: &armpeering.RegisteredAsnProperties{ + Asn: to.Int32Ptr(65000), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.RegisteredAsnsClientCreateOrUpdateResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeleteRegisteredAsn.json +func ExampleRegisteredAsnsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredAsnsClient("", cred, nil) + _, err = client.Delete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListRegisteredAsnsByPeering.json +func ExampleRegisteredAsnsClient_ListByPeering() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredAsnsClient("", cred, nil) + pager := client.ListByPeering("", + "", + nil) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredprefixes_client_test.go b/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredprefixes_client_test.go new file mode 100644 index 000000000000..1c9cacbeb1f6 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/ze_generated_example_registeredprefixes_client_test.go @@ -0,0 +1,104 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/peering/armpeering" +) + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/GetRegisteredPrefix.json +func ExampleRegisteredPrefixesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredPrefixesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.RegisteredPrefixesClientGetResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/CreateRegisteredPrefix.json +func ExampleRegisteredPrefixesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredPrefixesClient("", cred, nil) + res, err := client.CreateOrUpdate(ctx, + "", + "", + "", + armpeering.RegisteredPrefix{ + Properties: &armpeering.RegisteredPrefixProperties{ + Prefix: to.StringPtr(""), + }, + }, + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("Response result: %#v\n", res.RegisteredPrefixesClientCreateOrUpdateResult) +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/DeleteRegisteredPrefix.json +func ExampleRegisteredPrefixesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredPrefixesClient("", cred, nil) + _, err = client.Delete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} + +// x-ms-original-file: specification/peering/resource-manager/Microsoft.Peering/stable/2021-06-01/examples/ListRegisteredPrefixesByPeering.json +func ExampleRegisteredPrefixesClient_ListByPeering() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armpeering.NewRegisteredPrefixesClient("", cred, nil) + pager := client.ListByPeering("", + "", + nil) + for { + nextResult := pager.NextPage(ctx) + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + if !nextResult { + break + } + for _, v := range pager.PageResponse().Value { + log.Printf("Pager result: %#v\n", v) + } + } +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_cdnpeeringprefixes_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_cdnpeeringprefixes_client.go new file mode 100644 index 000000000000..8f529dd4ba54 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_cdnpeeringprefixes_client.go @@ -0,0 +1,94 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CdnPeeringPrefixesClient contains the methods for the CdnPeeringPrefixes group. +// Don't use this type directly, use NewCdnPeeringPrefixesClient() instead. +type CdnPeeringPrefixesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewCdnPeeringPrefixesClient creates a new instance of CdnPeeringPrefixesClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewCdnPeeringPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CdnPeeringPrefixesClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &CdnPeeringPrefixesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// List - Lists all of the advertised prefixes for the specified peering location +// If the operation fails it returns an *azcore.ResponseError type. +// peeringLocation - The peering location. +// options - CdnPeeringPrefixesClientListOptions contains the optional parameters for the CdnPeeringPrefixesClient.List method. +func (client *CdnPeeringPrefixesClient) List(peeringLocation string, options *CdnPeeringPrefixesClientListOptions) *CdnPeeringPrefixesClientListPager { + return &CdnPeeringPrefixesClientListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, peeringLocation, options) + }, + advancer: func(ctx context.Context, resp CdnPeeringPrefixesClientListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CdnPeeringPrefixListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *CdnPeeringPrefixesClient) listCreateRequest(ctx context.Context, peeringLocation string, options *CdnPeeringPrefixesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/cdnPeeringPrefixes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("peeringLocation", peeringLocation) + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CdnPeeringPrefixesClient) listHandleResponse(resp *http.Response) (CdnPeeringPrefixesClientListResponse, error) { + result := CdnPeeringPrefixesClientListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CdnPeeringPrefixListResult); err != nil { + return CdnPeeringPrefixesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_connectionmonitortests_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_connectionmonitortests_client.go new file mode 100644 index 000000000000..81f406e40707 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_connectionmonitortests_client.go @@ -0,0 +1,281 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ConnectionMonitorTestsClient contains the methods for the ConnectionMonitorTests group. +// Don't use this type directly, use NewConnectionMonitorTestsClient() instead. +type ConnectionMonitorTestsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectionMonitorTestsClient creates a new instance of ConnectionMonitorTestsClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectionMonitorTestsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectionMonitorTestsClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ConnectionMonitorTestsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// CreateOrUpdate - Creates or updates a connection monitor test with the specified name under the given subscription, resource +// group and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// connectionMonitorTestName - The name of the connection monitor test +// connectionMonitorTest - The properties needed to create a connection monitor test +// options - ConnectionMonitorTestsClientCreateOrUpdateOptions contains the optional parameters for the ConnectionMonitorTestsClient.CreateOrUpdate +// method. +func (client *ConnectionMonitorTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, connectionMonitorTest ConnectionMonitorTest, options *ConnectionMonitorTestsClientCreateOrUpdateOptions) (ConnectionMonitorTestsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, peeringServiceName, connectionMonitorTestName, connectionMonitorTest, options) + if err != nil { + return ConnectionMonitorTestsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorTestsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ConnectionMonitorTestsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectionMonitorTestsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, connectionMonitorTest ConnectionMonitorTest, options *ConnectionMonitorTestsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if connectionMonitorTestName == "" { + return nil, errors.New("parameter connectionMonitorTestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorTestName}", url.PathEscape(connectionMonitorTestName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, connectionMonitorTest) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectionMonitorTestsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectionMonitorTestsClientCreateOrUpdateResponse, error) { + result := ConnectionMonitorTestsClientCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorTest); err != nil { + return ConnectionMonitorTestsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an existing connection monitor test with the specified name under the given subscription, resource group +// and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// connectionMonitorTestName - The name of the connection monitor test +// options - ConnectionMonitorTestsClientDeleteOptions contains the optional parameters for the ConnectionMonitorTestsClient.Delete +// method. +func (client *ConnectionMonitorTestsClient) Delete(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, options *ConnectionMonitorTestsClientDeleteOptions) (ConnectionMonitorTestsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, peeringServiceName, connectionMonitorTestName, options) + if err != nil { + return ConnectionMonitorTestsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorTestsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectionMonitorTestsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectionMonitorTestsClientDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectionMonitorTestsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, options *ConnectionMonitorTestsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if connectionMonitorTestName == "" { + return nil, errors.New("parameter connectionMonitorTestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorTestName}", url.PathEscape(connectionMonitorTestName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets an existing connection monitor test with the specified name under the given subscription, resource group and +// peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// connectionMonitorTestName - The name of the connection monitor test +// options - ConnectionMonitorTestsClientGetOptions contains the optional parameters for the ConnectionMonitorTestsClient.Get +// method. +func (client *ConnectionMonitorTestsClient) Get(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, options *ConnectionMonitorTestsClientGetOptions) (ConnectionMonitorTestsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, peeringServiceName, connectionMonitorTestName, options) + if err != nil { + return ConnectionMonitorTestsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectionMonitorTestsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectionMonitorTestsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectionMonitorTestsClient) getCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, connectionMonitorTestName string, options *ConnectionMonitorTestsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests/{connectionMonitorTestName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if connectionMonitorTestName == "" { + return nil, errors.New("parameter connectionMonitorTestName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{connectionMonitorTestName}", url.PathEscape(connectionMonitorTestName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectionMonitorTestsClient) getHandleResponse(resp *http.Response) (ConnectionMonitorTestsClientGetResponse, error) { + result := ConnectionMonitorTestsClientGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorTest); err != nil { + return ConnectionMonitorTestsClientGetResponse{}, err + } + return result, nil +} + +// ListByPeeringService - Lists all connection monitor tests under the given subscription, resource group and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// options - ConnectionMonitorTestsClientListByPeeringServiceOptions contains the optional parameters for the ConnectionMonitorTestsClient.ListByPeeringService +// method. +func (client *ConnectionMonitorTestsClient) ListByPeeringService(resourceGroupName string, peeringServiceName string, options *ConnectionMonitorTestsClientListByPeeringServiceOptions) *ConnectionMonitorTestsClientListByPeeringServicePager { + return &ConnectionMonitorTestsClientListByPeeringServicePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByPeeringServiceCreateRequest(ctx, resourceGroupName, peeringServiceName, options) + }, + advancer: func(ctx context.Context, resp ConnectionMonitorTestsClientListByPeeringServiceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ConnectionMonitorTestListResult.NextLink) + }, + } +} + +// listByPeeringServiceCreateRequest creates the ListByPeeringService request. +func (client *ConnectionMonitorTestsClient) listByPeeringServiceCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, options *ConnectionMonitorTestsClientListByPeeringServiceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/connectionMonitorTests" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByPeeringServiceHandleResponse handles the ListByPeeringService response. +func (client *ConnectionMonitorTestsClient) listByPeeringServiceHandleResponse(resp *http.Response) (ConnectionMonitorTestsClientListByPeeringServiceResponse, error) { + result := ConnectionMonitorTestsClientListByPeeringServiceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorTestListResult); err != nil { + return ConnectionMonitorTestsClientListByPeeringServiceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_constants.go b/sdk/resourcemanager/peering/armpeering/zz_generated_constants.go index d3d783c2bf79..908c2c0553c1 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_constants.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_constants.go @@ -10,9 +10,32 @@ package armpeering const ( moduleName = "armpeering" - moduleVersion = "v0.2.1" + moduleVersion = "v0.3.0" ) +// Command - Invoked command +type Command string + +const ( + CommandBgpRoute Command = "BgpRoute" + CommandPing Command = "Ping" + CommandTraceroute Command = "Traceroute" +) + +// PossibleCommandValues returns the possible values for the Command const type. +func PossibleCommandValues() []Command { + return []Command{ + CommandBgpRoute, + CommandPing, + CommandTraceroute, + } +} + +// ToPtr returns a *Command pointing to the current value. +func (c Command) ToPtr() *Command { + return &c +} + // ConnectionState - The state of the connection. type ConnectionState string @@ -53,7 +76,10 @@ const ( DirectPeeringTypeCdn DirectPeeringType = "Cdn" DirectPeeringTypeEdge DirectPeeringType = "Edge" DirectPeeringTypeInternal DirectPeeringType = "Internal" + DirectPeeringTypeIx DirectPeeringType = "Ix" + DirectPeeringTypeIxRs DirectPeeringType = "IxRs" DirectPeeringTypeTransit DirectPeeringType = "Transit" + DirectPeeringTypeVoice DirectPeeringType = "Voice" ) // PossibleDirectPeeringTypeValues returns the possible values for the DirectPeeringType const type. @@ -62,7 +88,10 @@ func PossibleDirectPeeringTypeValues() []DirectPeeringType { DirectPeeringTypeCdn, DirectPeeringTypeEdge, DirectPeeringTypeInternal, + DirectPeeringTypeIx, + DirectPeeringTypeIxRs, DirectPeeringTypeTransit, + DirectPeeringTypeVoice, } } @@ -75,14 +104,14 @@ type Enum0 string const ( Enum0Available Enum0 = "Available" - Enum0UnAvailable Enum0 = "UnAvailable" + Enum0Unavailable Enum0 = "Unavailable" ) // PossibleEnum0Values returns the possible values for the Enum0 const type. func PossibleEnum0Values() []Enum0 { return []Enum0{ Enum0Available, - Enum0UnAvailable, + Enum0Unavailable, } } @@ -91,70 +120,6 @@ func (c Enum0) ToPtr() *Enum0 { return &c } -type Enum1 string - -const ( - Enum1Direct Enum1 = "Direct" - Enum1Exchange Enum1 = "Exchange" -) - -// PossibleEnum1Values returns the possible values for the Enum1 const type. -func PossibleEnum1Values() []Enum1 { - return []Enum1{ - Enum1Direct, - Enum1Exchange, - } -} - -// ToPtr returns a *Enum1 pointing to the current value. -func (c Enum1) ToPtr() *Enum1 { - return &c -} - -type Enum14 string - -const ( - Enum14Direct Enum14 = "Direct" - Enum14Exchange Enum14 = "Exchange" -) - -// PossibleEnum14Values returns the possible values for the Enum14 const type. -func PossibleEnum14Values() []Enum14 { - return []Enum14{ - Enum14Direct, - Enum14Exchange, - } -} - -// ToPtr returns a *Enum14 pointing to the current value. -func (c Enum14) ToPtr() *Enum14 { - return &c -} - -type Enum15 string - -const ( - Enum15Cdn Enum15 = "Cdn" - Enum15Edge Enum15 = "Edge" - Enum15Internal Enum15 = "Internal" - Enum15Transit Enum15 = "Transit" -) - -// PossibleEnum15Values returns the possible values for the Enum15 const type. -func PossibleEnum15Values() []Enum15 { - return []Enum15{ - Enum15Cdn, - Enum15Edge, - Enum15Internal, - Enum15Transit, - } -} - -// ToPtr returns a *Enum15 pointing to the current value. -func (c Enum15) ToPtr() *Enum15 { - return &c -} - // Family - The family of the peering SKU. type Family string @@ -201,16 +166,16 @@ func (c Kind) ToPtr() *Kind { type LearnedType string const ( - LearnedTypeNone LearnedType = "None" - LearnedTypeViaPartner LearnedType = "ViaPartner" - LearnedTypeViaSession LearnedType = "ViaSession" + LearnedTypeNone LearnedType = "None" + LearnedTypeViaServiceProvider LearnedType = "ViaServiceProvider" + LearnedTypeViaSession LearnedType = "ViaSession" ) // PossibleLearnedTypeValues returns the possible values for the LearnedType const type. func PossibleLearnedTypeValues() []LearnedType { return []LearnedType{ LearnedTypeNone, - LearnedTypeViaPartner, + LearnedTypeViaServiceProvider, LearnedTypeViaSession, } } @@ -220,36 +185,119 @@ func (c LearnedType) ToPtr() *LearnedType { return &c } -// Name - The name of the peering SKU. -type Name string +type LegacyPeeringsKind string + +const ( + LegacyPeeringsKindDirect LegacyPeeringsKind = "Direct" + LegacyPeeringsKindExchange LegacyPeeringsKind = "Exchange" +) + +// PossibleLegacyPeeringsKindValues returns the possible values for the LegacyPeeringsKind const type. +func PossibleLegacyPeeringsKindValues() []LegacyPeeringsKind { + return []LegacyPeeringsKind{ + LegacyPeeringsKindDirect, + LegacyPeeringsKindExchange, + } +} + +// ToPtr returns a *LegacyPeeringsKind pointing to the current value. +func (c LegacyPeeringsKind) ToPtr() *LegacyPeeringsKind { + return &c +} + +type LookingGlassCommand string const ( - NameBasicDirectFree Name = "Basic_Direct_Free" - NameBasicExchangeFree Name = "Basic_Exchange_Free" - NamePremiumDirectFree Name = "Premium_Direct_Free" - NamePremiumDirectMetered Name = "Premium_Direct_Metered" - NamePremiumDirectUnlimited Name = "Premium_Direct_Unlimited" - NamePremiumExchangeMetered Name = "Premium_Exchange_Metered" + LookingGlassCommandBgpRoute LookingGlassCommand = "BgpRoute" + LookingGlassCommandPing LookingGlassCommand = "Ping" + LookingGlassCommandTraceroute LookingGlassCommand = "Traceroute" ) -// PossibleNameValues returns the possible values for the Name const type. -func PossibleNameValues() []Name { - return []Name{ - NameBasicDirectFree, - NameBasicExchangeFree, - NamePremiumDirectFree, - NamePremiumDirectMetered, - NamePremiumDirectUnlimited, - NamePremiumExchangeMetered, +// PossibleLookingGlassCommandValues returns the possible values for the LookingGlassCommand const type. +func PossibleLookingGlassCommandValues() []LookingGlassCommand { + return []LookingGlassCommand{ + LookingGlassCommandBgpRoute, + LookingGlassCommandPing, + LookingGlassCommandTraceroute, } } -// ToPtr returns a *Name pointing to the current value. -func (c Name) ToPtr() *Name { +// ToPtr returns a *LookingGlassCommand pointing to the current value. +func (c LookingGlassCommand) ToPtr() *LookingGlassCommand { return &c } -// PrefixValidationState - The prefix validation state +type LookingGlassSourceType string + +const ( + LookingGlassSourceTypeAzureRegion LookingGlassSourceType = "AzureRegion" + LookingGlassSourceTypeEdgeSite LookingGlassSourceType = "EdgeSite" +) + +// PossibleLookingGlassSourceTypeValues returns the possible values for the LookingGlassSourceType const type. +func PossibleLookingGlassSourceTypeValues() []LookingGlassSourceType { + return []LookingGlassSourceType{ + LookingGlassSourceTypeAzureRegion, + LookingGlassSourceTypeEdgeSite, + } +} + +// ToPtr returns a *LookingGlassSourceType pointing to the current value. +func (c LookingGlassSourceType) ToPtr() *LookingGlassSourceType { + return &c +} + +type PeeringLocationsDirectPeeringType string + +const ( + PeeringLocationsDirectPeeringTypeCdn PeeringLocationsDirectPeeringType = "Cdn" + PeeringLocationsDirectPeeringTypeEdge PeeringLocationsDirectPeeringType = "Edge" + PeeringLocationsDirectPeeringTypeInternal PeeringLocationsDirectPeeringType = "Internal" + PeeringLocationsDirectPeeringTypeIx PeeringLocationsDirectPeeringType = "Ix" + PeeringLocationsDirectPeeringTypeIxRs PeeringLocationsDirectPeeringType = "IxRs" + PeeringLocationsDirectPeeringTypeTransit PeeringLocationsDirectPeeringType = "Transit" + PeeringLocationsDirectPeeringTypeVoice PeeringLocationsDirectPeeringType = "Voice" +) + +// PossiblePeeringLocationsDirectPeeringTypeValues returns the possible values for the PeeringLocationsDirectPeeringType const type. +func PossiblePeeringLocationsDirectPeeringTypeValues() []PeeringLocationsDirectPeeringType { + return []PeeringLocationsDirectPeeringType{ + PeeringLocationsDirectPeeringTypeCdn, + PeeringLocationsDirectPeeringTypeEdge, + PeeringLocationsDirectPeeringTypeInternal, + PeeringLocationsDirectPeeringTypeIx, + PeeringLocationsDirectPeeringTypeIxRs, + PeeringLocationsDirectPeeringTypeTransit, + PeeringLocationsDirectPeeringTypeVoice, + } +} + +// ToPtr returns a *PeeringLocationsDirectPeeringType pointing to the current value. +func (c PeeringLocationsDirectPeeringType) ToPtr() *PeeringLocationsDirectPeeringType { + return &c +} + +type PeeringLocationsKind string + +const ( + PeeringLocationsKindDirect PeeringLocationsKind = "Direct" + PeeringLocationsKindExchange PeeringLocationsKind = "Exchange" +) + +// PossiblePeeringLocationsKindValues returns the possible values for the PeeringLocationsKind const type. +func PossiblePeeringLocationsKindValues() []PeeringLocationsKind { + return []PeeringLocationsKind{ + PeeringLocationsKindDirect, + PeeringLocationsKindExchange, + } +} + +// ToPtr returns a *PeeringLocationsKind pointing to the current value. +func (c PeeringLocationsKind) ToPtr() *PeeringLocationsKind { + return &c +} + +// PrefixValidationState - The prefix validation state. type PrefixValidationState string const ( @@ -259,6 +307,7 @@ const ( PrefixValidationStatePending PrefixValidationState = "Pending" PrefixValidationStateUnknown PrefixValidationState = "Unknown" PrefixValidationStateVerified PrefixValidationState = "Verified" + PrefixValidationStateWarning PrefixValidationState = "Warning" ) // PossiblePrefixValidationStateValues returns the possible values for the PrefixValidationState const type. @@ -270,6 +319,7 @@ func PossiblePrefixValidationStateValues() []PrefixValidationState { PrefixValidationStatePending, PrefixValidationStateUnknown, PrefixValidationStateVerified, + PrefixValidationStateWarning, } } @@ -303,6 +353,35 @@ func (c ProvisioningState) ToPtr() *ProvisioningState { return &c } +// Role - The role of the contact. +type Role string + +const ( + RoleEscalation Role = "Escalation" + RoleNoc Role = "Noc" + RoleOther Role = "Other" + RolePolicy Role = "Policy" + RoleService Role = "Service" + RoleTechnical Role = "Technical" +) + +// PossibleRoleValues returns the possible values for the Role const type. +func PossibleRoleValues() []Role { + return []Role{ + RoleEscalation, + RoleNoc, + RoleOther, + RolePolicy, + RoleService, + RoleTechnical, + } +} + +// ToPtr returns a *Role pointing to the current value. +func (c Role) ToPtr() *Role { + return &c +} + // SessionAddressProvider - The field indicating if Microsoft provides session ip addresses. type SessionAddressProvider string diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_legacypeerings_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_legacypeerings_client.go index 69dbc0152418..24de026f2813 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_legacypeerings_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_legacypeerings_client.go @@ -18,6 +18,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -34,17 +35,17 @@ type LegacyPeeringsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewLegacyPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LegacyPeeringsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &LegacyPeeringsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -54,7 +55,7 @@ func NewLegacyPeeringsClient(subscriptionID string, credential azcore.TokenCrede // peeringLocation - The location of the peering. // kind - The kind of the peering. // options - LegacyPeeringsClientListOptions contains the optional parameters for the LegacyPeeringsClient.List method. -func (client *LegacyPeeringsClient) List(peeringLocation string, kind Enum1, options *LegacyPeeringsClientListOptions) *LegacyPeeringsClientListPager { +func (client *LegacyPeeringsClient) List(peeringLocation string, kind LegacyPeeringsKind, options *LegacyPeeringsClientListOptions) *LegacyPeeringsClientListPager { return &LegacyPeeringsClientListPager{ client: client, requester: func(ctx context.Context) (*policy.Request, error) { @@ -67,7 +68,7 @@ func (client *LegacyPeeringsClient) List(peeringLocation string, kind Enum1, opt } // listCreateRequest creates the List request. -func (client *LegacyPeeringsClient) listCreateRequest(ctx context.Context, peeringLocation string, kind Enum1, options *LegacyPeeringsClientListOptions) (*policy.Request, error) { +func (client *LegacyPeeringsClient) listCreateRequest(ctx context.Context, peeringLocation string, kind LegacyPeeringsKind, options *LegacyPeeringsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/legacyPeerings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -80,7 +81,10 @@ func (client *LegacyPeeringsClient) listCreateRequest(ctx context.Context, peeri reqQP := req.Raw().URL.Query() reqQP.Set("peeringLocation", peeringLocation) reqQP.Set("kind", string(kind)) - reqQP.Set("api-version", "2019-08-01-preview") + if options != nil && options.Asn != nil { + reqQP.Set("asn", strconv.FormatInt(int64(*options.Asn), 10)) + } + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_locations_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_locations_client.go index d18a97e010f3..babd4733426a 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_locations_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_locations_client.go @@ -34,17 +34,17 @@ type LocationsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &LocationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -53,7 +53,7 @@ func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential // If the operation fails it returns an *azcore.ResponseError type. // kind - The kind of the peering. // options - LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. -func (client *LocationsClient) List(kind Enum14, options *LocationsClientListOptions) *LocationsClientListPager { +func (client *LocationsClient) List(kind PeeringLocationsKind, options *LocationsClientListOptions) *LocationsClientListPager { return &LocationsClientListPager{ client: client, requester: func(ctx context.Context) (*policy.Request, error) { @@ -66,7 +66,7 @@ func (client *LocationsClient) List(kind Enum14, options *LocationsClientListOpt } // listCreateRequest creates the List request. -func (client *LocationsClient) listCreateRequest(ctx context.Context, kind Enum14, options *LocationsClientListOptions) (*policy.Request, error) { +func (client *LocationsClient) listCreateRequest(ctx context.Context, kind PeeringLocationsKind, options *LocationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringLocations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -81,7 +81,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, kind Enum1 if options != nil && options.DirectPeeringType != nil { reqQP.Set("directPeeringType", string(*options.DirectPeeringType)) } - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_lookingglass_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_lookingglass_client.go new file mode 100644 index 000000000000..9f6544a2cb05 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_lookingglass_client.go @@ -0,0 +1,103 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// LookingGlassClient contains the methods for the LookingGlass group. +// Don't use this type directly, use NewLookingGlassClient() instead. +type LookingGlassClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewLookingGlassClient creates a new instance of LookingGlassClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewLookingGlassClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LookingGlassClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &LookingGlassClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// Invoke - Run looking glass functionality +// If the operation fails it returns an *azcore.ResponseError type. +// command - The command to be executed: ping, traceroute, bgpRoute. +// sourceType - The type of the source: Edge site or Azure Region. +// sourceLocation - The location of the source. +// destinationIP - The IP address of the destination. +// options - LookingGlassClientInvokeOptions contains the optional parameters for the LookingGlassClient.Invoke method. +func (client *LookingGlassClient) Invoke(ctx context.Context, command LookingGlassCommand, sourceType LookingGlassSourceType, sourceLocation string, destinationIP string, options *LookingGlassClientInvokeOptions) (LookingGlassClientInvokeResponse, error) { + req, err := client.invokeCreateRequest(ctx, command, sourceType, sourceLocation, destinationIP, options) + if err != nil { + return LookingGlassClientInvokeResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return LookingGlassClientInvokeResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return LookingGlassClientInvokeResponse{}, runtime.NewResponseError(resp) + } + return client.invokeHandleResponse(resp) +} + +// invokeCreateRequest creates the Invoke request. +func (client *LookingGlassClient) invokeCreateRequest(ctx context.Context, command LookingGlassCommand, sourceType LookingGlassSourceType, sourceLocation string, destinationIP string, options *LookingGlassClientInvokeOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/lookingGlass" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("command", string(command)) + reqQP.Set("sourceType", string(sourceType)) + reqQP.Set("sourceLocation", sourceLocation) + reqQP.Set("destinationIP", destinationIP) + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// invokeHandleResponse handles the Invoke response. +func (client *LookingGlassClient) invokeHandleResponse(resp *http.Response) (LookingGlassClientInvokeResponse, error) { + result := LookingGlassClientInvokeResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.LookingGlassOutput); err != nil { + return LookingGlassClientInvokeResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_management_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_management_client.go index b25addf06a09..290c5dcc447f 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_management_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_management_client.go @@ -34,17 +34,17 @@ type ManagementClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ManagementClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -72,7 +72,7 @@ func (client *ManagementClient) CheckServiceProviderAvailability(ctx context.Con // checkServiceProviderAvailabilityCreateRequest creates the CheckServiceProviderAvailability request. func (client *ManagementClient) checkServiceProviderAvailabilityCreateRequest(ctx context.Context, checkServiceProviderAvailabilityInput CheckServiceProviderAvailabilityInput, options *ManagementClientCheckServiceProviderAvailabilityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/CheckServiceProviderAvailability" + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/checkServiceProviderAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -82,7 +82,7 @@ func (client *ManagementClient) checkServiceProviderAvailabilityCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, checkServiceProviderAvailabilityInput) diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_models.go b/sdk/resourcemanager/peering/armpeering/zz_generated_models.go index 4fc4d8d1f7bd..9db8fe85f626 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_models.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_models.go @@ -12,6 +12,7 @@ import ( "encoding/json" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" + "time" ) // BandwidthOffer - The properties that define a peering bandwidth offer. @@ -34,6 +35,12 @@ type BgpSession struct { // The maximum number of prefixes advertised over the IPv6 session. MaxPrefixesAdvertisedV6 *int32 `json:"maxPrefixesAdvertisedV6,omitempty"` + // The IPv4 session address on Microsoft's end. + MicrosoftSessionIPv4Address *string `json:"microsoftSessionIPv4Address,omitempty"` + + // The IPv6 session address on Microsoft's end. + MicrosoftSessionIPv6Address *string `json:"microsoftSessionIPv6Address,omitempty"` + // The IPv4 session address on peer's end. PeerSessionIPv4Address *string `json:"peerSessionIPv4Address,omitempty"` @@ -46,12 +53,6 @@ type BgpSession struct { // The IPv6 prefix that contains both ends' IPv6 addresses. SessionPrefixV6 *string `json:"sessionPrefixV6,omitempty"` - // READ-ONLY; The IPv4 session address on Microsoft's end. - MicrosoftSessionIPv4Address *string `json:"microsoftSessionIPv4Address,omitempty" azure:"ro"` - - // READ-ONLY; The IPv6 session address on Microsoft's end. - MicrosoftSessionIPv6Address *string `json:"microsoftSessionIPv6Address,omitempty" azure:"ro"` - // READ-ONLY; The state of the IPv4 session. SessionStateV4 *SessionStateV4 `json:"sessionStateV4,omitempty" azure:"ro"` @@ -59,32 +60,174 @@ type BgpSession struct { SessionStateV6 *SessionStateV6 `json:"sessionStateV6,omitempty" azure:"ro"` } +// CdnPeeringPrefix - The CDN peering prefix +type CdnPeeringPrefix struct { + // The properties that define a cdn peering prefix. + Properties *CdnPeeringPrefixProperties `json:"properties,omitempty"` + + // READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// CdnPeeringPrefixListResult - The paginated list of CDN peering prefixes. +type CdnPeeringPrefixListResult struct { + // The link to fetch the next page of CDN peering prefixes. + NextLink *string `json:"nextLink,omitempty"` + + // The list of CDN peering prefixes. + Value []*CdnPeeringPrefix `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CdnPeeringPrefixListResult. +func (c CdnPeeringPrefixListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// CdnPeeringPrefixProperties - The properties that define a CDN peering prefix +type CdnPeeringPrefixProperties struct { + // READ-ONLY; The Azure region. + AzureRegion *string `json:"azureRegion,omitempty" azure:"ro"` + + // READ-ONLY; The Azure service. + AzureService *string `json:"azureService,omitempty" azure:"ro"` + + // READ-ONLY; The BGP Community + BgpCommunity *string `json:"bgpCommunity,omitempty" azure:"ro"` + + // READ-ONLY; The flag that indicates whether or not this is the primary region. + IsPrimaryRegion *bool `json:"isPrimaryRegion,omitempty" azure:"ro"` + + // READ-ONLY; The prefix. + Prefix *string `json:"prefix,omitempty" azure:"ro"` +} + +// CdnPeeringPrefixesClientListOptions contains the optional parameters for the CdnPeeringPrefixesClient.List method. +type CdnPeeringPrefixesClientListOptions struct { + // placeholder for future optional parameters +} + // CheckServiceProviderAvailabilityInput - Class for CheckServiceProviderAvailabilityInput type CheckServiceProviderAvailabilityInput struct { - // Gets or sets the PeeringServiceLocation + // Gets or sets the peering service location. PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` - // Gets or sets the PeeringServiceProvider + // Gets or sets the peering service provider. PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` } -// ContactInfo - The contact information of the peer. -type ContactInfo struct { - // The list of email addresses. - Emails []*string `json:"emails,omitempty"` +// ConnectionMonitorTest - The Connection Monitor Test class. +type ConnectionMonitorTest struct { + // The properties that define a Connection Monitor Test. + Properties *ConnectionMonitorTestProperties `json:"properties,omitempty"` + + // READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` - // The list of contact numbers. - Phone []*string `json:"phone,omitempty"` + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ContactInfo. -func (c ContactInfo) MarshalJSON() ([]byte, error) { +// ConnectionMonitorTestListResult - The paginated list of [T]. +type ConnectionMonitorTestListResult struct { + // The link to fetch the next page of [T]. + NextLink *string `json:"nextLink,omitempty"` + + // The list of [T]. + Value []*ConnectionMonitorTest `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorTestListResult. +func (c ConnectionMonitorTestListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// ConnectionMonitorTestProperties - The properties that define a Connection Monitor Test. +type ConnectionMonitorTestProperties struct { + // The Connection Monitor test destination + Destination *string `json:"destination,omitempty"` + + // The Connection Monitor test destination port + DestinationPort *int32 `json:"destinationPort,omitempty"` + + // The Connection Monitor test source agent + SourceAgent *string `json:"sourceAgent,omitempty"` + + // The Connection Monitor test frequency in seconds + TestFrequencyInSec *int32 `json:"testFrequencyInSec,omitempty"` + + // READ-ONLY; The flag that indicates if the Connection Monitor test is successful or not. + IsTestSuccessful *bool `json:"isTestSuccessful,omitempty" azure:"ro"` + + // READ-ONLY; The path representing the Connection Monitor test. + Path []*string `json:"path,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionMonitorTestProperties. +func (c ConnectionMonitorTestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "emails", c.Emails) - populate(objectMap, "phone", c.Phone) + populate(objectMap, "destination", c.Destination) + populate(objectMap, "destinationPort", c.DestinationPort) + populate(objectMap, "isTestSuccessful", c.IsTestSuccessful) + populate(objectMap, "path", c.Path) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sourceAgent", c.SourceAgent) + populate(objectMap, "testFrequencyInSec", c.TestFrequencyInSec) return json.Marshal(objectMap) } +// ConnectionMonitorTestsClientCreateOrUpdateOptions contains the optional parameters for the ConnectionMonitorTestsClient.CreateOrUpdate +// method. +type ConnectionMonitorTestsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitorTestsClientDeleteOptions contains the optional parameters for the ConnectionMonitorTestsClient.Delete +// method. +type ConnectionMonitorTestsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitorTestsClientGetOptions contains the optional parameters for the ConnectionMonitorTestsClient.Get method. +type ConnectionMonitorTestsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectionMonitorTestsClientListByPeeringServiceOptions contains the optional parameters for the ConnectionMonitorTestsClient.ListByPeeringService +// method. +type ConnectionMonitorTestsClientListByPeeringServiceOptions struct { + // placeholder for future optional parameters +} + +// ContactDetail - The contact detail class. +type ContactDetail struct { + // The e-mail address of the contact. + Email *string `json:"email,omitempty"` + + // The phone number of the contact. + Phone *string `json:"phone,omitempty"` + + // The role of the contact. + Role *Role `json:"role,omitempty"` +} + // DirectConnection - The properties that define a direct connection. type DirectConnection struct { // The bandwidth of the connection. @@ -99,9 +242,6 @@ type DirectConnection struct { // The PeeringDB.com ID of the facility at which the connection has to be set up. PeeringDBFacilityID *int32 `json:"peeringDBFacilityId,omitempty"` - // The bandwidth that is actually provisioned. - ProvisionedBandwidthInMbps *int32 `json:"provisionedBandwidthInMbps,omitempty"` - // The field indicating if Microsoft provides session ip addresses. SessionAddressProvider *SessionAddressProvider `json:"sessionAddressProvider,omitempty"` @@ -110,6 +250,15 @@ type DirectConnection struct { // READ-ONLY; The state of the connection. ConnectionState *ConnectionState `json:"connectionState,omitempty" azure:"ro"` + + // READ-ONLY; The error message related to the connection state, if any. + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; The ID used within Microsoft's peering provisioning system to track the connection + MicrosoftTrackingID *string `json:"microsoftTrackingId,omitempty" azure:"ro"` + + // READ-ONLY; The bandwidth that is actually provisioned. + ProvisionedBandwidthInMbps *int32 `json:"provisionedBandwidthInMbps,omitempty" azure:"ro"` } // DirectPeeringFacility - The properties that define a direct peering facility. @@ -127,15 +276,6 @@ type DirectPeeringFacility struct { PeeringDBFacilityLink *string `json:"peeringDBFacilityLink,omitempty"` } -// ErrorResponse - The error response that indicates why an operation has failed. -type ErrorResponse struct { - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` -} - // ExchangeConnection - The properties that define an exchange connection. type ExchangeConnection struct { // The BGP session associated with the connection. @@ -149,6 +289,9 @@ type ExchangeConnection struct { // READ-ONLY; The state of the connection. ConnectionState *ConnectionState `json:"connectionState,omitempty" azure:"ro"` + + // READ-ONLY; The error message related to the connection state, if any. + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` } // ExchangePeeringFacility - The properties that define an exchange peering facility. @@ -180,7 +323,8 @@ type ExchangePeeringFacility struct { // LegacyPeeringsClientListOptions contains the optional parameters for the LegacyPeeringsClient.List method. type LegacyPeeringsClientListOptions struct { - // placeholder for future optional parameters + // The ASN number associated with a legacy peering. + Asn *int32 } // ListResult - The paginated list of peerings. @@ -286,7 +430,42 @@ func (l LocationPropertiesExchange) MarshalJSON() ([]byte, error) { // LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. type LocationsClientListOptions struct { // The type of direct peering. - DirectPeeringType *Enum15 + DirectPeeringType *PeeringLocationsDirectPeeringType +} + +// LogAnalyticsWorkspaceProperties - The properties that define a Log Analytics Workspace. +type LogAnalyticsWorkspaceProperties struct { + // READ-ONLY; The list of connected agents. + ConnectedAgents []*string `json:"connectedAgents,omitempty" azure:"ro"` + + // READ-ONLY; The Workspace Key. + Key *string `json:"key,omitempty" azure:"ro"` + + // READ-ONLY; The Workspace ID. + WorkspaceID *string `json:"workspaceID,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsWorkspaceProperties. +func (l LogAnalyticsWorkspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectedAgents", l.ConnectedAgents) + populate(objectMap, "key", l.Key) + populate(objectMap, "workspaceID", l.WorkspaceID) + return json.Marshal(objectMap) +} + +// LookingGlassClientInvokeOptions contains the optional parameters for the LookingGlassClient.Invoke method. +type LookingGlassClientInvokeOptions struct { + // placeholder for future optional parameters +} + +// LookingGlassOutput - Looking glass output model +type LookingGlassOutput struct { + // Invoked command + Command *Command `json:"command,omitempty"` + + // Output of the command + Output *string `json:"output,omitempty"` } // ManagementClientCheckServiceProviderAvailabilityOptions contains the optional parameters for the ManagementClient.CheckServiceProviderAvailability @@ -295,6 +474,52 @@ type ManagementClientCheckServiceProviderAvailabilityOptions struct { // placeholder for future optional parameters } +// MetricDimension - Dimensions of the metric. +type MetricDimension struct { + // READ-ONLY; Localized friendly display name of the dimension. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Name of the dimension. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// MetricSpecification - Specifications of the Metrics for Azure Monitoring. +type MetricSpecification struct { + // READ-ONLY; Aggregation type will be set to one of the values: Average, Minimum, Maximum, Total, Count. + AggregationType *string `json:"aggregationType,omitempty" azure:"ro"` + + // READ-ONLY; Dimensions of the metric. + Dimensions []*MetricDimension `json:"dimensions,omitempty" azure:"ro"` + + // READ-ONLY; Localized friendly description of the metric. + DisplayDescription *string `json:"displayDescription,omitempty" azure:"ro"` + + // READ-ONLY; Localized friendly display name of the metric. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Name of the metric. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Supported time grain types for the metric. + SupportedTimeGrainTypes []*string `json:"supportedTimeGrainTypes,omitempty" azure:"ro"` + + // READ-ONLY; Unit that makes sense for the metric. + Unit *string `json:"unit,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MetricSpecification. +func (m MetricSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aggregationType", m.AggregationType) + populate(objectMap, "dimensions", m.Dimensions) + populate(objectMap, "displayDescription", m.DisplayDescription) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "name", m.Name) + populate(objectMap, "supportedTimeGrainTypes", m.SupportedTimeGrainTypes) + populate(objectMap, "unit", m.Unit) + return json.Marshal(objectMap) +} + // Operation - The peering API operation. type Operation struct { // READ-ONLY; The information related to the operation. @@ -305,6 +530,9 @@ type Operation struct { // READ-ONLY; The name of the operation. Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The properties of the operation. + Properties *OperationProperties `json:"properties,omitempty" azure:"ro"` } // OperationDisplayInfo - The information related to the operation. @@ -339,6 +567,12 @@ func (o OperationListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// OperationProperties - The properties of the operation. +type OperationProperties struct { + // READ-ONLY; Service specification payload. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty" azure:"ro"` +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -381,14 +615,28 @@ type PeerAsnProperties struct { // The Autonomous System Number (ASN) of the peer. PeerAsn *int32 `json:"peerAsn,omitempty"` - // The contact information of the peer. - PeerContactInfo *ContactInfo `json:"peerContactInfo,omitempty"` + // The contact details of the peer. + PeerContactDetail []*ContactDetail `json:"peerContactDetail,omitempty"` // The name of the peer. PeerName *string `json:"peerName,omitempty"` - // The validation state of the ASN associated with the peer. - ValidationState *ValidationState `json:"validationState,omitempty"` + // READ-ONLY; The error message for the validation state + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; The validation state of the ASN associated with the peer. + ValidationState *ValidationState `json:"validationState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type PeerAsnProperties. +func (p PeerAsnProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessage", p.ErrorMessage) + populate(objectMap, "peerAsn", p.PeerAsn) + populate(objectMap, "peerContactDetail", p.PeerContactDetail) + populate(objectMap, "peerName", p.PeerName) + populate(objectMap, "validationState", p.ValidationState) + return json.Marshal(objectMap) } // PeerAsnsClientCreateOrUpdateOptions contains the optional parameters for the PeerAsnsClient.CreateOrUpdate method. @@ -482,10 +730,27 @@ type PeeringsClientUpdateOptions struct { // placeholder for future optional parameters } +// PrefixesClientCreateOrUpdateOptions contains the optional parameters for the PrefixesClient.CreateOrUpdate method. +type PrefixesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrefixesClientDeleteOptions contains the optional parameters for the PrefixesClient.Delete method. +type PrefixesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrefixesClientGetOptions contains the optional parameters for the PrefixesClient.Get method. +type PrefixesClientGetOptions struct { + // The properties to be expanded. + Expand *string +} + // PrefixesClientListByPeeringServiceOptions contains the optional parameters for the PrefixesClient.ListByPeeringService // method. type PrefixesClientListByPeeringServiceOptions struct { - // placeholder for future optional parameters + // The properties to be expanded. + Expand *string } // Properties - The properties that define connectivity to the Microsoft Cloud Edge. @@ -514,8 +779,8 @@ type PropertiesDirect struct { // The reference of the peer ASN. PeerAsn *SubResource `json:"peerAsn,omitempty"` - // The flag that indicates whether or not the peering is used for peering service. - UseForPeeringService *bool `json:"useForPeeringService,omitempty"` + // READ-ONLY; The flag that indicates whether or not the peering is used for peering service. + UseForPeeringService *bool `json:"useForPeeringService,omitempty" azure:"ro"` } // MarshalJSON implements the json.Marshaller interface for type PropertiesDirect. @@ -545,6 +810,198 @@ func (p PropertiesExchange) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ReceivedRoute - The properties that define a received route. +type ReceivedRoute struct { + // READ-ONLY; The AS path for the prefix. + AsPath *string `json:"asPath,omitempty" azure:"ro"` + + // READ-ONLY; The next hop for the prefix. + NextHop *string `json:"nextHop,omitempty" azure:"ro"` + + // READ-ONLY; The origin AS change information for the prefix. + OriginAsValidationState *string `json:"originAsValidationState,omitempty" azure:"ro"` + + // READ-ONLY; The prefix. + Prefix *string `json:"prefix,omitempty" azure:"ro"` + + // READ-ONLY; The received timestamp associated with the prefix. + ReceivedTimestamp *string `json:"receivedTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; The RPKI validation state for the prefix and origin AS that's listed in the AS path. + RpkiValidationState *string `json:"rpkiValidationState,omitempty" azure:"ro"` + + // READ-ONLY; The authority which holds the Route Origin Authorization record for the prefix, if any. + TrustAnchor *string `json:"trustAnchor,omitempty" azure:"ro"` +} + +// ReceivedRouteListResult - The paginated list of received routes for the peering. +type ReceivedRouteListResult struct { + // The link to fetch the next page of received routes for the peering. + NextLink *string `json:"nextLink,omitempty"` + + // The list of received routes for the peering. + Value []*ReceivedRoute `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ReceivedRouteListResult. +func (r ReceivedRouteListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// ReceivedRoutesClientListByPeeringOptions contains the optional parameters for the ReceivedRoutesClient.ListByPeering method. +type ReceivedRoutesClientListByPeeringOptions struct { + // The optional AS path that can be used to filter the routes. + AsPath *string + // The optional origin AS validation state that can be used to filter the routes. + OriginAsValidationState *string + // The optional prefix that can be used to filter the routes. + Prefix *string + // The optional RPKI validation state that can be used to filter the routes. + RpkiValidationState *string + // The optional page continuation token that is used in the event of paginated result. + SkipToken *string +} + +// RegisteredAsn - The customer's ASN that is registered by the peering service provider. +type RegisteredAsn struct { + // The properties that define a registered ASN. + Properties *RegisteredAsnProperties `json:"properties,omitempty"` + + // READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RegisteredAsnListResult - The paginated list of peering registered ASNs. +type RegisteredAsnListResult struct { + // The link to fetch the next page of peering registered ASNs. + NextLink *string `json:"nextLink,omitempty"` + + // The list of peering registered ASNs. + Value []*RegisteredAsn `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RegisteredAsnListResult. +func (r RegisteredAsnListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// RegisteredAsnProperties - The properties that define a registered ASN. +type RegisteredAsnProperties struct { + // The customer's ASN from which traffic originates. + Asn *int32 `json:"asn,omitempty"` + + // READ-ONLY; The peering service prefix key that is to be shared with the customer. + PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RegisteredAsnsClientCreateOrUpdateOptions contains the optional parameters for the RegisteredAsnsClient.CreateOrUpdate +// method. +type RegisteredAsnsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RegisteredAsnsClientDeleteOptions contains the optional parameters for the RegisteredAsnsClient.Delete method. +type RegisteredAsnsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RegisteredAsnsClientGetOptions contains the optional parameters for the RegisteredAsnsClient.Get method. +type RegisteredAsnsClientGetOptions struct { + // placeholder for future optional parameters +} + +// RegisteredAsnsClientListByPeeringOptions contains the optional parameters for the RegisteredAsnsClient.ListByPeering method. +type RegisteredAsnsClientListByPeeringOptions struct { + // placeholder for future optional parameters +} + +// RegisteredPrefix - The customer's prefix that is registered by the peering service provider. +type RegisteredPrefix struct { + // The properties that define a registered prefix. + Properties *RegisteredPrefixProperties `json:"properties,omitempty"` + + // READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// RegisteredPrefixListResult - The paginated list of peering registered prefixes. +type RegisteredPrefixListResult struct { + // The link to fetch the next page of peering registered prefixes. + NextLink *string `json:"nextLink,omitempty"` + + // The list of peering registered prefixes. + Value []*RegisteredPrefix `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RegisteredPrefixListResult. +func (r RegisteredPrefixListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// RegisteredPrefixProperties - The properties that define a registered prefix. +type RegisteredPrefixProperties struct { + // The customer's prefix from which traffic originates. + Prefix *string `json:"prefix,omitempty"` + + // READ-ONLY; The error message associated with the validation state, if any. + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` + + // READ-ONLY; The peering service prefix key that is to be shared with the customer. + PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty" azure:"ro"` + + // READ-ONLY; The prefix validation state. + PrefixValidationState *PrefixValidationState `json:"prefixValidationState,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// RegisteredPrefixesClientCreateOrUpdateOptions contains the optional parameters for the RegisteredPrefixesClient.CreateOrUpdate +// method. +type RegisteredPrefixesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RegisteredPrefixesClientDeleteOptions contains the optional parameters for the RegisteredPrefixesClient.Delete method. +type RegisteredPrefixesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// RegisteredPrefixesClientGetOptions contains the optional parameters for the RegisteredPrefixesClient.Get method. +type RegisteredPrefixesClientGetOptions struct { + // placeholder for future optional parameters +} + +// RegisteredPrefixesClientListByPeeringOptions contains the optional parameters for the RegisteredPrefixesClient.ListByPeering +// method. +type RegisteredPrefixesClientListByPeeringOptions struct { + // placeholder for future optional parameters +} + // Resource - The ARM resource class. type Resource struct { // READ-ONLY; The ID of the resource. @@ -572,17 +1029,17 @@ func (r ResourceTags) MarshalJSON() ([]byte, error) { // SKU - The SKU that defines the tier and kind of the peering. type SKU struct { - // The family of the peering SKU. - Family *Family `json:"family,omitempty"` - // The name of the peering SKU. - Name *Name `json:"name,omitempty"` + Name *string `json:"name,omitempty"` - // The size of the peering SKU. - Size *Size `json:"size,omitempty"` + // READ-ONLY; The family of the peering SKU. + Family *Family `json:"family,omitempty" azure:"ro"` - // The tier of the peering SKU. - Tier *Tier `json:"tier,omitempty"` + // READ-ONLY; The size of the peering SKU. + Size *Size `json:"size,omitempty" azure:"ro"` + + // READ-ONLY; The tier of the peering SKU. + Tier *Tier `json:"tier,omitempty" azure:"ro"` } // Service - Peering Service @@ -593,6 +1050,9 @@ type Service struct { // The properties that define a peering service. Properties *ServiceProperties `json:"properties,omitempty"` + // The SKU that defines the type of the peering service. + SKU *ServiceSKU `json:"sku,omitempty"` + // The resource tags. Tags map[string]*string `json:"tags,omitempty"` @@ -613,11 +1073,46 @@ func (s Service) MarshalJSON() ([]byte, error) { populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "sku", s.SKU) populate(objectMap, "tags", s.Tags) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } +// ServiceCountriesClientListOptions contains the optional parameters for the ServiceCountriesClient.List method. +type ServiceCountriesClientListOptions struct { + // placeholder for future optional parameters +} + +// ServiceCountry - The peering service country. +type ServiceCountry struct { + // READ-ONLY; The ID of the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServiceCountryListResult - The paginated list of peering service countries. +type ServiceCountryListResult struct { + // The link to fetch the next page of peering service countries. + NextLink *string `json:"nextLink,omitempty"` + + // The list of peering service countries. + Value []*ServiceCountry `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceCountryListResult. +func (s ServiceCountryListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + // ServiceListResult - The paginated list of peering services. type ServiceListResult struct { // The link to fetch the next page of peering services. @@ -635,7 +1130,7 @@ func (s ServiceListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ServiceLocation - PeeringService location +// ServiceLocation - The peering service location. type ServiceLocation struct { // The properties that define a peering service location. Properties *ServiceLocationProperties `json:"properties,omitempty"` @@ -681,7 +1176,8 @@ type ServiceLocationProperties struct { // ServiceLocationsClientListOptions contains the optional parameters for the ServiceLocationsClient.List method. type ServiceLocationsClientListOptions struct { - // placeholder for future optional parameters + // The country of interest, in which the locations are to be present. + Country *string } // ServicePrefix - The peering service prefix class. @@ -699,12 +1195,73 @@ type ServicePrefix struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ServicePrefixListResult - The paginated list of [T]. +// ServicePrefixEvent - The details of the event associated with a prefix. +type ServicePrefixEvent struct { + // READ-ONLY; The description of the event associated with a prefix. + EventDescription *string `json:"eventDescription,omitempty" azure:"ro"` + + // READ-ONLY; The level of the event associated with a prefix. + EventLevel *string `json:"eventLevel,omitempty" azure:"ro"` + + // READ-ONLY; The summary of the event associated with a prefix. + EventSummary *string `json:"eventSummary,omitempty" azure:"ro"` + + // READ-ONLY; The timestamp of the event associated with a prefix. + EventTimestamp *time.Time `json:"eventTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; The type of the event associated with a prefix. + EventType *string `json:"eventType,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServicePrefixEvent. +func (s ServicePrefixEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventDescription", s.EventDescription) + populate(objectMap, "eventLevel", s.EventLevel) + populate(objectMap, "eventSummary", s.EventSummary) + populateTimeRFC3339(objectMap, "eventTimestamp", s.EventTimestamp) + populate(objectMap, "eventType", s.EventType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrefixEvent. +func (s *ServicePrefixEvent) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "eventDescription": + err = unpopulate(val, &s.EventDescription) + delete(rawMsg, key) + case "eventLevel": + err = unpopulate(val, &s.EventLevel) + delete(rawMsg, key) + case "eventSummary": + err = unpopulate(val, &s.EventSummary) + delete(rawMsg, key) + case "eventTimestamp": + err = unpopulateTimeRFC3339(val, &s.EventTimestamp) + delete(rawMsg, key) + case "eventType": + err = unpopulate(val, &s.EventType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// ServicePrefixListResult - The paginated list of peering service prefixes. type ServicePrefixListResult struct { - // The link to fetch the next page of [T]. + // The link to fetch the next page of peering service prefixes. NextLink *string `json:"nextLink,omitempty"` - // The list of [T]. + // The list of peering service prefixes. Value []*ServicePrefix `json:"value,omitempty"` } @@ -718,43 +1275,58 @@ func (s ServicePrefixListResult) MarshalJSON() ([]byte, error) { // ServicePrefixProperties - The peering service prefix properties class. type ServicePrefixProperties struct { - // The prefix learned type - LearnedType *LearnedType `json:"learnedType,omitempty"` + // The peering service prefix key + PeeringServicePrefixKey *string `json:"peeringServicePrefixKey,omitempty"` - // Valid route prefix + // The prefix from which your traffic originates. Prefix *string `json:"prefix,omitempty"` - // The prefix validation state - PrefixValidationState *PrefixValidationState `json:"prefixValidationState,omitempty"` + // READ-ONLY; The error message for validation state + ErrorMessage *string `json:"errorMessage,omitempty" azure:"ro"` - // READ-ONLY; The provisioning state of the resource. - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} + // READ-ONLY; The list of events for peering service prefix + Events []*ServicePrefixEvent `json:"events,omitempty" azure:"ro"` -// ServicePrefixesClientCreateOrUpdateOptions contains the optional parameters for the ServicePrefixesClient.CreateOrUpdate -// method. -type ServicePrefixesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The prefix learned type + LearnedType *LearnedType `json:"learnedType,omitempty" azure:"ro"` -// ServicePrefixesClientDeleteOptions contains the optional parameters for the ServicePrefixesClient.Delete method. -type ServicePrefixesClientDeleteOptions struct { - // placeholder for future optional parameters + // READ-ONLY; The prefix validation state + PrefixValidationState *PrefixValidationState `json:"prefixValidationState,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } -// ServicePrefixesClientGetOptions contains the optional parameters for the ServicePrefixesClient.Get method. -type ServicePrefixesClientGetOptions struct { - // placeholder for future optional parameters +// MarshalJSON implements the json.Marshaller interface for type ServicePrefixProperties. +func (s ServicePrefixProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "errorMessage", s.ErrorMessage) + populate(objectMap, "events", s.Events) + populate(objectMap, "learnedType", s.LearnedType) + populate(objectMap, "peeringServicePrefixKey", s.PeeringServicePrefixKey) + populate(objectMap, "prefix", s.Prefix) + populate(objectMap, "prefixValidationState", s.PrefixValidationState) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) } // ServiceProperties - The properties that define connectivity to the Peering Service. type ServiceProperties struct { - // The PeeringServiceLocation of the Customer. + // The Log Analytics Workspace Properties + LogAnalyticsWorkspaceProperties *LogAnalyticsWorkspaceProperties `json:"logAnalyticsWorkspaceProperties,omitempty"` + + // The location (state/province) of the customer. PeeringServiceLocation *string `json:"peeringServiceLocation,omitempty"` - // The MAPS Provider Name. + // The name of the service provider. PeeringServiceProvider *string `json:"peeringServiceProvider,omitempty"` + // The backup peering (Microsoft/service provider) location to be used for customer traffic. + ProviderBackupPeeringLocation *string `json:"providerBackupPeeringLocation,omitempty"` + + // The primary peering (Microsoft/service provider) location to be used for customer traffic. + ProviderPrimaryPeeringLocation *string `json:"providerPrimaryPeeringLocation,omitempty"` + // READ-ONLY; The provisioning state of the resource. ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } @@ -793,15 +1365,45 @@ func (s ServiceProviderListResult) MarshalJSON() ([]byte, error) { // ServiceProviderProperties - The properties that define connectivity to the Peering Service Provider. type ServiceProviderProperties struct { + // The list of locations at which the service provider peers with Microsoft. + PeeringLocations []*string `json:"peeringLocations,omitempty"` + // The name of the service provider. ServiceProviderName *string `json:"serviceProviderName,omitempty"` } +// MarshalJSON implements the json.Marshaller interface for type ServiceProviderProperties. +func (s ServiceProviderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "peeringLocations", s.PeeringLocations) + populate(objectMap, "serviceProviderName", s.ServiceProviderName) + return json.Marshal(objectMap) +} + // ServiceProvidersClientListOptions contains the optional parameters for the ServiceProvidersClient.List method. type ServiceProvidersClientListOptions struct { // placeholder for future optional parameters } +// ServiceSKU - The SKU that defines the type of the peering service. +type ServiceSKU struct { + // The name of the peering service SKU. + Name *string `json:"name,omitempty"` +} + +// ServiceSpecification - Service specification payload. +type ServiceSpecification struct { + // READ-ONLY; Specifications of the Metrics for Azure Monitoring. + MetricSpecifications []*MetricSpecification `json:"metricSpecifications,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceSpecification. +func (s ServiceSpecification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "metricSpecifications", s.MetricSpecifications) + return json.Marshal(objectMap) +} + // ServicesClientCreateOrUpdateOptions contains the optional parameters for the ServicesClient.CreateOrUpdate method. type ServicesClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -817,6 +1419,12 @@ type ServicesClientGetOptions struct { // placeholder for future optional parameters } +// ServicesClientInitializeConnectionMonitorOptions contains the optional parameters for the ServicesClient.InitializeConnectionMonitor +// method. +type ServicesClientInitializeConnectionMonitorOptions struct { + // placeholder for future optional parameters +} + // ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.ListByResourceGroup method. type ServicesClientListByResourceGroupOptions struct { // placeholder for future optional parameters @@ -847,3 +1455,10 @@ func populate(m map[string]interface{}, k string, v interface{}) { m[k] = v } } + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_operations_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_operations_client.go index 3c9d735fa952..8ac7ad1decc2 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_operations_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_operations_client.go @@ -29,16 +29,16 @@ type OperationsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &OperationsClient{ - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -66,7 +66,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_pagers.go b/sdk/resourcemanager/peering/armpeering/zz_generated_pagers.go index 16900b7d01de..6a010bf43673 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_pagers.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_pagers.go @@ -16,6 +16,114 @@ import ( "reflect" ) +// CdnPeeringPrefixesClientListPager provides operations for iterating over paged responses. +type CdnPeeringPrefixesClientListPager struct { + client *CdnPeeringPrefixesClient + current CdnPeeringPrefixesClientListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CdnPeeringPrefixesClientListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *CdnPeeringPrefixesClientListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CdnPeeringPrefixesClientListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.CdnPeeringPrefixListResult.NextLink == nil || len(*p.current.CdnPeeringPrefixListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current CdnPeeringPrefixesClientListResponse page. +func (p *CdnPeeringPrefixesClientListPager) PageResponse() CdnPeeringPrefixesClientListResponse { + return p.current +} + +// ConnectionMonitorTestsClientListByPeeringServicePager provides operations for iterating over paged responses. +type ConnectionMonitorTestsClientListByPeeringServicePager struct { + client *ConnectionMonitorTestsClient + current ConnectionMonitorTestsClientListByPeeringServiceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ConnectionMonitorTestsClientListByPeeringServiceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ConnectionMonitorTestsClientListByPeeringServicePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ConnectionMonitorTestsClientListByPeeringServicePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ConnectionMonitorTestListResult.NextLink == nil || len(*p.current.ConnectionMonitorTestListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByPeeringServiceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ConnectionMonitorTestsClientListByPeeringServiceResponse page. +func (p *ConnectionMonitorTestsClientListByPeeringServicePager) PageResponse() ConnectionMonitorTestsClientListByPeeringServiceResponse { + return p.current +} + // LegacyPeeringsClientListPager provides operations for iterating over paged responses. type LegacyPeeringsClientListPager struct { client *LegacyPeeringsClient @@ -394,6 +502,222 @@ func (p *PrefixesClientListByPeeringServicePager) PageResponse() PrefixesClientL return p.current } +// ReceivedRoutesClientListByPeeringPager provides operations for iterating over paged responses. +type ReceivedRoutesClientListByPeeringPager struct { + client *ReceivedRoutesClient + current ReceivedRoutesClientListByPeeringResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ReceivedRoutesClientListByPeeringResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ReceivedRoutesClientListByPeeringPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ReceivedRoutesClientListByPeeringPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ReceivedRouteListResult.NextLink == nil || len(*p.current.ReceivedRouteListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByPeeringHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ReceivedRoutesClientListByPeeringResponse page. +func (p *ReceivedRoutesClientListByPeeringPager) PageResponse() ReceivedRoutesClientListByPeeringResponse { + return p.current +} + +// RegisteredAsnsClientListByPeeringPager provides operations for iterating over paged responses. +type RegisteredAsnsClientListByPeeringPager struct { + client *RegisteredAsnsClient + current RegisteredAsnsClientListByPeeringResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RegisteredAsnsClientListByPeeringResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RegisteredAsnsClientListByPeeringPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RegisteredAsnsClientListByPeeringPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RegisteredAsnListResult.NextLink == nil || len(*p.current.RegisteredAsnListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByPeeringHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RegisteredAsnsClientListByPeeringResponse page. +func (p *RegisteredAsnsClientListByPeeringPager) PageResponse() RegisteredAsnsClientListByPeeringResponse { + return p.current +} + +// RegisteredPrefixesClientListByPeeringPager provides operations for iterating over paged responses. +type RegisteredPrefixesClientListByPeeringPager struct { + client *RegisteredPrefixesClient + current RegisteredPrefixesClientListByPeeringResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RegisteredPrefixesClientListByPeeringResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RegisteredPrefixesClientListByPeeringPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RegisteredPrefixesClientListByPeeringPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RegisteredPrefixListResult.NextLink == nil || len(*p.current.RegisteredPrefixListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listByPeeringHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RegisteredPrefixesClientListByPeeringResponse page. +func (p *RegisteredPrefixesClientListByPeeringPager) PageResponse() RegisteredPrefixesClientListByPeeringResponse { + return p.current +} + +// ServiceCountriesClientListPager provides operations for iterating over paged responses. +type ServiceCountriesClientListPager struct { + client *ServiceCountriesClient + current ServiceCountriesClientListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ServiceCountriesClientListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ServiceCountriesClientListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ServiceCountriesClientListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ServiceCountryListResult.NextLink == nil || len(*p.current.ServiceCountryListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = runtime.NewResponseError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ServiceCountriesClientListResponse page. +func (p *ServiceCountriesClientListPager) PageResponse() ServiceCountriesClientListResponse { + return p.current +} + // ServiceLocationsClientListPager provides operations for iterating over paged responses. type ServiceLocationsClientListPager struct { client *ServiceLocationsClient diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_peerasns_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_peerasns_client.go index 8c67a45d66a8..d0a7868384b7 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_peerasns_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_peerasns_client.go @@ -34,17 +34,17 @@ type PeerAsnsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewPeerAsnsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PeerAsnsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &PeerAsnsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -85,7 +85,7 @@ func (client *PeerAsnsClient) createOrUpdateCreateRequest(ctx context.Context, p return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, peerAsn) @@ -135,7 +135,7 @@ func (client *PeerAsnsClient) deleteCreateRequest(ctx context.Context, peerAsnNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -176,7 +176,7 @@ func (client *PeerAsnsClient) getCreateRequest(ctx context.Context, peerAsnName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -219,7 +219,7 @@ func (client *PeerAsnsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_peerings_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_peerings_client.go index aab6e5e21ec5..42f9a941de52 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_peerings_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_peerings_client.go @@ -34,17 +34,17 @@ type PeeringsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PeeringsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &PeeringsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -91,7 +91,7 @@ func (client *PeeringsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, peering) @@ -146,7 +146,7 @@ func (client *PeeringsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -192,7 +192,7 @@ func (client *PeeringsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -240,7 +240,7 @@ func (client *PeeringsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -283,7 +283,7 @@ func (client *PeeringsClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -339,7 +339,7 @@ func (client *PeeringsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tags) diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_prefixes_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_prefixes_client.go index 8343f8ed7f62..4a70f71e3080 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_prefixes_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_prefixes_client.go @@ -34,25 +34,201 @@ type PrefixesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrefixesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &PrefixesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } -// ListByPeeringService - Lists the peerings prefix in the resource group. +// CreateOrUpdate - Creates a new prefix with the specified name under the given subscription, resource group and peering +// service. // If the operation fails it returns an *azcore.ResponseError type. -// resourceGroupName - The resource group name. -// peeringServiceName - The peering service name. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// prefixName - The name of the prefix. +// peeringServicePrefix - The properties needed to create a prefix. +// options - PrefixesClientCreateOrUpdateOptions contains the optional parameters for the PrefixesClient.CreateOrUpdate method. +func (client *PrefixesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, peeringServicePrefix ServicePrefix, options *PrefixesClientCreateOrUpdateOptions) (PrefixesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix, options) + if err != nil { + return PrefixesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrefixesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return PrefixesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrefixesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, peeringServicePrefix ServicePrefix, options *PrefixesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if prefixName == "" { + return nil, errors.New("parameter prefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, peeringServicePrefix) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *PrefixesClient) createOrUpdateHandleResponse(resp *http.Response) (PrefixesClientCreateOrUpdateResponse, error) { + result := PrefixesClientCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicePrefix); err != nil { + return PrefixesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an existing prefix with the specified name under the given subscription, resource group and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// prefixName - The name of the prefix. +// options - PrefixesClientDeleteOptions contains the optional parameters for the PrefixesClient.Delete method. +func (client *PrefixesClient) Delete(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *PrefixesClientDeleteOptions) (PrefixesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, options) + if err != nil { + return PrefixesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrefixesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return PrefixesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return PrefixesClientDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrefixesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *PrefixesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if prefixName == "" { + return nil, errors.New("parameter prefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets an existing prefix with the specified name under the given subscription, resource group and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. +// prefixName - The name of the prefix. +// options - PrefixesClientGetOptions contains the optional parameters for the PrefixesClient.Get method. +func (client *PrefixesClient) Get(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *PrefixesClientGetOptions) (PrefixesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, options) + if err != nil { + return PrefixesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrefixesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrefixesClient) getCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *PrefixesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringServiceName == "" { + return nil, errors.New("parameter peeringServiceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) + if prefixName == "" { + return nil, errors.New("parameter prefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrefixesClient) getHandleResponse(resp *http.Response) (PrefixesClientGetResponse, error) { + result := PrefixesClientGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServicePrefix); err != nil { + return PrefixesClientGetResponse{}, err + } + return result, nil +} + +// ListByPeeringService - Lists all prefixes under the given subscription, resource group and peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringServiceName - The name of the peering service. // options - PrefixesClientListByPeeringServiceOptions contains the optional parameters for the PrefixesClient.ListByPeeringService // method. func (client *PrefixesClient) ListByPeeringService(resourceGroupName string, peeringServiceName string, options *PrefixesClientListByPeeringServiceOptions) *PrefixesClientListByPeeringServicePager { @@ -87,7 +263,10 @@ func (client *PrefixesClient) listByPeeringServiceCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_receivedroutes_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_receivedroutes_client.go new file mode 100644 index 000000000000..faf7c4bab2ee --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_receivedroutes_client.go @@ -0,0 +1,118 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ReceivedRoutesClient contains the methods for the ReceivedRoutes group. +// Don't use this type directly, use NewReceivedRoutesClient() instead. +type ReceivedRoutesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewReceivedRoutesClient creates a new instance of ReceivedRoutesClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewReceivedRoutesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReceivedRoutesClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ReceivedRoutesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// ListByPeering - Lists the prefixes received over the specified peering under the given subscription and resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// options - ReceivedRoutesClientListByPeeringOptions contains the optional parameters for the ReceivedRoutesClient.ListByPeering +// method. +func (client *ReceivedRoutesClient) ListByPeering(resourceGroupName string, peeringName string, options *ReceivedRoutesClientListByPeeringOptions) *ReceivedRoutesClientListByPeeringPager { + return &ReceivedRoutesClientListByPeeringPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByPeeringCreateRequest(ctx, resourceGroupName, peeringName, options) + }, + advancer: func(ctx context.Context, resp ReceivedRoutesClientListByPeeringResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ReceivedRouteListResult.NextLink) + }, + } +} + +// listByPeeringCreateRequest creates the ListByPeering request. +func (client *ReceivedRoutesClient) listByPeeringCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, options *ReceivedRoutesClientListByPeeringOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/receivedRoutes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Prefix != nil { + reqQP.Set("prefix", *options.Prefix) + } + if options != nil && options.AsPath != nil { + reqQP.Set("asPath", *options.AsPath) + } + if options != nil && options.OriginAsValidationState != nil { + reqQP.Set("originAsValidationState", *options.OriginAsValidationState) + } + if options != nil && options.RpkiValidationState != nil { + reqQP.Set("rpkiValidationState", *options.RpkiValidationState) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByPeeringHandleResponse handles the ListByPeering response. +func (client *ReceivedRoutesClient) listByPeeringHandleResponse(resp *http.Response) (ReceivedRoutesClientListByPeeringResponse, error) { + result := ReceivedRoutesClientListByPeeringResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ReceivedRouteListResult); err != nil { + return ReceivedRoutesClientListByPeeringResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_registeredasns_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_registeredasns_client.go new file mode 100644 index 000000000000..b8e043aefcc1 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_registeredasns_client.go @@ -0,0 +1,277 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RegisteredAsnsClient contains the methods for the RegisteredAsns group. +// Don't use this type directly, use NewRegisteredAsnsClient() instead. +type RegisteredAsnsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRegisteredAsnsClient creates a new instance of RegisteredAsnsClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRegisteredAsnsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegisteredAsnsClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &RegisteredAsnsClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// CreateOrUpdate - Creates a new registered ASN with the specified name under the given subscription, resource group and +// peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredAsnName - The name of the ASN. +// registeredAsn - The properties needed to create a registered ASN. +// options - RegisteredAsnsClientCreateOrUpdateOptions contains the optional parameters for the RegisteredAsnsClient.CreateOrUpdate +// method. +func (client *RegisteredAsnsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, registeredAsn RegisteredAsn, options *RegisteredAsnsClientCreateOrUpdateOptions) (RegisteredAsnsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, peeringName, registeredAsnName, registeredAsn, options) + if err != nil { + return RegisteredAsnsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredAsnsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return RegisteredAsnsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RegisteredAsnsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, registeredAsn RegisteredAsn, options *RegisteredAsnsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredAsnName == "" { + return nil, errors.New("parameter registeredAsnName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredAsnName}", url.PathEscape(registeredAsnName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, registeredAsn) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RegisteredAsnsClient) createOrUpdateHandleResponse(resp *http.Response) (RegisteredAsnsClientCreateOrUpdateResponse, error) { + result := RegisteredAsnsClientCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredAsn); err != nil { + return RegisteredAsnsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an existing registered ASN with the specified name under the given subscription, resource group and peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredAsnName - The name of the registered ASN. +// options - RegisteredAsnsClientDeleteOptions contains the optional parameters for the RegisteredAsnsClient.Delete method. +func (client *RegisteredAsnsClient) Delete(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, options *RegisteredAsnsClientDeleteOptions) (RegisteredAsnsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, peeringName, registeredAsnName, options) + if err != nil { + return RegisteredAsnsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredAsnsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return RegisteredAsnsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return RegisteredAsnsClientDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RegisteredAsnsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, options *RegisteredAsnsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredAsnName == "" { + return nil, errors.New("parameter registeredAsnName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredAsnName}", url.PathEscape(registeredAsnName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets an existing registered ASN with the specified name under the given subscription, resource group and peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredAsnName - The name of the registered ASN. +// options - RegisteredAsnsClientGetOptions contains the optional parameters for the RegisteredAsnsClient.Get method. +func (client *RegisteredAsnsClient) Get(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, options *RegisteredAsnsClientGetOptions) (RegisteredAsnsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, peeringName, registeredAsnName, options) + if err != nil { + return RegisteredAsnsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredAsnsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RegisteredAsnsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RegisteredAsnsClient) getCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredAsnName string, options *RegisteredAsnsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns/{registeredAsnName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredAsnName == "" { + return nil, errors.New("parameter registeredAsnName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredAsnName}", url.PathEscape(registeredAsnName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RegisteredAsnsClient) getHandleResponse(resp *http.Response) (RegisteredAsnsClientGetResponse, error) { + result := RegisteredAsnsClientGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredAsn); err != nil { + return RegisteredAsnsClientGetResponse{}, err + } + return result, nil +} + +// ListByPeering - Lists all registered ASNs under the given subscription, resource group and peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// options - RegisteredAsnsClientListByPeeringOptions contains the optional parameters for the RegisteredAsnsClient.ListByPeering +// method. +func (client *RegisteredAsnsClient) ListByPeering(resourceGroupName string, peeringName string, options *RegisteredAsnsClientListByPeeringOptions) *RegisteredAsnsClientListByPeeringPager { + return &RegisteredAsnsClientListByPeeringPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByPeeringCreateRequest(ctx, resourceGroupName, peeringName, options) + }, + advancer: func(ctx context.Context, resp RegisteredAsnsClientListByPeeringResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RegisteredAsnListResult.NextLink) + }, + } +} + +// listByPeeringCreateRequest creates the ListByPeering request. +func (client *RegisteredAsnsClient) listByPeeringCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, options *RegisteredAsnsClientListByPeeringOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredAsns" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByPeeringHandleResponse handles the ListByPeering response. +func (client *RegisteredAsnsClient) listByPeeringHandleResponse(resp *http.Response) (RegisteredAsnsClientListByPeeringResponse, error) { + result := RegisteredAsnsClientListByPeeringResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredAsnListResult); err != nil { + return RegisteredAsnsClientListByPeeringResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_registeredprefixes_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_registeredprefixes_client.go new file mode 100644 index 000000000000..a54214758f8b --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_registeredprefixes_client.go @@ -0,0 +1,279 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RegisteredPrefixesClient contains the methods for the RegisteredPrefixes group. +// Don't use this type directly, use NewRegisteredPrefixesClient() instead. +type RegisteredPrefixesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewRegisteredPrefixesClient creates a new instance of RegisteredPrefixesClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewRegisteredPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegisteredPrefixesClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &RegisteredPrefixesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// CreateOrUpdate - Creates a new registered prefix with the specified name under the given subscription, resource group and +// peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredPrefixName - The name of the registered prefix. +// registeredPrefix - The properties needed to create a registered prefix. +// options - RegisteredPrefixesClientCreateOrUpdateOptions contains the optional parameters for the RegisteredPrefixesClient.CreateOrUpdate +// method. +func (client *RegisteredPrefixesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, registeredPrefix RegisteredPrefix, options *RegisteredPrefixesClientCreateOrUpdateOptions) (RegisteredPrefixesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, peeringName, registeredPrefixName, registeredPrefix, options) + if err != nil { + return RegisteredPrefixesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredPrefixesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return RegisteredPrefixesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RegisteredPrefixesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, registeredPrefix RegisteredPrefix, options *RegisteredPrefixesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredPrefixName == "" { + return nil, errors.New("parameter registeredPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredPrefixName}", url.PathEscape(registeredPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, registeredPrefix) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *RegisteredPrefixesClient) createOrUpdateHandleResponse(resp *http.Response) (RegisteredPrefixesClientCreateOrUpdateResponse, error) { + result := RegisteredPrefixesClientCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredPrefix); err != nil { + return RegisteredPrefixesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes an existing registered prefix with the specified name under the given subscription, resource group and +// peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredPrefixName - The name of the registered prefix. +// options - RegisteredPrefixesClientDeleteOptions contains the optional parameters for the RegisteredPrefixesClient.Delete +// method. +func (client *RegisteredPrefixesClient) Delete(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, options *RegisteredPrefixesClientDeleteOptions) (RegisteredPrefixesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, peeringName, registeredPrefixName, options) + if err != nil { + return RegisteredPrefixesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredPrefixesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return RegisteredPrefixesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return RegisteredPrefixesClientDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RegisteredPrefixesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, options *RegisteredPrefixesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredPrefixName == "" { + return nil, errors.New("parameter registeredPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredPrefixName}", url.PathEscape(registeredPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// Get - Gets an existing registered prefix with the specified name under the given subscription, resource group and peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// registeredPrefixName - The name of the registered prefix. +// options - RegisteredPrefixesClientGetOptions contains the optional parameters for the RegisteredPrefixesClient.Get method. +func (client *RegisteredPrefixesClient) Get(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, options *RegisteredPrefixesClientGetOptions) (RegisteredPrefixesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, peeringName, registeredPrefixName, options) + if err != nil { + return RegisteredPrefixesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RegisteredPrefixesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RegisteredPrefixesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RegisteredPrefixesClient) getCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, registeredPrefixName string, options *RegisteredPrefixesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes/{registeredPrefixName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if registeredPrefixName == "" { + return nil, errors.New("parameter registeredPrefixName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{registeredPrefixName}", url.PathEscape(registeredPrefixName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RegisteredPrefixesClient) getHandleResponse(resp *http.Response) (RegisteredPrefixesClientGetResponse, error) { + result := RegisteredPrefixesClientGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredPrefix); err != nil { + return RegisteredPrefixesClientGetResponse{}, err + } + return result, nil +} + +// ListByPeering - Lists all registered prefixes under the given subscription, resource group and peering. +// If the operation fails it returns an *azcore.ResponseError type. +// resourceGroupName - The name of the resource group. +// peeringName - The name of the peering. +// options - RegisteredPrefixesClientListByPeeringOptions contains the optional parameters for the RegisteredPrefixesClient.ListByPeering +// method. +func (client *RegisteredPrefixesClient) ListByPeering(resourceGroupName string, peeringName string, options *RegisteredPrefixesClientListByPeeringOptions) *RegisteredPrefixesClientListByPeeringPager { + return &RegisteredPrefixesClientListByPeeringPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByPeeringCreateRequest(ctx, resourceGroupName, peeringName, options) + }, + advancer: func(ctx context.Context, resp RegisteredPrefixesClientListByPeeringResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RegisteredPrefixListResult.NextLink) + }, + } +} + +// listByPeeringCreateRequest creates the ListByPeering request. +func (client *RegisteredPrefixesClient) listByPeeringCreateRequest(ctx context.Context, resourceGroupName string, peeringName string, options *RegisteredPrefixesClientListByPeeringOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peerings/{peeringName}/registeredPrefixes" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if peeringName == "" { + return nil, errors.New("parameter peeringName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{peeringName}", url.PathEscape(peeringName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByPeeringHandleResponse handles the ListByPeering response. +func (client *RegisteredPrefixesClient) listByPeeringHandleResponse(resp *http.Response) (RegisteredPrefixesClientListByPeeringResponse, error) { + result := RegisteredPrefixesClientListByPeeringResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RegisteredPrefixListResult); err != nil { + return RegisteredPrefixesClientListByPeeringResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_response_types.go b/sdk/resourcemanager/peering/armpeering/zz_generated_response_types.go index 54ddb78a6cd0..4249077817dc 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_response_types.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_response_types.go @@ -10,6 +10,60 @@ package armpeering import "net/http" +// CdnPeeringPrefixesClientListResponse contains the response from method CdnPeeringPrefixesClient.List. +type CdnPeeringPrefixesClientListResponse struct { + CdnPeeringPrefixesClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CdnPeeringPrefixesClientListResult contains the result from method CdnPeeringPrefixesClient.List. +type CdnPeeringPrefixesClientListResult struct { + CdnPeeringPrefixListResult +} + +// ConnectionMonitorTestsClientCreateOrUpdateResponse contains the response from method ConnectionMonitorTestsClient.CreateOrUpdate. +type ConnectionMonitorTestsClientCreateOrUpdateResponse struct { + ConnectionMonitorTestsClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ConnectionMonitorTestsClientCreateOrUpdateResult contains the result from method ConnectionMonitorTestsClient.CreateOrUpdate. +type ConnectionMonitorTestsClientCreateOrUpdateResult struct { + ConnectionMonitorTest +} + +// ConnectionMonitorTestsClientDeleteResponse contains the response from method ConnectionMonitorTestsClient.Delete. +type ConnectionMonitorTestsClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ConnectionMonitorTestsClientGetResponse contains the response from method ConnectionMonitorTestsClient.Get. +type ConnectionMonitorTestsClientGetResponse struct { + ConnectionMonitorTestsClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ConnectionMonitorTestsClientGetResult contains the result from method ConnectionMonitorTestsClient.Get. +type ConnectionMonitorTestsClientGetResult struct { + ConnectionMonitorTest +} + +// ConnectionMonitorTestsClientListByPeeringServiceResponse contains the response from method ConnectionMonitorTestsClient.ListByPeeringService. +type ConnectionMonitorTestsClientListByPeeringServiceResponse struct { + ConnectionMonitorTestsClientListByPeeringServiceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ConnectionMonitorTestsClientListByPeeringServiceResult contains the result from method ConnectionMonitorTestsClient.ListByPeeringService. +type ConnectionMonitorTestsClientListByPeeringServiceResult struct { + ConnectionMonitorTestListResult +} + // LegacyPeeringsClientListResponse contains the response from method LegacyPeeringsClient.List. type LegacyPeeringsClientListResponse struct { LegacyPeeringsClientListResult @@ -34,6 +88,18 @@ type LocationsClientListResult struct { LocationListResult } +// LookingGlassClientInvokeResponse contains the response from method LookingGlassClient.Invoke. +type LookingGlassClientInvokeResponse struct { + LookingGlassClientInvokeResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LookingGlassClientInvokeResult contains the result from method LookingGlassClient.Invoke. +type LookingGlassClientInvokeResult struct { + LookingGlassOutput +} + // ManagementClientCheckServiceProviderAvailabilityResponse contains the response from method ManagementClient.CheckServiceProviderAvailability. type ManagementClientCheckServiceProviderAvailabilityResponse struct { ManagementClientCheckServiceProviderAvailabilityResult @@ -166,6 +232,36 @@ type PeeringsClientUpdateResult struct { Peering } +// PrefixesClientCreateOrUpdateResponse contains the response from method PrefixesClient.CreateOrUpdate. +type PrefixesClientCreateOrUpdateResponse struct { + PrefixesClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrefixesClientCreateOrUpdateResult contains the result from method PrefixesClient.CreateOrUpdate. +type PrefixesClientCreateOrUpdateResult struct { + ServicePrefix +} + +// PrefixesClientDeleteResponse contains the response from method PrefixesClient.Delete. +type PrefixesClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrefixesClientGetResponse contains the response from method PrefixesClient.Get. +type PrefixesClientGetResponse struct { + PrefixesClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PrefixesClientGetResult contains the result from method PrefixesClient.Get. +type PrefixesClientGetResult struct { + ServicePrefix +} + // PrefixesClientListByPeeringServiceResponse contains the response from method PrefixesClient.ListByPeeringService. type PrefixesClientListByPeeringServiceResponse struct { PrefixesClientListByPeeringServiceResult @@ -178,46 +274,124 @@ type PrefixesClientListByPeeringServiceResult struct { ServicePrefixListResult } -// ServiceLocationsClientListResponse contains the response from method ServiceLocationsClient.List. -type ServiceLocationsClientListResponse struct { - ServiceLocationsClientListResult +// ReceivedRoutesClientListByPeeringResponse contains the response from method ReceivedRoutesClient.ListByPeering. +type ReceivedRoutesClientListByPeeringResponse struct { + ReceivedRoutesClientListByPeeringResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ServiceLocationsClientListResult contains the result from method ServiceLocationsClient.List. -type ServiceLocationsClientListResult struct { - ServiceLocationListResult +// ReceivedRoutesClientListByPeeringResult contains the result from method ReceivedRoutesClient.ListByPeering. +type ReceivedRoutesClientListByPeeringResult struct { + ReceivedRouteListResult } -// ServicePrefixesClientCreateOrUpdateResponse contains the response from method ServicePrefixesClient.CreateOrUpdate. -type ServicePrefixesClientCreateOrUpdateResponse struct { - ServicePrefixesClientCreateOrUpdateResult +// RegisteredAsnsClientCreateOrUpdateResponse contains the response from method RegisteredAsnsClient.CreateOrUpdate. +type RegisteredAsnsClientCreateOrUpdateResponse struct { + RegisteredAsnsClientCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ServicePrefixesClientCreateOrUpdateResult contains the result from method ServicePrefixesClient.CreateOrUpdate. -type ServicePrefixesClientCreateOrUpdateResult struct { - ServicePrefix +// RegisteredAsnsClientCreateOrUpdateResult contains the result from method RegisteredAsnsClient.CreateOrUpdate. +type RegisteredAsnsClientCreateOrUpdateResult struct { + RegisteredAsn } -// ServicePrefixesClientDeleteResponse contains the response from method ServicePrefixesClient.Delete. -type ServicePrefixesClientDeleteResponse struct { +// RegisteredAsnsClientDeleteResponse contains the response from method RegisteredAsnsClient.Delete. +type RegisteredAsnsClientDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ServicePrefixesClientGetResponse contains the response from method ServicePrefixesClient.Get. -type ServicePrefixesClientGetResponse struct { - ServicePrefixesClientGetResult +// RegisteredAsnsClientGetResponse contains the response from method RegisteredAsnsClient.Get. +type RegisteredAsnsClientGetResponse struct { + RegisteredAsnsClientGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ServicePrefixesClientGetResult contains the result from method ServicePrefixesClient.Get. -type ServicePrefixesClientGetResult struct { - ServicePrefix +// RegisteredAsnsClientGetResult contains the result from method RegisteredAsnsClient.Get. +type RegisteredAsnsClientGetResult struct { + RegisteredAsn +} + +// RegisteredAsnsClientListByPeeringResponse contains the response from method RegisteredAsnsClient.ListByPeering. +type RegisteredAsnsClientListByPeeringResponse struct { + RegisteredAsnsClientListByPeeringResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RegisteredAsnsClientListByPeeringResult contains the result from method RegisteredAsnsClient.ListByPeering. +type RegisteredAsnsClientListByPeeringResult struct { + RegisteredAsnListResult +} + +// RegisteredPrefixesClientCreateOrUpdateResponse contains the response from method RegisteredPrefixesClient.CreateOrUpdate. +type RegisteredPrefixesClientCreateOrUpdateResponse struct { + RegisteredPrefixesClientCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RegisteredPrefixesClientCreateOrUpdateResult contains the result from method RegisteredPrefixesClient.CreateOrUpdate. +type RegisteredPrefixesClientCreateOrUpdateResult struct { + RegisteredPrefix +} + +// RegisteredPrefixesClientDeleteResponse contains the response from method RegisteredPrefixesClient.Delete. +type RegisteredPrefixesClientDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RegisteredPrefixesClientGetResponse contains the response from method RegisteredPrefixesClient.Get. +type RegisteredPrefixesClientGetResponse struct { + RegisteredPrefixesClientGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RegisteredPrefixesClientGetResult contains the result from method RegisteredPrefixesClient.Get. +type RegisteredPrefixesClientGetResult struct { + RegisteredPrefix +} + +// RegisteredPrefixesClientListByPeeringResponse contains the response from method RegisteredPrefixesClient.ListByPeering. +type RegisteredPrefixesClientListByPeeringResponse struct { + RegisteredPrefixesClientListByPeeringResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RegisteredPrefixesClientListByPeeringResult contains the result from method RegisteredPrefixesClient.ListByPeering. +type RegisteredPrefixesClientListByPeeringResult struct { + RegisteredPrefixListResult +} + +// ServiceCountriesClientListResponse contains the response from method ServiceCountriesClient.List. +type ServiceCountriesClientListResponse struct { + ServiceCountriesClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServiceCountriesClientListResult contains the result from method ServiceCountriesClient.List. +type ServiceCountriesClientListResult struct { + ServiceCountryListResult +} + +// ServiceLocationsClientListResponse contains the response from method ServiceLocationsClient.List. +type ServiceLocationsClientListResponse struct { + ServiceLocationsClientListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServiceLocationsClientListResult contains the result from method ServiceLocationsClient.List. +type ServiceLocationsClientListResult struct { + ServiceLocationListResult } // ServiceProvidersClientListResponse contains the response from method ServiceProvidersClient.List. @@ -262,6 +436,12 @@ type ServicesClientGetResult struct { Service } +// ServicesClientInitializeConnectionMonitorResponse contains the response from method ServicesClient.InitializeConnectionMonitor. +type ServicesClientInitializeConnectionMonitorResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + // ServicesClientListByResourceGroupResponse contains the response from method ServicesClient.ListByResourceGroup. type ServicesClientListByResourceGroupResponse struct { ServicesClientListByResourceGroupResult diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_servicecountries_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_servicecountries_client.go new file mode 100644 index 000000000000..b66ba4ab5685 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_servicecountries_client.go @@ -0,0 +1,92 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ServiceCountriesClient contains the methods for the PeeringServiceCountries group. +// Don't use this type directly, use NewServiceCountriesClient() instead. +type ServiceCountriesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServiceCountriesClient creates a new instance of ServiceCountriesClient with the specified values. +// subscriptionID - The Azure subscription ID. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServiceCountriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceCountriesClient { + if options == nil { + options = &arm.ClientOptions{} + } + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud + } + client := &ServiceCountriesClient{ + subscriptionID: subscriptionID, + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), + } + return client +} + +// List - Lists all of the available countries for peering service. +// If the operation fails it returns an *azcore.ResponseError type. +// options - ServiceCountriesClientListOptions contains the optional parameters for the ServiceCountriesClient.List method. +func (client *ServiceCountriesClient) List(options *ServiceCountriesClientListOptions) *ServiceCountriesClientListPager { + return &ServiceCountriesClientListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp ServiceCountriesClientListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ServiceCountryListResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *ServiceCountriesClient) listCreateRequest(ctx context.Context, options *ServiceCountriesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/peeringServiceCountries" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ServiceCountriesClient) listHandleResponse(resp *http.Response) (ServiceCountriesClientListResponse, error) { + result := ServiceCountriesClientListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ServiceCountryListResult); err != nil { + return ServiceCountriesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_servicelocations_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_servicelocations_client.go index 9c04c54ed8fd..223f837329fa 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_servicelocations_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_servicelocations_client.go @@ -34,22 +34,22 @@ type ServiceLocationsClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewServiceLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceLocationsClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ServiceLocationsClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } -// List - Lists all of the available peering service locations for the specified kind of peering. +// List - Lists all of the available locations for peering service. // If the operation fails it returns an *azcore.ResponseError type. // options - ServiceLocationsClientListOptions contains the optional parameters for the ServiceLocationsClient.List method. func (client *ServiceLocationsClient) List(options *ServiceLocationsClientListOptions) *ServiceLocationsClientListPager { @@ -76,7 +76,10 @@ func (client *ServiceLocationsClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + if options != nil && options.Country != nil { + reqQP.Set("country", *options.Country) + } + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_serviceprefixes_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_serviceprefixes_client.go deleted file mode 100644 index 1fb6ea27514f..000000000000 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_serviceprefixes_client.go +++ /dev/null @@ -1,223 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armpeering - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ServicePrefixesClient contains the methods for the PeeringServicePrefixes group. -// Don't use this type directly, use NewServicePrefixesClient() instead. -type ServicePrefixesClient struct { - host string - subscriptionID string - pl runtime.Pipeline -} - -// NewServicePrefixesClient creates a new instance of ServicePrefixesClient with the specified values. -// subscriptionID - The Azure subscription ID. -// credential - used to authorize requests. Usually a credential from azidentity. -// options - pass nil to accept the default values. -func NewServicePrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicePrefixesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options - } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud - } - client := &ServicePrefixesClient{ - subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), - } - return client -} - -// CreateOrUpdate - Creates or updates the peering prefix. -// If the operation fails it returns an *azcore.ResponseError type. -// resourceGroupName - The resource group name. -// peeringServiceName - The peering service name. -// prefixName - The prefix name -// peeringServicePrefix - The IP prefix for an peering -// options - ServicePrefixesClientCreateOrUpdateOptions contains the optional parameters for the ServicePrefixesClient.CreateOrUpdate -// method. -func (client *ServicePrefixesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, peeringServicePrefix ServicePrefix, options *ServicePrefixesClientCreateOrUpdateOptions) (ServicePrefixesClientCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, peeringServicePrefix, options) - if err != nil { - return ServicePrefixesClientCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServicePrefixesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return ServicePrefixesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServicePrefixesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, peeringServicePrefix ServicePrefix, options *ServicePrefixesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if peeringServiceName == "" { - return nil, errors.New("parameter peeringServiceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) - if prefixName == "" { - return nil, errors.New("parameter prefixName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, peeringServicePrefix) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ServicePrefixesClient) createOrUpdateHandleResponse(resp *http.Response) (ServicePrefixesClientCreateOrUpdateResponse, error) { - result := ServicePrefixesClientCreateOrUpdateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ServicePrefix); err != nil { - return ServicePrefixesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - removes the peering prefix. -// If the operation fails it returns an *azcore.ResponseError type. -// resourceGroupName - The resource group name. -// peeringServiceName - The peering service name. -// prefixName - The prefix name -// options - ServicePrefixesClientDeleteOptions contains the optional parameters for the ServicePrefixesClient.Delete method. -func (client *ServicePrefixesClient) Delete(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *ServicePrefixesClientDeleteOptions) (ServicePrefixesClientDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, options) - if err != nil { - return ServicePrefixesClientDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServicePrefixesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { - return ServicePrefixesClientDeleteResponse{}, runtime.NewResponseError(resp) - } - return ServicePrefixesClientDeleteResponse{RawResponse: resp}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ServicePrefixesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *ServicePrefixesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if peeringServiceName == "" { - return nil, errors.New("parameter peeringServiceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) - if prefixName == "" { - return nil, errors.New("parameter prefixName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// Get - Gets the peering service prefix. -// If the operation fails it returns an *azcore.ResponseError type. -// resourceGroupName - The resource group name. -// peeringServiceName - The peering service name. -// prefixName - The prefix name. -// options - ServicePrefixesClientGetOptions contains the optional parameters for the ServicePrefixesClient.Get method. -func (client *ServicePrefixesClient) Get(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *ServicePrefixesClientGetOptions) (ServicePrefixesClientGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, peeringServiceName, prefixName, options) - if err != nil { - return ServicePrefixesClientGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServicePrefixesClientGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServicePrefixesClientGetResponse{}, runtime.NewResponseError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *ServicePrefixesClient) getCreateRequest(ctx context.Context, resourceGroupName string, peeringServiceName string, prefixName string, options *ServicePrefixesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Peering/peeringServices/{peeringServiceName}/prefixes/{prefixName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if peeringServiceName == "" { - return nil, errors.New("parameter peeringServiceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{peeringServiceName}", url.PathEscape(peeringServiceName)) - if prefixName == "" { - return nil, errors.New("parameter prefixName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{prefixName}", url.PathEscape(prefixName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ServicePrefixesClient) getHandleResponse(resp *http.Response) (ServicePrefixesClientGetResponse, error) { - result := ServicePrefixesClientGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ServicePrefix); err != nil { - return ServicePrefixesClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_serviceproviders_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_serviceproviders_client.go index d1cb0ba51295..268841ce1522 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_serviceproviders_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_serviceproviders_client.go @@ -34,17 +34,17 @@ type ServiceProvidersClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewServiceProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceProvidersClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ServiceProvidersClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -76,7 +76,7 @@ func (client *ServiceProvidersClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_services_client.go b/sdk/resourcemanager/peering/armpeering/zz_generated_services_client.go index 2bbfcacfcef8..8d3cbdc8a173 100644 --- a/sdk/resourcemanager/peering/armpeering/zz_generated_services_client.go +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_services_client.go @@ -34,17 +34,17 @@ type ServicesClient struct { // credential - used to authorize requests. Usually a credential from azidentity. // options - pass nil to accept the default values. func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { - cp := arm.ClientOptions{} - if options != nil { - cp = *options + if options == nil { + options = &arm.ClientOptions{} } - if len(cp.Endpoint) == 0 { - cp.Endpoint = arm.AzurePublicCloud + ep := options.Endpoint + if len(ep) == 0 { + ep = arm.AzurePublicCloud } client := &ServicesClient{ subscriptionID: subscriptionID, - host: string(cp.Endpoint), - pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp), + host: string(ep), + pl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options), } return client } @@ -91,7 +91,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, peeringService) @@ -146,7 +146,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -192,7 +192,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -207,6 +207,43 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl return result, nil } +// InitializeConnectionMonitor - Initialize Peering Service for Connection Monitor functionality +// If the operation fails it returns an *azcore.ResponseError type. +// options - ServicesClientInitializeConnectionMonitorOptions contains the optional parameters for the ServicesClient.InitializeConnectionMonitor +// method. +func (client *ServicesClient) InitializeConnectionMonitor(ctx context.Context, options *ServicesClientInitializeConnectionMonitorOptions) (ServicesClientInitializeConnectionMonitorResponse, error) { + req, err := client.initializeConnectionMonitorCreateRequest(ctx, options) + if err != nil { + return ServicesClientInitializeConnectionMonitorResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServicesClientInitializeConnectionMonitorResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServicesClientInitializeConnectionMonitorResponse{}, runtime.NewResponseError(resp) + } + return ServicesClientInitializeConnectionMonitorResponse{RawResponse: resp}, nil +} + +// initializeConnectionMonitorCreateRequest creates the InitializeConnectionMonitor request. +func (client *ServicesClient) initializeConnectionMonitorCreateRequest(ctx context.Context, options *ServicesClientInitializeConnectionMonitorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Peering/initializeConnectionMonitor" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-06-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + // ListByResourceGroup - Lists all of the peering services under the given subscription and resource group. // If the operation fails it returns an *azcore.ResponseError type. // resourceGroupName - The name of the resource group. @@ -240,7 +277,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -283,7 +320,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -339,7 +376,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2019-08-01-preview") + reqQP.Set("api-version", "2021-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tags) diff --git a/sdk/resourcemanager/peering/armpeering/zz_generated_time_rfc3339.go b/sdk/resourcemanager/peering/armpeering/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..c39b1972a368 --- /dev/null +++ b/sdk/resourcemanager/peering/armpeering/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armpeering + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +}