From 55ada26f823fd7a06c3aa566227ff0c90f941494 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 23 Nov 2022 23:34:01 +0000 Subject: [PATCH] CodeGen from PR 21631 in Azure/azure-rest-api-specs Merge 5897ac365bfdd4503ada9c6422097a410af48890 into 7a54c1a83d14da431c0ae48c4315cba143084bce --- .../armhybridconnectivity/CHANGELOG.md | 25 + .../armhybridconnectivity/autorest.md | 6 +- ...zz_generated_constants.go => constants.go} | 35 +- ...ndpoints_client.go => endpoints_client.go} | 89 +- .../armhybridconnectivity/go.mod | 14 +- .../armhybridconnectivity/go.sum | 24 +- .../{zz_generated_models.go => models.go} | 32 + .../armhybridconnectivity/models_serde.go | 772 ++++++++++++++++++ ...rations_client.go => operations_client.go} | 6 +- ...ed_response_types.go => response_types.go} | 6 + ...erated_time_rfc3339.go => time_rfc3339.go} | 1 + ...generated_example_endpoints_client_test.go | 188 ----- ...enerated_example_operations_client_test.go | 41 - .../zz_generated_models_serde.go | 94 --- 14 files changed, 952 insertions(+), 381 deletions(-) rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_constants.go => constants.go} (72%) rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_endpoints_client.go => endpoints_client.go} (81%) rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_models.go => models.go} (90%) create mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_operations_client.go => operations_client.go} (95%) rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_response_types.go => response_types.go} (87%) rename sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/{zz_generated_time_rfc3339.go => time_rfc3339.go} (99%) delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_endpoints_client_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_operations_client_test.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models_serde.go diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md index 128b0f98effb..6a6267c05c11 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 1.0.0 (2022-11-23) +### Breaking Changes + +- Function `*EndpointsClient.ListCredentials` parameter(s) have been changed from `(context.Context, string, string, *EndpointsClientListCredentialsOptions)` to `(context.Context, string, string, ListCredentialsRequest, *EndpointsClientListCredentialsOptions)` + +### Features Added + +- New const `ServiceNameSSH` +- New const `ServiceNameTypeSSH` +- New const `ServiceNameTypeWAC` +- New const `ServiceNameWAC` +- New type alias `ServiceName` +- New type alias `ServiceNameType` +- New function `*EndpointsClient.ListIngressGatewayCredentials(context.Context, string, string, *EndpointsClientListIngressGatewayCredentialsOptions) (EndpointsClientListIngressGatewayCredentialsResponse, error)` +- New function `PossibleServiceNameTypeValues() []ServiceNameType` +- New function `PossibleServiceNameValues() []ServiceName` +- New struct `EndpointsClientListIngressGatewayCredentialsOptions` +- New struct `EndpointsClientListIngressGatewayCredentialsResponse` +- New struct `ListCredentialsRequest` +- New struct `ServiceConfigurations` +- New field `ServiceConfigurations` in struct `EndpointProperties` +- New field `ServiceName` in struct `ManagedProxyRequest` +- New field `ServiceConfigurationToken` in struct `RelayNamespaceAccessProperties` + + ## 0.5.0 (2022-05-18) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.5.0, which contains breaking changes. diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md index f669d30ca468..fc6ddc6aae7c 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridconnectivity/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d55b8005f05b040b852c15e74a0f3e36494a15e1/specification/hybridconnectivity/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridconnectivity/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/hybridconnectivity/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.5.0 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_constants.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go similarity index 72% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_constants.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go index 843f236ef72d..3d66848333f2 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_constants.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go @@ -5,12 +5,13 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity const ( moduleName = "armhybridconnectivity" - moduleVersion = "v0.5.0" + moduleVersion = "v1.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -66,6 +67,38 @@ func PossibleOriginValues() []Origin { } } +// ServiceName - The name of the service. +type ServiceName string + +const ( + ServiceNameSSH ServiceName = "SSH" + ServiceNameWAC ServiceName = "WAC" +) + +// PossibleServiceNameValues returns the possible values for the ServiceName const type. +func PossibleServiceNameValues() []ServiceName { + return []ServiceName{ + ServiceNameSSH, + ServiceNameWAC, + } +} + +// ServiceNameType - The type of service enabled. +type ServiceNameType string + +const ( + ServiceNameTypeSSH ServiceNameType = "SSH" + ServiceNameTypeWAC ServiceNameType = "WAC" +) + +// PossibleServiceNameTypeValues returns the possible values for the ServiceNameType const type. +func PossibleServiceNameTypeValues() []ServiceNameType { + return []ServiceNameType{ + ServiceNameTypeSSH, + ServiceNameTypeWAC, + } +} + // Type - The type of endpoint. type Type string diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_endpoints_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go similarity index 81% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_endpoints_client.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go index 932995c4d7aa..c805458207ee 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_endpoints_client.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity @@ -52,7 +53,7 @@ func NewEndpointsClient(credential azcore.TokenCredential, options *arm.ClientOp // CreateOrUpdate - Create or update the endpoint to the target resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. // endpointResource - Endpoint details @@ -83,7 +84,7 @@ func (client *EndpointsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, endpointResource) @@ -100,7 +101,7 @@ func (client *EndpointsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes the endpoint access to the target resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. // options - EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. @@ -129,7 +130,7 @@ func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -137,7 +138,7 @@ func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets the endpoint to the resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. // options - EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. @@ -166,7 +167,7 @@ func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceURI return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,8 +183,7 @@ func (client *EndpointsClient) getHandleResponse(resp *http.Response) (Endpoints } // NewListPager - List of endpoints to the target resource. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // options - EndpointsClientListOptions contains the optional parameters for the EndpointsClient.List method. func (client *EndpointsClient) NewListPager(resourceURI string, options *EndpointsClientListOptions) *runtime.Pager[EndpointsClientListResponse] { @@ -223,7 +223,7 @@ func (client *EndpointsClient) listCreateRequest(ctx context.Context, resourceUR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -240,13 +240,14 @@ func (client *EndpointsClient) listHandleResponse(resp *http.Response) (Endpoint // ListCredentials - Gets the endpoint access credentials to the resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. +// listCredentialsRequest - Object of type ListCredentialsRequest // options - EndpointsClientListCredentialsOptions contains the optional parameters for the EndpointsClient.ListCredentials // method. -func (client *EndpointsClient) ListCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (EndpointsClientListCredentialsResponse, error) { - req, err := client.listCredentialsCreateRequest(ctx, resourceURI, endpointName, options) +func (client *EndpointsClient) ListCredentials(ctx context.Context, resourceURI string, endpointName string, listCredentialsRequest ListCredentialsRequest, options *EndpointsClientListCredentialsOptions) (EndpointsClientListCredentialsResponse, error) { + req, err := client.listCredentialsCreateRequest(ctx, resourceURI, endpointName, listCredentialsRequest, options) if err != nil { return EndpointsClientListCredentialsResponse{}, err } @@ -261,7 +262,7 @@ func (client *EndpointsClient) ListCredentials(ctx context.Context, resourceURI } // listCredentialsCreateRequest creates the ListCredentials request. -func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListCredentialsOptions) (*policy.Request, error) { +func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, listCredentialsRequest ListCredentialsRequest, options *EndpointsClientListCredentialsOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listCredentials" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) @@ -270,13 +271,13 @@ func (client *EndpointsClient) listCredentialsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") if options != nil && options.Expiresin != nil { reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil + return req, runtime.MarshalAsJSON(req, listCredentialsRequest) } // listCredentialsHandleResponse handles the ListCredentials response. @@ -288,9 +289,59 @@ func (client *EndpointsClient) listCredentialsHandleResponse(resp *http.Response return result, nil } +// ListIngressGatewayCredentials - Gets the ingress gateway endpoint credentials +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2023-03-15 +// resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. +// endpointName - The endpoint name. +// options - EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials +// method. +func (client *EndpointsClient) ListIngressGatewayCredentials(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (EndpointsClientListIngressGatewayCredentialsResponse, error) { + req, err := client.listIngressGatewayCredentialsCreateRequest(ctx, resourceURI, endpointName, options) + if err != nil { + return EndpointsClientListIngressGatewayCredentialsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return EndpointsClientListIngressGatewayCredentialsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return EndpointsClientListIngressGatewayCredentialsResponse{}, runtime.NewResponseError(resp) + } + return client.listIngressGatewayCredentialsHandleResponse(resp) +} + +// listIngressGatewayCredentialsCreateRequest creates the ListIngressGatewayCredentials request. +func (client *EndpointsClient) listIngressGatewayCredentialsCreateRequest(ctx context.Context, resourceURI string, endpointName string, options *EndpointsClientListIngressGatewayCredentialsOptions) (*policy.Request, error) { + urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/endpoints/{endpointName}/listIngressGatewayCredentials" + urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) + urlPath = strings.ReplaceAll(urlPath, "{endpointName}", endpointName) + 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", "2023-03-15") + if options != nil && options.Expiresin != nil { + reqQP.Set("expiresin", strconv.FormatInt(*options.Expiresin, 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listIngressGatewayCredentialsHandleResponse handles the ListIngressGatewayCredentials response. +func (client *EndpointsClient) listIngressGatewayCredentialsHandleResponse(resp *http.Response) (EndpointsClientListIngressGatewayCredentialsResponse, error) { + result := EndpointsClientListIngressGatewayCredentialsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.IngressGatewayResource); err != nil { + return EndpointsClientListIngressGatewayCredentialsResponse{}, err + } + return result, nil +} + // ListManagedProxyDetails - Fetches the managed proxy details // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. // managedProxyRequest - Object of type ManagedProxyRequest @@ -321,7 +372,7 @@ func (client *EndpointsClient) listManagedProxyDetailsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, managedProxyRequest) @@ -338,7 +389,7 @@ func (client *EndpointsClient) listManagedProxyDetailsHandleResponse(resp *http. // Update - Update the endpoint to the target resource. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // resourceURI - The fully qualified Azure Resource manager identifier of the resource to be connected. // endpointName - The endpoint name. // endpointResource - Endpoint details @@ -368,7 +419,7 @@ func (client *EndpointsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, endpointResource) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod index d03a38e6718e..9a8fb5306056 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/ go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -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.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -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/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= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go similarity index 90% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go index a2cb3f1b8eee..b73f1e852fd4 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity @@ -33,6 +34,9 @@ type EndpointProperties struct { // The resource Id of the connectivity endpoint (optional). ResourceID *string `json:"resourceId,omitempty"` + // The enabled service configurations. + ServiceConfigurations []*ServiceConfigurations `json:"serviceConfigurations,omitempty"` + // READ-ONLY; The resource provisioning state. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } @@ -76,6 +80,13 @@ type EndpointsClientListCredentialsOptions struct { Expiresin *int64 } +// EndpointsClientListIngressGatewayCredentialsOptions contains the optional parameters for the EndpointsClient.ListIngressGatewayCredentials +// method. +type EndpointsClientListIngressGatewayCredentialsOptions struct { + // The is how long the endpoint access token is valid (in seconds). + Expiresin *int64 +} + // EndpointsClientListManagedProxyDetailsOptions contains the optional parameters for the EndpointsClient.ListManagedProxyDetails // method. type EndpointsClientListManagedProxyDetailsOptions struct { @@ -153,6 +164,12 @@ type IngressProfileProperties struct { Hostname *string `json:"hostname,omitempty"` } +// ListCredentialsRequest - Represent ListCredentials Request object. +type ListCredentialsRequest struct { + // REQUIRED; The name of the service. + ServiceName *ServiceName `json:"serviceName,omitempty"` +} + // ManagedProxyRequest - Represent ManageProxy Request object. type ManagedProxyRequest struct { // REQUIRED; The name of the service. @@ -160,6 +177,9 @@ type ManagedProxyRequest struct { // The target host name. Hostname *string `json:"hostname,omitempty"` + + // The name of the service. + ServiceName *ServiceName `json:"serviceName,omitempty"` } // ManagedProxyResource - Managed Proxy @@ -252,6 +272,9 @@ type RelayNamespaceAccessProperties struct { // The expiration of access key in unix time. ExpiresOn *int64 `json:"expiresOn,omitempty"` + // The token to access the enabled service. + ServiceConfigurationToken *string `json:"serviceConfigurationToken,omitempty"` + // READ-ONLY; Access key for hybrid connection. AccessKey *string `json:"accessKey,omitempty" azure:"ro"` } @@ -268,6 +291,15 @@ type Resource struct { Type *string `json:"type,omitempty" azure:"ro"` } +// ServiceConfigurations - The service configuration object definition +type ServiceConfigurations struct { + // The type of service enabled. + Name *ServiceNameType `json:"name,omitempty"` + + // The port on which service is enabled. + Port *string `json:"port,omitempty"` +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go new file mode 100644 index 000000000000..d35a7e3c518a --- /dev/null +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go @@ -0,0 +1,772 @@ +//go:build go1.18 +// +build go1.18 + +// 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. +// DO NOT EDIT. + +package armhybridconnectivity + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AADProfileProperties. +func (a AADProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serverId", a.ServerID) + populate(objectMap, "tenantId", a.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADProfileProperties. +func (a *AADProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serverId": + err = unpopulate(val, "ServerID", &a.ServerID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &a.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointAccessResource. +func (e EndpointAccessResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "relay", e.Relay) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointAccessResource. +func (e *EndpointAccessResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "relay": + err = unpopulate(val, "Relay", &e.Relay) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointProperties. +func (e EndpointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "resourceId", e.ResourceID) + populate(objectMap, "serviceConfigurations", e.ServiceConfigurations) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointProperties. +func (e *EndpointProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &e.ResourceID) + delete(rawMsg, key) + case "serviceConfigurations": + err = unpopulate(val, "ServiceConfigurations", &e.ServiceConfigurations) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointResource. +func (e EndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointResource. +func (e *EndpointResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EndpointsList. +func (e EndpointsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EndpointsList. +func (e *EndpointsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "error", e.Error) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "error": + err = unpopulate(val, "Error", &e.Error) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IngressGatewayResource. +func (i IngressGatewayResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ingress", i.Ingress) + populate(objectMap, "relay", i.Relay) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngressGatewayResource. +func (i *IngressGatewayResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "ingress": + err = unpopulate(val, "Ingress", &i.Ingress) + delete(rawMsg, key) + case "relay": + err = unpopulate(val, "Relay", &i.Relay) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type IngressProfileProperties. +func (i IngressProfileProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "aadProfile", i.AADProfile) + populate(objectMap, "hostname", i.Hostname) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngressProfileProperties. +func (i *IngressProfileProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "aadProfile": + err = unpopulate(val, "AADProfile", &i.AADProfile) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &i.Hostname) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCredentialsRequest. +func (l ListCredentialsRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceName", l.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCredentialsRequest. +func (l *ListCredentialsRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceName": + err = unpopulate(val, "ServiceName", &l.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedProxyRequest. +func (m ManagedProxyRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "hostname", m.Hostname) + populate(objectMap, "service", m.Service) + populate(objectMap, "serviceName", m.ServiceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyRequest. +func (m *ManagedProxyRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "hostname": + err = unpopulate(val, "Hostname", &m.Hostname) + delete(rawMsg, key) + case "service": + err = unpopulate(val, "Service", &m.Service) + delete(rawMsg, key) + case "serviceName": + err = unpopulate(val, "ServiceName", &m.ServiceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedProxyResource. +func (m ManagedProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiresOn", m.ExpiresOn) + populate(objectMap, "proxy", m.Proxy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedProxyResource. +func (m *ManagedProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expiresOn": + err = unpopulate(val, "ExpiresOn", &m.ExpiresOn) + delete(rawMsg, key) + case "proxy": + err = unpopulate(val, "Proxy", &m.Proxy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RelayNamespaceAccessProperties. +func (r RelayNamespaceAccessProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accessKey", r.AccessKey) + populate(objectMap, "expiresOn", r.ExpiresOn) + populate(objectMap, "hybridConnectionName", r.HybridConnectionName) + populate(objectMap, "namespaceName", r.NamespaceName) + populate(objectMap, "namespaceNameSuffix", r.NamespaceNameSuffix) + populate(objectMap, "serviceConfigurationToken", r.ServiceConfigurationToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelayNamespaceAccessProperties. +func (r *RelayNamespaceAccessProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accessKey": + err = unpopulate(val, "AccessKey", &r.AccessKey) + delete(rawMsg, key) + case "expiresOn": + err = unpopulate(val, "ExpiresOn", &r.ExpiresOn) + delete(rawMsg, key) + case "hybridConnectionName": + err = unpopulate(val, "HybridConnectionName", &r.HybridConnectionName) + delete(rawMsg, key) + case "namespaceName": + err = unpopulate(val, "NamespaceName", &r.NamespaceName) + delete(rawMsg, key) + case "namespaceNameSuffix": + err = unpopulate(val, "NamespaceNameSuffix", &r.NamespaceNameSuffix) + delete(rawMsg, key) + case "serviceConfigurationToken": + err = unpopulate(val, "ServiceConfigurationToken", &r.ServiceConfigurationToken) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServiceConfigurations. +func (s ServiceConfigurations) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", s.Name) + populate(objectMap, "port", s.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceConfigurations. +func (s *ServiceConfigurations) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &s.Port) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_operations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go similarity index 95% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_operations_client.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go index b991a671825c..86cb17c584e4 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_operations_client.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity @@ -49,8 +50,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Lists the available Hybrid Connectivity REST API operations. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2022-05-01-preview +// Generated from API version 2023-03-15 // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -88,7 +88,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-05-01-preview") + reqQP.Set("api-version", "2023-03-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_response_types.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go similarity index 87% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_response_types.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go index f96d7bac500f..e4de15ce84b3 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_response_types.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/response_types.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity @@ -28,6 +29,11 @@ type EndpointsClientListCredentialsResponse struct { EndpointAccessResource } +// EndpointsClientListIngressGatewayCredentialsResponse contains the response from method EndpointsClient.ListIngressGatewayCredentials. +type EndpointsClientListIngressGatewayCredentialsResponse struct { + IngressGatewayResource +} + // EndpointsClientListManagedProxyDetailsResponse contains the response from method EndpointsClient.ListManagedProxyDetails. type EndpointsClientListManagedProxyDetailsResponse struct { ManagedProxyResource diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go index 5abeef060d15..1675e25d069a 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/time_rfc3339.go @@ -5,6 +5,7 @@ // 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. +// DO NOT EDIT. package armhybridconnectivity diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_endpoints_client_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_endpoints_client_test.go deleted file mode 100644 index 311097bf8fb6..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_endpoints_client_test.go +++ /dev/null @@ -1,188 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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 armhybridconnectivity_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/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsList.json -func ExampleEndpointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsGetCustom.json -func ExampleEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - "custom", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsPutCustom.json -func ExampleEndpointsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - "custom", - armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeCustom), - ResourceID: to.Ptr("/subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.Relay/namespaces/custom-relay-namespace"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsPatchDefault.json -func ExampleEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - "default", - armhybridconnectivity.EndpointResource{ - Properties: &armhybridconnectivity.EndpointProperties{ - Type: to.Ptr(armhybridconnectivity.TypeDefault), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsDeleteDefault.json -func ExampleEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsPostListCredentials.json -func ExampleEndpointsClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListCredentials(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", - "default", - &armhybridconnectivity.EndpointsClientListCredentialsOptions{Expiresin: to.Ptr[int64](10800)}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/EndpointsPostListManagedProxyDetails.json -func ExampleEndpointsClient_ListManagedProxyDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewEndpointsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListManagedProxyDetails(ctx, - "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", - "default", - armhybridconnectivity.ManagedProxyRequest{ - Hostname: to.Ptr("r.proxy.arc.com"), - Service: to.Ptr("127.0.0.1:65035"), - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_operations_client_test.go deleted file mode 100644 index 12da14ba413c..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/ze_generated_example_operations_client_test.go +++ /dev/null @@ -1,41 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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 armhybridconnectivity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/hybridconnectivity/resource-manager/Microsoft.HybridConnectivity/preview/2022-05-01-preview/examples/OperationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armhybridconnectivity.NewOperationsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models_serde.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models_serde.go deleted file mode 100644 index b35fb118e29c..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/zz_generated_models_serde.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// 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 armhybridconnectivity - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type EndpointResource. -func (e EndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}