From d9d44c0d1d484769706a833157a34975f9623d17 Mon Sep 17 00:00:00 2001 From: Judy Liu Date: Thu, 19 Dec 2024 11:35:37 +0800 Subject: [PATCH] [Release] sdk/resourcemanager/deviceregistry/armdeviceregistry/0.2.0 generation from spec commit: bd37988c515821dcd48192ec1db5cb39c39e3c97 (#23861) --- .../armdeviceregistry/CHANGELOG.md | 61 + .../assetendpointprofiles_client.go | 61 +- ...setendpointprofiles_client_example_test.go | 486 -------- .../armdeviceregistry/assets_client.go | 61 +- .../assets_client_example_test.go | 1082 ----------------- .../armdeviceregistry/autorest.md | 13 - .../billingcontainers_client.go | 154 +++ .../deviceregistry/armdeviceregistry/build.go | 7 - .../armdeviceregistry/client_factory.go | 16 +- .../armdeviceregistry/constants.go | 141 ++- .../fake/assetendpointprofiles_server.go | 81 +- .../armdeviceregistry/fake/assets_server.go | 81 +- .../fake/billingcontainers_server.go | 161 +++ .../armdeviceregistry/fake/internal.go | 11 +- .../fake/operations_server.go | 55 +- .../fake/operationstatus_server.go | 55 +- .../armdeviceregistry/fake/server_factory.go | 28 +- .../armdeviceregistry/fake/time_rfc3339.go | 9 +- .../deviceregistry/armdeviceregistry/go.mod | 16 +- .../deviceregistry/armdeviceregistry/go.sum | 33 +- .../armdeviceregistry/models.go | 394 +++--- .../armdeviceregistry/models_serde.go | 684 +++++++---- .../armdeviceregistry/operations_client.go | 12 +- .../operations_client_example_test.go | 54 - .../operationstatus_client.go | 16 +- .../operationstatus_client_example_test.go | 46 - .../armdeviceregistry/options.go | 29 +- .../armdeviceregistry/responses.go | 18 +- .../armdeviceregistry/time_rfc3339.go | 9 +- .../armdeviceregistry/tsp-location.yaml | 4 + 30 files changed, 1433 insertions(+), 2445 deletions(-) delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md create mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/billingcontainers_client.go delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/build.go create mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go create mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md index 96184720633d..7a4c8d73aab4 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md @@ -1,5 +1,66 @@ # Release History +## 0.2.0 (2024-12-11) +### Breaking Changes + +- Type of `AssetProperties.Version` has been changed from `*int32` to `*int64` +- Type of `AssetStatus.Version` has been changed from `*int32` to `*int64` +- Type of `DataPoint.ObservabilityMode` has been changed from `*DataPointsObservabilityMode` to `*DataPointObservabilityMode` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Type of `Event.ObservabilityMode` has been changed from `*EventsObservabilityMode` to `*EventObservabilityMode` +- Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` +- Enum `DataPointsObservabilityMode` has been removed +- Enum `EventsObservabilityMode` has been removed +- Enum `UserAuthenticationMode` has been removed +- Struct `OwnCertificate` has been removed +- Struct `TransportAuthentication` has been removed +- Struct `TransportAuthenticationUpdate` has been removed +- Struct `UserAuthentication` has been removed +- Struct `UserAuthenticationUpdate` has been removed +- Struct `UsernamePasswordCredentialsUpdate` has been removed +- Struct `X509CredentialsUpdate` has been removed +- Field `TransportAuthentication`, `UserAuthentication` of struct `AssetEndpointProfileProperties` has been removed +- Field `TransportAuthentication`, `UserAuthentication` of struct `AssetEndpointProfileUpdateProperties` has been removed +- Field `AssetEndpointProfileURI`, `AssetType`, `DataPoints`, `DefaultDataPointsConfiguration` of struct `AssetProperties` has been removed +- Field `AssetType`, `DataPoints`, `DefaultDataPointsConfiguration` of struct `AssetUpdateProperties` has been removed +- Field `CapabilityID` of struct `DataPoint` has been removed +- Field `CapabilityID` of struct `Event` has been removed +- Field `PasswordReference`, `UsernameReference` of struct `UsernamePasswordCredentials` has been removed +- Field `CertificateReference` of struct `X509Credentials` has been removed + +### Features Added + +- New value `ProvisioningStateDeleting` added to enum type `ProvisioningState` +- New enum type `AuthenticationMethod` with values `AuthenticationMethodAnonymous`, `AuthenticationMethodCertificate`, `AuthenticationMethodUsernamePassword` +- New enum type `DataPointObservabilityMode` with values `DataPointObservabilityModeCounter`, `DataPointObservabilityModeGauge`, `DataPointObservabilityModeHistogram`, `DataPointObservabilityModeLog`, `DataPointObservabilityModeNone` +- New enum type `EventObservabilityMode` with values `EventObservabilityModeLog`, `EventObservabilityModeNone` +- New enum type `TopicRetainType` with values `TopicRetainTypeKeep`, `TopicRetainTypeNever` +- New function `NewBillingContainersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*BillingContainersClient, error)` +- New function `*BillingContainersClient.Get(context.Context, string, *BillingContainersClientGetOptions) (BillingContainersClientGetResponse, error)` +- New function `*BillingContainersClient.NewListBySubscriptionPager(*BillingContainersClientListBySubscriptionOptions) *runtime.Pager[BillingContainersClientListBySubscriptionResponse]` +- New function `*ClientFactory.NewBillingContainersClient() *BillingContainersClient` +- New struct `AssetEndpointProfileStatus` +- New struct `AssetEndpointProfileStatusError` +- New struct `AssetStatusDataset` +- New struct `AssetStatusEvent` +- New struct `Authentication` +- New struct `BillingContainer` +- New struct `BillingContainerListResult` +- New struct `BillingContainerProperties` +- New struct `Dataset` +- New struct `ErrorAdditionalInfoInfo` +- New struct `MessageSchemaReference` +- New struct `Topic` +- New field `Authentication`, `DiscoveredAssetEndpointProfileRef`, `EndpointProfileType`, `Status` in struct `AssetEndpointProfileProperties` +- New field `Authentication`, `EndpointProfileType` in struct `AssetEndpointProfileUpdateProperties` +- New field `AssetEndpointProfileRef`, `Datasets`, `DefaultDatasetsConfiguration`, `DefaultTopic`, `DiscoveredAssetRefs` in struct `AssetProperties` +- New field `Datasets`, `Events` in struct `AssetStatus` +- New field `Datasets`, `DefaultDatasetsConfiguration`, `DefaultTopic` in struct `AssetUpdateProperties` +- New field `Topic` in struct `Event` +- New field `PasswordSecretName`, `UsernameSecretName` in struct `UsernamePasswordCredentials` +- New field `CertificateSecretName` in struct `X509Credentials` + + ## 0.1.0 (2024-04-26) ### Other Changes diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client.go index 87948a4fd371..353466c4d006 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -28,7 +24,7 @@ type AssetEndpointProfilesClient struct { } // NewAssetEndpointProfilesClient creates a new instance of AssetEndpointProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAssetEndpointProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssetEndpointProfilesClient, error) { @@ -46,7 +42,7 @@ func NewAssetEndpointProfilesClient(subscriptionID string, credential azcore.Tok // BeginCreateOrReplace - Create a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetEndpointProfileName - Asset Endpoint Profile name parameter. // - resource - Resource create parameters. @@ -59,8 +55,7 @@ func (client *AssetEndpointProfilesClient) BeginCreateOrReplace(ctx context.Cont return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetEndpointProfilesClientCreateOrReplaceResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +68,7 @@ func (client *AssetEndpointProfilesClient) BeginCreateOrReplace(ctx context.Cont // CreateOrReplace - Create a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetEndpointProfilesClient) createOrReplace(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, resource AssetEndpointProfile, options *AssetEndpointProfilesClientBeginCreateOrReplaceOptions) (*http.Response, error) { var err error const operationName = "AssetEndpointProfilesClient.BeginCreateOrReplace" @@ -96,7 +91,7 @@ func (client *AssetEndpointProfilesClient) createOrReplace(ctx context.Context, } // createOrReplaceCreateRequest creates the CreateOrReplace request. -func (client *AssetEndpointProfilesClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, resource AssetEndpointProfile, options *AssetEndpointProfilesClientBeginCreateOrReplaceOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, resource AssetEndpointProfile, _ *AssetEndpointProfilesClientBeginCreateOrReplaceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +110,10 @@ func (client *AssetEndpointProfilesClient) createOrReplaceCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +123,7 @@ func (client *AssetEndpointProfilesClient) createOrReplaceCreateRequest(ctx cont // BeginDelete - Delete a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetEndpointProfileName - Asset Endpoint Profile name parameter. // - options - AssetEndpointProfilesClientBeginDeleteOptions contains the optional parameters for the AssetEndpointProfilesClient.BeginDelete @@ -139,8 +135,7 @@ func (client *AssetEndpointProfilesClient) BeginDelete(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetEndpointProfilesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -153,7 +148,7 @@ func (client *AssetEndpointProfilesClient) BeginDelete(ctx context.Context, reso // Delete - Delete a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetEndpointProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, options *AssetEndpointProfilesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AssetEndpointProfilesClient.BeginDelete" @@ -176,7 +171,7 @@ func (client *AssetEndpointProfilesClient) deleteOperation(ctx context.Context, } // deleteCreateRequest creates the Delete request. -func (client *AssetEndpointProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, options *AssetEndpointProfilesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, _ *AssetEndpointProfilesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +190,7 @@ func (client *AssetEndpointProfilesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +199,7 @@ func (client *AssetEndpointProfilesClient) deleteCreateRequest(ctx context.Conte // Get - Get a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetEndpointProfileName - Asset Endpoint Profile name parameter. // - options - AssetEndpointProfilesClientGetOptions contains the optional parameters for the AssetEndpointProfilesClient.Get @@ -232,7 +227,7 @@ func (client *AssetEndpointProfilesClient) Get(ctx context.Context, resourceGrou } // getCreateRequest creates the Get request. -func (client *AssetEndpointProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, options *AssetEndpointProfilesClientGetOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, _ *AssetEndpointProfilesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -251,7 +246,7 @@ func (client *AssetEndpointProfilesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -268,7 +263,7 @@ func (client *AssetEndpointProfilesClient) getHandleResponse(resp *http.Response // NewListByResourceGroupPager - List AssetEndpointProfile resources by resource group // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AssetEndpointProfilesClientListByResourceGroupOptions contains the optional parameters for the AssetEndpointProfilesClient.NewListByResourceGroupPager // method. @@ -296,7 +291,7 @@ func (client *AssetEndpointProfilesClient) NewListByResourceGroupPager(resourceG } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AssetEndpointProfilesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AssetEndpointProfilesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AssetEndpointProfilesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -311,7 +306,7 @@ func (client *AssetEndpointProfilesClient) listByResourceGroupCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,7 +323,7 @@ func (client *AssetEndpointProfilesClient) listByResourceGroupHandleResponse(res // NewListBySubscriptionPager - List AssetEndpointProfile resources by subscription ID // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - options - AssetEndpointProfilesClientListBySubscriptionOptions contains the optional parameters for the AssetEndpointProfilesClient.NewListBySubscriptionPager // method. func (client *AssetEndpointProfilesClient) NewListBySubscriptionPager(options *AssetEndpointProfilesClientListBySubscriptionOptions) *runtime.Pager[AssetEndpointProfilesClientListBySubscriptionResponse] { @@ -355,7 +350,7 @@ func (client *AssetEndpointProfilesClient) NewListBySubscriptionPager(options *A } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AssetEndpointProfilesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AssetEndpointProfilesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AssetEndpointProfilesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -366,7 +361,7 @@ func (client *AssetEndpointProfilesClient) listBySubscriptionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +379,7 @@ func (client *AssetEndpointProfilesClient) listBySubscriptionHandleResponse(resp // BeginUpdate - Update a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetEndpointProfileName - Asset Endpoint Profile name parameter. // - properties - The resource properties to be updated. @@ -397,8 +392,7 @@ func (client *AssetEndpointProfilesClient) BeginUpdate(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetEndpointProfilesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -411,7 +405,7 @@ func (client *AssetEndpointProfilesClient) BeginUpdate(ctx context.Context, reso // Update - Update a AssetEndpointProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetEndpointProfilesClient) update(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, properties AssetEndpointProfileUpdate, options *AssetEndpointProfilesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AssetEndpointProfilesClient.BeginUpdate" @@ -434,7 +428,7 @@ func (client *AssetEndpointProfilesClient) update(ctx context.Context, resourceG } // updateCreateRequest creates the Update request. -func (client *AssetEndpointProfilesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, properties AssetEndpointProfileUpdate, options *AssetEndpointProfilesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AssetEndpointProfilesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, properties AssetEndpointProfileUpdate, _ *AssetEndpointProfilesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/{assetEndpointProfileName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -453,9 +447,10 @@ func (client *AssetEndpointProfilesClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go deleted file mode 100644 index 7db98ffb753b..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assetendpointprofiles_client_example_test.go +++ /dev/null @@ -1,486 +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. -// DO NOT EDIT. - -package armdeviceregistry_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/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_Subscription.json -func ExampleAssetEndpointProfilesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetEndpointProfilesClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssetEndpointProfileListResult = armdeviceregistry.AssetEndpointProfileListResult{ - // Value: []*armdeviceregistry.AssetEndpointProfile{ - // { - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress1"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeCertificate), - // X509Credentials: &armdeviceregistry.X509Credentials{ - // CertificateReference: to.Ptr("certificatRef"), - // }, - // }, - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile2"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile2"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress2"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_AssetEndpointProfiles_ResourceGroup.json -func ExampleAssetEndpointProfilesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetEndpointProfilesClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssetEndpointProfileListResult = armdeviceregistry.AssetEndpointProfileListResult{ - // Value: []*armdeviceregistry.AssetEndpointProfile{ - // { - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress1"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeCertificate), - // X509Credentials: &armdeviceregistry.X509Credentials{ - // CertificateReference: to.Ptr("certificatRef"), - // }, - // }, - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // }, - // }, - // { - // Name: to.Ptr("my-assetendpointprofile2"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile2"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress2"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetEndpointProfilesClient().Get(ctx, "myResourceGroup", "my-assetendpointprofile", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // TransportAuthentication: &armdeviceregistry.TransportAuthentication{ - // OwnCertificates: []*armdeviceregistry.OwnCertificate{ - // { - // CertPasswordReference: to.Ptr("passwordRef"), - // CertSecretReference: to.Ptr("secretRef"), - // CertThumbprint: to.Ptr("myThumbprint"), - // }}, - // }, - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeUsernamePassword), - // UsernamePasswordCredentials: &armdeviceregistry.UsernamePasswordCredentials{ - // PasswordReference: to.Ptr("passwordRef"), - // UsernameReference: to.Ptr("usernameRef"), - // }, - // }, - // UUID: to.Ptr("1824a74f-21e1-4458-ae07-604d3a241d2e"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginCreateOrReplace() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-assetendpointprofile", armdeviceregistry.AssetEndpointProfile{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - UserAuthentication: &armdeviceregistry.UserAuthentication{ - Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginUpdate(ctx, "myResourceGroup", "my-assetendpointprofile", armdeviceregistry.AssetEndpointProfileUpdate{ - Properties: &armdeviceregistry.AssetEndpointProfileUpdateProperties{ - TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AssetEndpointProfile = armdeviceregistry.AssetEndpointProfile{ - // Name: to.Ptr("my-assetendpointprofile"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assetEndpointProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assetEndpointProfiles/my-assetendpointprofile"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetEndpointProfileProperties{ - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // TargetAddress: to.Ptr("https://www.example.com/myTargetAddress"), - // UserAuthentication: &armdeviceregistry.UserAuthentication{ - // Mode: to.Ptr(armdeviceregistry.UserAuthenticationModeAnonymous), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_AssetEndpointProfile.json -func ExampleAssetEndpointProfilesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetEndpointProfilesClient().BeginDelete(ctx, "myResourceGroup", "my-assetendpointprofile", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client.go index e289f58eaec7..779d54771331 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -28,7 +24,7 @@ type AssetsClient struct { } // NewAssetsClient creates a new instance of AssetsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAssetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssetsClient, error) { @@ -46,7 +42,7 @@ func NewAssetsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrReplace - Create a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetName - Asset name parameter. // - resource - Resource create parameters. @@ -59,8 +55,7 @@ func (client *AssetsClient) BeginCreateOrReplace(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetsClientCreateOrReplaceResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +68,7 @@ func (client *AssetsClient) BeginCreateOrReplace(ctx context.Context, resourceGr // CreateOrReplace - Create a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetsClient) createOrReplace(ctx context.Context, resourceGroupName string, assetName string, resource Asset, options *AssetsClientBeginCreateOrReplaceOptions) (*http.Response, error) { var err error const operationName = "AssetsClient.BeginCreateOrReplace" @@ -96,7 +91,7 @@ func (client *AssetsClient) createOrReplace(ctx context.Context, resourceGroupNa } // createOrReplaceCreateRequest creates the CreateOrReplace request. -func (client *AssetsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, assetName string, resource Asset, options *AssetsClientBeginCreateOrReplaceOptions) (*policy.Request, error) { +func (client *AssetsClient) createOrReplaceCreateRequest(ctx context.Context, resourceGroupName string, assetName string, resource Asset, _ *AssetsClientBeginCreateOrReplaceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +110,10 @@ func (client *AssetsClient) createOrReplaceCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -127,7 +123,7 @@ func (client *AssetsClient) createOrReplaceCreateRequest(ctx context.Context, re // BeginDelete - Delete a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetName - Asset name parameter. // - options - AssetsClientBeginDeleteOptions contains the optional parameters for the AssetsClient.BeginDelete method. @@ -138,8 +134,7 @@ func (client *AssetsClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -152,7 +147,7 @@ func (client *AssetsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Delete a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetsClient) deleteOperation(ctx context.Context, resourceGroupName string, assetName string, options *AssetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AssetsClient.BeginDelete" @@ -175,7 +170,7 @@ func (client *AssetsClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *AssetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, assetName string, options *AssetsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AssetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, assetName string, _ *AssetsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -194,7 +189,7 @@ func (client *AssetsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -203,7 +198,7 @@ func (client *AssetsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetName - Asset name parameter. // - options - AssetsClientGetOptions contains the optional parameters for the AssetsClient.Get method. @@ -230,7 +225,7 @@ func (client *AssetsClient) Get(ctx context.Context, resourceGroupName string, a } // getCreateRequest creates the Get request. -func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, assetName string, options *AssetsClientGetOptions) (*policy.Request, error) { +func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, assetName string, _ *AssetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -249,7 +244,7 @@ func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -266,7 +261,7 @@ func (client *AssetsClient) getHandleResponse(resp *http.Response) (AssetsClient // NewListByResourceGroupPager - List Asset resources by resource group // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AssetsClientListByResourceGroupOptions contains the optional parameters for the AssetsClient.NewListByResourceGroupPager // method. @@ -294,7 +289,7 @@ func (client *AssetsClient) NewListByResourceGroupPager(resourceGroupName string } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AssetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AssetsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AssetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AssetsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +304,7 @@ func (client *AssetsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +321,7 @@ func (client *AssetsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - List Asset resources by subscription ID // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - options - AssetsClientListBySubscriptionOptions contains the optional parameters for the AssetsClient.NewListBySubscriptionPager // method. func (client *AssetsClient) NewListBySubscriptionPager(options *AssetsClientListBySubscriptionOptions) *runtime.Pager[AssetsClientListBySubscriptionResponse] { @@ -353,7 +348,7 @@ func (client *AssetsClient) NewListBySubscriptionPager(options *AssetsClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AssetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AssetsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AssetsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AssetsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/assets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -364,7 +359,7 @@ func (client *AssetsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +377,7 @@ func (client *AssetsClient) listBySubscriptionHandleResponse(resp *http.Response // BeginUpdate - Update a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - assetName - Asset name parameter. // - properties - The resource properties to be updated. @@ -394,8 +389,7 @@ func (client *AssetsClient) BeginUpdate(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AssetsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -408,7 +402,7 @@ func (client *AssetsClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Update a Asset // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview func (client *AssetsClient) update(ctx context.Context, resourceGroupName string, assetName string, properties AssetUpdate, options *AssetsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AssetsClient.BeginUpdate" @@ -431,7 +425,7 @@ func (client *AssetsClient) update(ctx context.Context, resourceGroupName string } // updateCreateRequest creates the Update request. -func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, assetName string, properties AssetUpdate, options *AssetsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, assetName string, properties AssetUpdate, _ *AssetsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceRegistry/assets/{assetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -450,9 +444,10 @@ func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go deleted file mode 100644 index ee34e7c59908..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/assets_client_example_test.go +++ /dev/null @@ -1,1082 +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. -// DO NOT EDIT. - -package armdeviceregistry_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/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_Subscription.json -func ExampleAssetsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssetListResult = armdeviceregistry.AssetListResult{ - // Value: []*armdeviceregistry.Asset{ - // { - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // }, - // { - // Name: to.Ptr("my-asset1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset 1"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile1"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt10"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt20"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName 1"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt30"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt40"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("9AVD7KLPU03377981"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("12-984302-792341-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // Version: to.Ptr[int32](73766), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Assets_ResourceGroup.json -func ExampleAssetsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAssetsClient().NewListByResourceGroupPager("myResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AssetListResult = armdeviceregistry.AssetListResult{ - // Value: []*armdeviceregistry.Asset{ - // { - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // }, - // { - // Name: to.Ptr("my-asset1"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset1"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-2"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset 1"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile1"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt10"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt20"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName 1"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt30"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt40"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("9AVD7KLPU03377981"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("12-984302-792341-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("7824a74f-21e1-4458-ae06-604d3a241d2c"), - // Version: to.Ptr[int32](73766), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset.json -func ExampleAssetsClient_Get_getAnAsset() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetsClient().Get(ctx, "myResourceGroup", "my-asset", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_Asset_With_SyncStatus.json -func ExampleAssetsClient_Get_getAnAssetWithSyncStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAssetsClient().Get(ctx, "myResourceGroup", "my-asset", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // Status: &armdeviceregistry.AssetStatus{ - // Errors: []*armdeviceregistry.AssetStatusError{ - // { - // Code: to.Ptr[int32](500), - // Message: to.Ptr("Internal Server Error"), - // }}, - // Version: to.Ptr[int32](1), - // }, - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_With_ExternalAssetId.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithExternalAssetId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DisplayName: to.Ptr("AssetDisplayName"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_DisplayName.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithoutDisplayName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("myAsset"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Create_Asset_Without_ExternalAssetId.json -func ExampleAssetsClient_BeginCreateOrReplace_createAnAssetWithoutExternalAssetId() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginCreateOrReplace(ctx, "myResourceGroup", "my-asset", armdeviceregistry.Asset{ - Location: to.Ptr("West Europe"), - Tags: map[string]*string{ - "site": to.Ptr("building-1"), - }, - ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - Type: to.Ptr("CustomLocation"), - }, - Properties: &armdeviceregistry.AssetProperties{ - Description: to.Ptr("This is a sample Asset"), - AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - AssetType: to.Ptr("MyAssetType"), - DataPoints: []*armdeviceregistry.DataPoint{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - }}, - DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - DisplayName: to.Ptr("AssetDisplayName"), - DocumentationURI: to.Ptr("https://www.example.com/manual"), - Enabled: to.Ptr(true), - Events: []*armdeviceregistry.Event{ - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - }, - { - CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - }}, - HardwareRevision: to.Ptr("1.0"), - Manufacturer: to.Ptr("Contoso"), - ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - Model: to.Ptr("ContosoModel"), - ProductCode: to.Ptr("SA34VDG"), - SerialNumber: to.Ptr("64-103816-519918-8"), - SoftwareRevision: to.Ptr("2.0"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("AssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Update_Asset.json -func ExampleAssetsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginUpdate(ctx, "myResourceGroup", "my-asset", armdeviceregistry.AssetUpdate{ - Properties: &armdeviceregistry.AssetUpdateProperties{ - DisplayName: to.Ptr("NewAssetDisplayName"), - Enabled: to.Ptr(false), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Asset = armdeviceregistry.Asset{ - // Name: to.Ptr("my-asset"), - // Type: to.Ptr("Microsoft.DeviceRegistry/assets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.DeviceRegistry/assets/my-asset"), - // SystemData: &armdeviceregistry.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T00:36:43.251Z"); return t}()), - // CreatedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // CreatedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-16T01:37:16.092Z"); return t}()), - // LastModifiedBy: to.Ptr("2ta23112-4596-44ff-b773-19405922bfc1"), - // LastModifiedByType: to.Ptr(armdeviceregistry.CreatedByTypeApplication), - // }, - // Location: to.Ptr("West Europe"), - // Tags: map[string]*string{ - // "site": to.Ptr("building-1"), - // }, - // ExtendedLocation: &armdeviceregistry.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/location1"), - // Type: to.Ptr("CustomLocation"), - // }, - // Properties: &armdeviceregistry.AssetProperties{ - // Description: to.Ptr("This is a sample Asset"), - // AssetEndpointProfileURI: to.Ptr("https://www.example.com/myAssetEndpointProfile"), - // AssetType: to.Ptr("MyAssetType"), - // DataPoints: []*armdeviceregistry.DataPoint{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":8,\"samplingInterval\":8,\"queueSize\":4}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt1"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeCounter), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // DataPointConfiguration: to.Ptr("{\"publishingInterval\":4,\"samplingInterval\":4,\"queueSize\":7}"), - // DataSource: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt2"), - // ObservabilityMode: to.Ptr(armdeviceregistry.DataPointsObservabilityModeNone), - // }}, - // DefaultDataPointsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DefaultEventsConfiguration: to.Ptr("{\"publishingInterval\":10,\"samplingInterval\":15,\"queueSize\":20}"), - // DisplayName: to.Ptr("NewAssetDisplayName"), - // DocumentationURI: to.Ptr("https://www.example.com/manual"), - // Enabled: to.Ptr(true), - // Events: []*armdeviceregistry.Event{ - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__temperature;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":1,\"queueSize\":8}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt3"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeNone), - // }, - // { - // CapabilityID: to.Ptr("dtmi:com:example:Thermostat:__pressure;1"), - // EventConfiguration: to.Ptr("{\"publishingInterval\":7,\"samplingInterval\":8,\"queueSize\":4}"), - // EventNotifier: to.Ptr("nsu=http://microsoft.com/Opc/OpcPlc/;s=FastUInt4"), - // ObservabilityMode: to.Ptr(armdeviceregistry.EventsObservabilityModeLog), - // }}, - // ExternalAssetID: to.Ptr("8ZBA6LRHU0A458969"), - // HardwareRevision: to.Ptr("1.0"), - // Manufacturer: to.Ptr("Contoso"), - // ManufacturerURI: to.Ptr("https://www.contoso.com/manufacturerUri"), - // Model: to.Ptr("ContosoModel"), - // ProductCode: to.Ptr("SA34VDG"), - // ProvisioningState: to.Ptr(armdeviceregistry.ProvisioningStateSucceeded), - // SerialNumber: to.Ptr("64-103816-519918-8"), - // SoftwareRevision: to.Ptr("2.0"), - // UUID: to.Ptr("0796f7c1-f2c8-44d7-9f5b-9a6f9522a85d"), - // Version: to.Ptr[int32](73766), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Delete_Asset.json -func ExampleAssetsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAssetsClient().BeginDelete(ctx, "myResourceGroup", "my-asset", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md deleted file mode 100644 index fdcc3a7d6863..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/autorest.md +++ /dev/null @@ -1,13 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-preview-2023-11 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/billingcontainers_client.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/billingcontainers_client.go new file mode 100644 index 000000000000..ace80b33283c --- /dev/null +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/billingcontainers_client.go @@ -0,0 +1,154 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armdeviceregistry + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "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" +) + +// BillingContainersClient contains the methods for the BillingContainers group. +// Don't use this type directly, use NewBillingContainersClient() instead. +type BillingContainersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewBillingContainersClient creates a new instance of BillingContainersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBillingContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BillingContainersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BillingContainersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a BillingContainer +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version v2024_09_01_preview +// - billingContainerName - Name of the billing container. +// - options - BillingContainersClientGetOptions contains the optional parameters for the BillingContainersClient.Get method. +func (client *BillingContainersClient) Get(ctx context.Context, billingContainerName string, options *BillingContainersClientGetOptions) (BillingContainersClientGetResponse, error) { + var err error + const operationName = "BillingContainersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, billingContainerName, options) + if err != nil { + return BillingContainersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BillingContainersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BillingContainersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BillingContainersClient) getCreateRequest(ctx context.Context, billingContainerName string, _ *BillingContainersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers/{billingContainerName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if billingContainerName == "" { + return nil, errors.New("parameter billingContainerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{billingContainerName}", url.PathEscape(billingContainerName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "v2024_09_01_preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BillingContainersClient) getHandleResponse(resp *http.Response) (BillingContainersClientGetResponse, error) { + result := BillingContainersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BillingContainer); err != nil { + return BillingContainersClientGetResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List BillingContainer resources by subscription ID +// +// Generated from API version v2024_09_01_preview +// - options - BillingContainersClientListBySubscriptionOptions contains the optional parameters for the BillingContainersClient.NewListBySubscriptionPager +// method. +func (client *BillingContainersClient) NewListBySubscriptionPager(options *BillingContainersClientListBySubscriptionOptions) *runtime.Pager[BillingContainersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[BillingContainersClientListBySubscriptionResponse]{ + More: func(page BillingContainersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BillingContainersClientListBySubscriptionResponse) (BillingContainersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BillingContainersClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return BillingContainersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *BillingContainersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *BillingContainersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/billingContainers" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "v2024_09_01_preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *BillingContainersClient) listBySubscriptionHandleResponse(resp *http.Response) (BillingContainersClientListBySubscriptionResponse, error) { + result := BillingContainersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BillingContainerListResult); err != nil { + return BillingContainersClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/build.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/build.go deleted file mode 100644 index 0e14b1cf0f58..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/deviceregistry/armdeviceregistry - -package armdeviceregistry diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/client_factory.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/client_factory.go index 692d561d3977..fa474c48e3d0 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/client_factory.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/client_factory.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -22,7 +18,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -52,6 +48,14 @@ func (c *ClientFactory) NewAssetsClient() *AssetsClient { } } +// NewBillingContainersClient creates a new instance of BillingContainersClient. +func (c *ClientFactory) NewBillingContainersClient() *BillingContainersClient { + return &BillingContainersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewOperationStatusClient creates a new instance of OperationStatusClient. func (c *ClientFactory) NewOperationStatusClient() *OperationStatusClient { return &OperationStatusClient{ diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go index f5a5edb7d532..c87f77627271 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go @@ -1,22 +1,19 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) @@ -27,14 +24,39 @@ func PossibleActionTypeValues() []ActionType { } } -// CreatedByType - The type of identity that created the resource. +// AuthenticationMethod - The method to authenticate the user of the client at the server. +type AuthenticationMethod string + +const ( + // AuthenticationMethodAnonymous - The user authentication method is anonymous. + AuthenticationMethodAnonymous AuthenticationMethod = "Anonymous" + // AuthenticationMethodCertificate - The user authentication method is an x509 certificate. + AuthenticationMethodCertificate AuthenticationMethod = "Certificate" + // AuthenticationMethodUsernamePassword - The user authentication method is a username and password. + AuthenticationMethodUsernamePassword AuthenticationMethod = "UsernamePassword" +) + +// PossibleAuthenticationMethodValues returns the possible values for the AuthenticationMethod const type. +func PossibleAuthenticationMethodValues() []AuthenticationMethod { + return []AuthenticationMethod{ + AuthenticationMethodAnonymous, + AuthenticationMethodCertificate, + AuthenticationMethodUsernamePassword, + } +} + +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -47,48 +69,48 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// DataPointsObservabilityMode - An indication of how the data point should be mapped to OpenTelemetry. -type DataPointsObservabilityMode string +// DataPointObservabilityMode - Defines the data point observability mode. +type DataPointObservabilityMode string const ( - // DataPointsObservabilityModeCounter - Map as counter to OpenTelemetry. - DataPointsObservabilityModeCounter DataPointsObservabilityMode = "counter" - // DataPointsObservabilityModeGauge - Map as gauge to OpenTelemetry. - DataPointsObservabilityModeGauge DataPointsObservabilityMode = "gauge" - // DataPointsObservabilityModeHistogram - Map as histogram to OpenTelemetry. - DataPointsObservabilityModeHistogram DataPointsObservabilityMode = "histogram" - // DataPointsObservabilityModeLog - Map as log to OpenTelemetry. - DataPointsObservabilityModeLog DataPointsObservabilityMode = "log" - // DataPointsObservabilityModeNone - No mapping to OpenTelemetry. - DataPointsObservabilityModeNone DataPointsObservabilityMode = "none" + // DataPointObservabilityModeCounter - Map as counter to OpenTelemetry. + DataPointObservabilityModeCounter DataPointObservabilityMode = "Counter" + // DataPointObservabilityModeGauge - Map as gauge to OpenTelemetry. + DataPointObservabilityModeGauge DataPointObservabilityMode = "Gauge" + // DataPointObservabilityModeHistogram - Map as histogram to OpenTelemetry. + DataPointObservabilityModeHistogram DataPointObservabilityMode = "Histogram" + // DataPointObservabilityModeLog - Map as log to OpenTelemetry. + DataPointObservabilityModeLog DataPointObservabilityMode = "Log" + // DataPointObservabilityModeNone - No mapping to OpenTelemetry. + DataPointObservabilityModeNone DataPointObservabilityMode = "None" ) -// PossibleDataPointsObservabilityModeValues returns the possible values for the DataPointsObservabilityMode const type. -func PossibleDataPointsObservabilityModeValues() []DataPointsObservabilityMode { - return []DataPointsObservabilityMode{ - DataPointsObservabilityModeCounter, - DataPointsObservabilityModeGauge, - DataPointsObservabilityModeHistogram, - DataPointsObservabilityModeLog, - DataPointsObservabilityModeNone, +// PossibleDataPointObservabilityModeValues returns the possible values for the DataPointObservabilityMode const type. +func PossibleDataPointObservabilityModeValues() []DataPointObservabilityMode { + return []DataPointObservabilityMode{ + DataPointObservabilityModeCounter, + DataPointObservabilityModeGauge, + DataPointObservabilityModeHistogram, + DataPointObservabilityModeLog, + DataPointObservabilityModeNone, } } -// EventsObservabilityMode - An indication of how the event should be mapped to OpenTelemetry. -type EventsObservabilityMode string +// EventObservabilityMode - Defines the event observability mode. +type EventObservabilityMode string const ( - // EventsObservabilityModeLog - Map as log to OpenTelemetry. - EventsObservabilityModeLog EventsObservabilityMode = "log" - // EventsObservabilityModeNone - No mapping to OpenTelemetry. - EventsObservabilityModeNone EventsObservabilityMode = "none" + // EventObservabilityModeLog - Map as log to OpenTelemetry. + EventObservabilityModeLog EventObservabilityMode = "Log" + // EventObservabilityModeNone - No mapping to OpenTelemetry. + EventObservabilityModeNone EventObservabilityMode = "None" ) -// PossibleEventsObservabilityModeValues returns the possible values for the EventsObservabilityMode const type. -func PossibleEventsObservabilityModeValues() []EventsObservabilityMode { - return []EventsObservabilityMode{ - EventsObservabilityModeLog, - EventsObservabilityModeNone, +// PossibleEventObservabilityModeValues returns the possible values for the EventObservabilityMode const type. +func PossibleEventObservabilityModeValues() []EventObservabilityMode { + return []EventObservabilityMode{ + EventObservabilityModeLog, + EventObservabilityModeNone, } } @@ -97,8 +119,11 @@ func PossibleEventsObservabilityModeValues() []EventsObservabilityMode { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) @@ -119,6 +144,8 @@ const ( ProvisioningStateAccepted ProvisioningState = "Accepted" // ProvisioningStateCanceled - Resource creation was canceled. ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Resource is deleting. + ProvisioningStateDeleting ProvisioningState = "Deleting" // ProvisioningStateFailed - Resource creation failed. ProvisioningStateFailed ProvisioningState = "Failed" // ProvisioningStateSucceeded - Resource has been created. @@ -130,28 +157,26 @@ func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ ProvisioningStateAccepted, ProvisioningStateCanceled, + ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, } } -// UserAuthenticationMode - Defines the mode to authenticate the user of the client at the server. -type UserAuthenticationMode string +// TopicRetainType - Topic retain types. +type TopicRetainType string const ( - // UserAuthenticationModeAnonymous - The user authentication mode is anonymous. - UserAuthenticationModeAnonymous UserAuthenticationMode = "Anonymous" - // UserAuthenticationModeCertificate - The user authentication mode is an x509 certificate. - UserAuthenticationModeCertificate UserAuthenticationMode = "Certificate" - // UserAuthenticationModeUsernamePassword - The user authentication mode is a username and password. - UserAuthenticationModeUsernamePassword UserAuthenticationMode = "UsernamePassword" + // TopicRetainTypeKeep - Retain the messages. + TopicRetainTypeKeep TopicRetainType = "Keep" + // TopicRetainTypeNever - Never retain messages. + TopicRetainTypeNever TopicRetainType = "Never" ) -// PossibleUserAuthenticationModeValues returns the possible values for the UserAuthenticationMode const type. -func PossibleUserAuthenticationModeValues() []UserAuthenticationMode { - return []UserAuthenticationMode{ - UserAuthenticationModeAnonymous, - UserAuthenticationModeCertificate, - UserAuthenticationModeUsernamePassword, +// PossibleTopicRetainTypeValues returns the possible values for the TopicRetainType const type. +func PossibleTopicRetainTypeValues() []TopicRetainType { + return []TopicRetainType{ + TopicRetainTypeKeep, + TopicRetainTypeNever, } } diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go index 2b7026c69726..00771eb37e2c 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -29,7 +25,7 @@ type AssetEndpointProfilesServer struct { BeginCreateOrReplace func(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, resource armdeviceregistry.AssetEndpointProfile, options *armdeviceregistry.AssetEndpointProfilesClientBeginCreateOrReplaceOptions) (resp azfake.PollerResponder[armdeviceregistry.AssetEndpointProfilesClientCreateOrReplaceResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AssetEndpointProfilesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, assetEndpointProfileName string, options *armdeviceregistry.AssetEndpointProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdeviceregistry.AssetEndpointProfilesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AssetEndpointProfilesClient.Get @@ -82,31 +78,50 @@ func (a *AssetEndpointProfilesServerTransport) Do(req *http.Request) (*http.Resp return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AssetEndpointProfilesClient.BeginCreateOrReplace": - resp, err = a.dispatchBeginCreateOrReplace(req) - case "AssetEndpointProfilesClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AssetEndpointProfilesClient.Get": - resp, err = a.dispatchGet(req) - case "AssetEndpointProfilesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AssetEndpointProfilesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AssetEndpointProfilesClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AssetEndpointProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if assetEndpointProfilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assetEndpointProfilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssetEndpointProfilesClient.BeginCreateOrReplace": + res.resp, res.err = a.dispatchBeginCreateOrReplace(req) + case "AssetEndpointProfilesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AssetEndpointProfilesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssetEndpointProfilesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AssetEndpointProfilesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AssetEndpointProfilesClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AssetEndpointProfilesServerTransport) dispatchBeginCreateOrReplace(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (a *AssetEndpointProfilesServerTransport) dispatchBeginDelete(req *http.Req return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -351,3 +366,9 @@ func (a *AssetEndpointProfilesServerTransport) dispatchBeginUpdate(req *http.Req return resp, nil } + +// set this to conditionally intercept incoming requests to AssetEndpointProfilesServerTransport +var assetEndpointProfilesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go index 6685c47ab7b8..c5b80ba71ae5 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -29,7 +25,7 @@ type AssetsServer struct { BeginCreateOrReplace func(ctx context.Context, resourceGroupName string, assetName string, resource armdeviceregistry.Asset, options *armdeviceregistry.AssetsClientBeginCreateOrReplaceOptions) (resp azfake.PollerResponder[armdeviceregistry.AssetsClientCreateOrReplaceResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AssetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, assetName string, options *armdeviceregistry.AssetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdeviceregistry.AssetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AssetsClient.Get @@ -82,31 +78,50 @@ func (a *AssetsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AssetsClient.BeginCreateOrReplace": - resp, err = a.dispatchBeginCreateOrReplace(req) - case "AssetsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AssetsClient.Get": - resp, err = a.dispatchGet(req) - case "AssetsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AssetsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AssetsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AssetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if assetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssetsClient.BeginCreateOrReplace": + res.resp, res.err = a.dispatchBeginCreateOrReplace(req) + case "AssetsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AssetsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssetsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AssetsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AssetsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AssetsServerTransport) dispatchBeginCreateOrReplace(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (a *AssetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -351,3 +366,9 @@ func (a *AssetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to AssetsServerTransport +var assetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go new file mode 100644 index 000000000000..53e05d5df94f --- /dev/null +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go @@ -0,0 +1,161 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" + "net/http" + "net/url" + "regexp" +) + +// BillingContainersServer is a fake server for instances of the armdeviceregistry.BillingContainersClient type. +type BillingContainersServer struct { + // Get is the fake for method BillingContainersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, billingContainerName string, options *armdeviceregistry.BillingContainersClientGetOptions) (resp azfake.Responder[armdeviceregistry.BillingContainersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListBySubscriptionPager is the fake for method BillingContainersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdeviceregistry.BillingContainersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdeviceregistry.BillingContainersClientListBySubscriptionResponse]) +} + +// NewBillingContainersServerTransport creates a new instance of BillingContainersServerTransport with the provided implementation. +// The returned BillingContainersServerTransport instance is connected to an instance of armdeviceregistry.BillingContainersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewBillingContainersServerTransport(srv *BillingContainersServer) *BillingContainersServerTransport { + return &BillingContainersServerTransport{ + srv: srv, + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdeviceregistry.BillingContainersClientListBySubscriptionResponse]](), + } +} + +// BillingContainersServerTransport connects instances of armdeviceregistry.BillingContainersClient to instances of BillingContainersServer. +// Don't use this type directly, use NewBillingContainersServerTransport instead. +type BillingContainersServerTransport struct { + srv *BillingContainersServer + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdeviceregistry.BillingContainersClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for BillingContainersServerTransport. +func (b *BillingContainersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return b.dispatchToMethodFake(req, method) +} + +func (b *BillingContainersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if billingContainersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = billingContainersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "BillingContainersClient.Get": + res.resp, res.err = b.dispatchGet(req) + case "BillingContainersClient.NewListBySubscriptionPager": + res.resp, res.err = b.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (b *BillingContainersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if b.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/billingContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + billingContainerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("billingContainerName")]) + if err != nil { + return nil, err + } + respr, errRespr := b.srv.Get(req.Context(), billingContainerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).BillingContainer, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (b *BillingContainersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if b.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := b.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/billingContainers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := b.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + b.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armdeviceregistry.BillingContainersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + b.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + b.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to BillingContainersServerTransport +var billingContainersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/internal.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/internal.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/internal.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operations_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operations_server.go index bc3c01104f29..7f2bfdf5c965 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operations_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operations_server.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go index d8124d9db042..4ec20aeea977 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -49,21 +45,40 @@ func (o *OperationStatusServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationStatusClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationStatusServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationStatusServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationStatusServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationStatusClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -98,3 +113,9 @@ func (o *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationStatusServerTransport +var operationStatusServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/server_factory.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/server_factory.go index 3e8781398c4a..e71ad513ab33 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/server_factory.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/server_factory.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,10 +15,20 @@ import ( // ServerFactory is a fake server for instances of the armdeviceregistry.ClientFactory type. type ServerFactory struct { + // AssetEndpointProfilesServer contains the fakes for client AssetEndpointProfilesClient AssetEndpointProfilesServer AssetEndpointProfilesServer - AssetsServer AssetsServer - OperationStatusServer OperationStatusServer - OperationsServer OperationsServer + + // AssetsServer contains the fakes for client AssetsClient + AssetsServer AssetsServer + + // BillingContainersServer contains the fakes for client BillingContainersClient + BillingContainersServer BillingContainersServer + + // OperationStatusServer contains the fakes for client OperationStatusClient + OperationStatusServer OperationStatusServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -41,6 +47,7 @@ type ServerFactoryTransport struct { trMu sync.Mutex trAssetEndpointProfilesServer *AssetEndpointProfilesServerTransport trAssetsServer *AssetsServerTransport + trBillingContainersServer *BillingContainersServerTransport trOperationStatusServer *OperationStatusServerTransport trOperationsServer *OperationsServerTransport } @@ -66,6 +73,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "AssetsClient": initServer(s, &s.trAssetsServer, func() *AssetsServerTransport { return NewAssetsServerTransport(&s.srv.AssetsServer) }) resp, err = s.trAssetsServer.Do(req) + case "BillingContainersClient": + initServer(s, &s.trBillingContainersServer, func() *BillingContainersServerTransport { + return NewBillingContainersServerTransport(&s.srv.BillingContainersServer) + }) + resp, err = s.trBillingContainersServer.Do(req) case "OperationStatusClient": initServer(s, &s.trOperationStatusServer, func() *OperationStatusServerTransport { return NewOperationStatusServerTransport(&s.srv.OperationStatusServer) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod index e37c15d7a8a1..8a06b7c2b6e1 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armd go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/net v0.32.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/text v0.18.0 // indirect ) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum index 5a15625c8c87..752493a0c478 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/go.sum @@ -1,35 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 h1:B/dfvscEQtew9dVuoxqxrUKKv8Ih2f55PydknDamU+g= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0/go.mod h1:fiPSssYvltE08HJchL04dOy+RD4hgrjph0cwGGMntdI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.0 h1:+m0M/LFxN43KvULkDNfdXOgrjtg6UYJPFBJyuEcRCAw= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2 h1:kYRSnvJju5gYVyhkij+RTJ/VR6QIUaCfWeaFm2ycsjQ= -github.com/AzureAD/microsoft-authentication-library-for-go v1.3.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -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/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= \ No newline at end of file diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go index dec2bc3186c7..c4195b7403a2 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -24,12 +20,12 @@ type Asset struct { // Resource tags. Tags map[string]*string + // READ-ONLY; Asset name parameter. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -51,12 +47,12 @@ type AssetEndpointProfile struct { // Resource tags. Tags map[string]*string + // READ-ONLY; Asset Endpoint Profile name parameter. + Name *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -75,30 +71,53 @@ type AssetEndpointProfileListResult struct { // AssetEndpointProfileProperties - Defines the Asset Endpoint Profile properties. type AssetEndpointProfileProperties struct { + // REQUIRED; Defines the configuration for the connector type that is being used with the endpoint profile. + EndpointProfileType *string + // REQUIRED; The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress - // URI specifies the type of the device. The additionalConfiguration field holds - // further connector type specific configuration. + // URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. TargetAddress *string - // Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + // Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). AdditionalConfiguration *string - // Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - TransportAuthentication *TransportAuthentication - // Defines the client authentication mechanism to the server. - UserAuthentication *UserAuthentication + Authentication *Authentication + + // Reference to a discovered asset endpoint profile. Populated only if the asset endpoint profile has been created from discovery + // flow. Discovered asset endpoint profile name must be provided. + DiscoveredAssetEndpointProfileRef *string // READ-ONLY; Provisioning state of the resource. ProvisioningState *ProvisioningState + // READ-ONLY; Read only object to reflect changes that have occurred on the Edge. Similar to Kubernetes status property for + // custom resources. + Status *AssetEndpointProfileStatus + // READ-ONLY; Globally unique, immutable, non-reusable id. UUID *string } +// AssetEndpointProfileStatus - Defines the asset endpoint profile status properties. +type AssetEndpointProfileStatus struct { + // READ-ONLY; Array object to transfer and persist errors that originate from the Edge. + Errors []*AssetEndpointProfileStatusError +} + +// AssetEndpointProfileStatusError - Defines the asset endpoint profile status error properties. +type AssetEndpointProfileStatusError struct { + // READ-ONLY; Error code for classification of errors (ex: 400, 404, 500, etc.). + Code *int32 + + // READ-ONLY; Human readable helpful error message to provide additional context for error (ex: “targetAddress 'foo' is not + // a valid url”). + Message *string +} + // AssetEndpointProfileUpdate - The type used for update operations of the AssetEndpointProfile. type AssetEndpointProfileUpdate struct { - // The updatable properties of the AssetEndpointProfile. + // The resource-specific properties for this resource. Properties *AssetEndpointProfileUpdateProperties // Resource tags. @@ -107,19 +126,18 @@ type AssetEndpointProfileUpdate struct { // AssetEndpointProfileUpdateProperties - The updatable properties of the AssetEndpointProfile. type AssetEndpointProfileUpdateProperties struct { - // Contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). + // Stringified JSON that contains connectivity type specific further configuration (e.g. OPC UA, Modbus, ONVIF). AdditionalConfiguration *string - // The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress - // URI specifies the type of the device. The additionalConfiguration field holds - // further connector type specific configuration. - TargetAddress *string + // Defines the client authentication mechanism to the server. + Authentication *Authentication - // Defines the authentication mechanism for the southbound connector connecting to the shop floor/OT device. - TransportAuthentication *TransportAuthenticationUpdate + // Defines the configuration for the connector type that is being used with the endpoint profile. + EndpointProfileType *string - // Defines the client authentication mechanism to the server. - UserAuthentication *UserAuthenticationUpdate + // The local valid URI specifying the network address/DNS name of a southbound device. The scheme part of the targetAddress + // URI specifies the type of the device. The additionalConfiguration field holds further connector type specific configuration. + TargetAddress *string } // AssetListResult - The response of a Asset list operation. @@ -134,32 +152,33 @@ type AssetListResult struct { // AssetProperties - Defines the asset properties. type AssetProperties struct { // REQUIRED; A reference to the asset endpoint profile (connection information) used by brokers to connect to an endpoint - // that provides data points for this asset. Must have the format /. - AssetEndpointProfileURI *string - - // Resource path to asset type (model) definition. - AssetType *string + // that provides data points for this asset. Must provide asset endpoint profile name. + AssetEndpointProfileRef *string // A set of key-value pairs that contain custom attributes set by the customer. Attributes map[string]any - // Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data - // point configuration. See below for more details for the definition of the - // dataPoints element. - DataPoints []*DataPoint + // Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + Datasets []*Dataset - // Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides - // the default settings here. This assumes that each asset instance has one - // protocol. - DefaultDataPointsConfiguration *string + // Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own + // configuration that overrides the default settings here. + DefaultDatasetsConfiguration *string - // Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default - // settings here. This assumes that each asset instance has one protocol. + // Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration + // that overrides the default settings here. DefaultEventsConfiguration *string + // Object that describes the default topic information for the asset. + DefaultTopic *Topic + // Human-readable description of the asset. Description *string + // Reference to a list of discovered assets. Populated only if the asset has been created from discovery flow. Discovered + // asset names must be provided. + DiscoveredAssetRefs []*string + // Human-readable display name. DisplayName *string @@ -169,8 +188,7 @@ type AssetProperties struct { // Enabled/Disabled status of the asset. Enabled *bool - // Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. - // See below for more details about the definition of the events element. + // Array of events that are part of the asset. Each event can have per-event configuration. Events []*Event // Asset id provided by the customer. @@ -208,32 +226,59 @@ type AssetProperties struct { UUID *string // READ-ONLY; An integer that is incremented each time the resource is modified. - Version *int32 + Version *int64 } // AssetStatus - Defines the asset status properties. type AssetStatus struct { - // Array object to transfer and persist errors that originate from the Edge. + // READ-ONLY; Array of dataset statuses that describe the status of each dataset. + Datasets []*AssetStatusDataset + + // READ-ONLY; Array object to transfer and persist errors that originate from the Edge. Errors []*AssetStatusError - // A read only incremental counter indicating the number of times the configuration has been modified from the perspective - // of the current actual (Edge) state of the Asset. Edge would be the only writer - // of this value and would sync back up to the cloud. In steady state, this should equal version. - Version *int32 + // READ-ONLY; Array of event statuses that describe the status of each event. + Events []*AssetStatusEvent + + // READ-ONLY; A read only incremental counter indicating the number of times the configuration has been modified from the + // perspective of the current actual (Edge) state of the Asset. Edge would be the only writer of this value and would sync + // back up to the cloud. In steady state, this should equal version. + Version *int64 +} + +// AssetStatusDataset - Defines the asset status dataset properties. +type AssetStatusDataset struct { + // READ-ONLY; The name of the dataset. Must be unique within the status.datasets array. This name is used to correlate between + // the spec and status dataset information. + Name *string + + // READ-ONLY; The message schema reference object. + MessageSchemaReference *MessageSchemaReference } // AssetStatusError - Defines the asset status error properties. type AssetStatusError struct { - // Error code for classification of errors (ex: 400, 404, 500, etc.). + // READ-ONLY; Error code for classification of errors (ex: 400, 404, 500, etc.). Code *int32 - // Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does not exist”). + // READ-ONLY; Human readable helpful error message to provide additional context for error (ex: “capability Id 'foo' does + // not exist”). Message *string } +// AssetStatusEvent - Defines the asset status event properties. +type AssetStatusEvent struct { + // READ-ONLY; The name of the event. Must be unique within the status.events array. This name is used to correlate between + // the spec and status event information. + Name *string + + // READ-ONLY; The message schema reference object. + MessageSchemaReference *MessageSchemaReference +} + // AssetUpdate - The type used for update operations of the Asset. type AssetUpdate struct { - // The updatable properties of the Asset. + // The resource-specific properties for this resource. Properties *AssetUpdateProperties // Resource tags. @@ -242,26 +287,23 @@ type AssetUpdate struct { // AssetUpdateProperties - The updatable properties of the Asset. type AssetUpdateProperties struct { - // Resource path to asset type (model) definition. - AssetType *string - // A set of key-value pairs that contain custom attributes set by the customer. Attributes map[string]any - // Array of data points that are part of the asset. Each data point can reference an asset type capability and have per-data - // point configuration. See below for more details for the definition of the - // dataPoints element. - DataPoints []*DataPoint + // Array of datasets that are part of the asset. Each dataset describes the data points that make up the set. + Datasets []*Dataset - // Protocol-specific default configuration for all data points. Each data point can have its own configuration that overrides - // the default settings here. This assumes that each asset instance has one - // protocol. - DefaultDataPointsConfiguration *string + // Stringified JSON that contains connector-specific default configuration for all datasets. Each dataset can have its own + // configuration that overrides the default settings here. + DefaultDatasetsConfiguration *string - // Protocol-specific default configuration for all events. Each event can have its own configuration that overrides the default - // settings here. This assumes that each asset instance has one protocol. + // Stringified JSON that contains connector-specific default configuration for all events. Each event can have its own configuration + // that overrides the default settings here. DefaultEventsConfiguration *string + // Object that describes the default topic information for the asset. + DefaultTopic *Topic + // Human-readable description of the asset. Description *string @@ -274,8 +316,7 @@ type AssetUpdateProperties struct { // Enabled/Disabled status of the asset. Enabled *bool - // Array of events that are part of the asset. Each event can reference an asset type capability and have per-event configuration. - // See below for more details about the definition of the events element. + // Array of events that are part of the asset. Each event can have per-event configuration. Events []*Event // Revision number of the hardware. @@ -300,35 +341,99 @@ type AssetUpdateProperties struct { SoftwareRevision *string } +// Authentication - Definition of the client authentication mechanism to the server. +type Authentication struct { + // REQUIRED; Defines the method to authenticate the user of the client at the server. + Method *AuthenticationMethod + + // Defines the username and password references when UsernamePassword user authentication mode is selected. + UsernamePasswordCredentials *UsernamePasswordCredentials + + // Defines the certificate reference when Certificate user authentication mode is selected. + X509Credentials *X509Credentials +} + +// BillingContainer - billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources +// under a subscription. +type BillingContainer struct { + // The resource-specific properties for this resource. + Properties *BillingContainerProperties + + // READ-ONLY; Name of the billing container. + Name *string + + // READ-ONLY; Resource ETag + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BillingContainerListResult - The response of a BillingContainer list operation. +type BillingContainerListResult struct { + // REQUIRED; The BillingContainer items on this page + Value []*BillingContainer + + // The link to the next page of items + NextLink *string +} + +// BillingContainerProperties - Defines the billingContainer properties. +type BillingContainerProperties struct { + // READ-ONLY; Provisioning state of the resource. + ProvisioningState *ProvisioningState +} + // DataPoint - Defines the data point properties. type DataPoint struct { // REQUIRED; The address of the source of the data in the asset (e.g. URL) so that a client can access the data source on // the asset. DataSource *string - // The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:contents:_prop1;1. - CapabilityID *string + // REQUIRED; The name of the data point. + Name *string - // Protocol-specific configuration for the data point. For OPC UA, this could include configuration like, publishingInterval, - // samplingInterval, and queueSize. + // Stringified JSON that contains connector-specific configuration for the data point. For OPC UA, this could include configuration + // like, publishingInterval, samplingInterval, and queueSize. DataPointConfiguration *string - // The name of the data point. + // An indication of how the data point should be mapped to OpenTelemetry. + ObservabilityMode *DataPointObservabilityMode +} + +// Dataset - Defines the dataset properties. +type Dataset struct { + // REQUIRED; Name of the dataset. Name *string - // An indication of how the data point should be mapped to OpenTelemetry. - ObservabilityMode *DataPointsObservabilityMode + // Array of data points that are part of the dataset. Each data point can have per-data point configuration. + DataPoints []*DataPoint + + // Stringified JSON that contains connector-specific JSON string that describes configuration for the specific dataset. + DatasetConfiguration *string + + // Object that describes the topic information for the specific dataset. + Topic *Topic } // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -353,18 +458,18 @@ type Event struct { // asset. EventNotifier *string - // The path to the type definition of the capability (e.g. DTMI, OPC UA information model node id, etc.), for example dtmi:com:example:Robot:contents:_prop1;1. - CapabilityID *string + // REQUIRED; The name of the event. + Name *string - // Protocol-specific configuration for the event. For OPC UA, this could include configuration like, publishingInterval, samplingInterval, - // and queueSize. + // Stringified JSON that contains connector-specific configuration for the event. For OPC UA, this could include configuration + // like, publishingInterval, samplingInterval, and queueSize. EventConfiguration *string - // The name of the event. - Name *string - // An indication of how the event should be mapped to OpenTelemetry. - ObservabilityMode *EventsObservabilityMode + ObservabilityMode *EventObservabilityMode + + // Object that describes the topic information for the specific event. + Topic *Topic } // ExtendedLocation - The extended location. @@ -376,16 +481,28 @@ type ExtendedLocation struct { Type *string } +// MessageSchemaReference - Defines the message schema reference properties. +type MessageSchemaReference struct { + // READ-ONLY; The message schema name. + SchemaName *string + + // READ-ONLY; The message schema registry namespace. + SchemaRegistryNamespace *string + + // READ-ONLY; The message schema version. + SchemaVersion *string +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // READ-ONLY; Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", @@ -397,7 +514,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -418,11 +535,11 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // OperationStatusResult - The current status of an async operation. @@ -446,25 +563,12 @@ type OperationStatusResult struct { Operations []*OperationStatusResult // Percent of the operation that is complete. - PercentComplete *float32 + PercentComplete *float64 // The start time of the operation. StartTime *time.Time } -// OwnCertificate - Certificate or private key that can be used by the southbound connector connecting to the shop floor/OT -// device. The accepted extensions are .der for certificates and .pfx/.pem for private keys. -type OwnCertificate struct { - // Secret Reference Name (Pfx or Pem password). - CertPasswordReference *string - - // Secret Reference name (cert and private key). - CertSecretReference *string - - // Certificate thumbprint. - CertThumbprint *string -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -486,72 +590,26 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TransportAuthentication - Definition of the authentication mechanism for the southbound connector. -type TransportAuthentication struct { - // REQUIRED; Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound - // connector connecting to the shop floor/OT device. The accepted extensions are .der - // for certificates and .pfx/.pem for private keys. - OwnCertificates []*OwnCertificate -} - -// TransportAuthenticationUpdate - Definition of the authentication mechanism for the southbound connector. -type TransportAuthenticationUpdate struct { - // Defines a reference to a secret which contains all certificates and private keys that can be used by the southbound connector - // connecting to the shop floor/OT device. The accepted extensions are .der - // for certificates and .pfx/.pem for private keys. - OwnCertificates []*OwnCertificate -} - -// UserAuthentication - Definition of the client authentication mechanism to the server. -type UserAuthentication struct { - // REQUIRED; Defines the mode to authenticate the user of the client at the server. - Mode *UserAuthenticationMode +// Topic - Object that describes the topic information. +type Topic struct { + // REQUIRED; The topic path for messages published to an MQTT broker. + Path *string - // Defines the username and password references when UsernamePassword user authentication mode is selected. - UsernamePasswordCredentials *UsernamePasswordCredentials - - // Defines the certificate reference when Certificate user authentication mode is selected. - X509Credentials *X509Credentials -} - -// UserAuthenticationUpdate - Definition of the client authentication mechanism to the server. -type UserAuthenticationUpdate struct { - // Defines the mode to authenticate the user of the client at the server. - Mode *UserAuthenticationMode - - // Defines the username and password references when UsernamePassword user authentication mode is selected. - UsernamePasswordCredentials *UsernamePasswordCredentialsUpdate - - // Defines the certificate reference when Certificate user authentication mode is selected. - X509Credentials *X509CredentialsUpdate + // When set to 'Keep', messages published to an MQTT broker will have the retain flag set. Default: 'Never'. + Retain *TopicRetainType } // UsernamePasswordCredentials - The credentials for authentication mode UsernamePassword. type UsernamePasswordCredentials struct { - // REQUIRED; A reference to secret containing the password. - PasswordReference *string - - // REQUIRED; A reference to secret containing the username. - UsernameReference *string -} - -// UsernamePasswordCredentialsUpdate - The credentials for authentication mode UsernamePassword. -type UsernamePasswordCredentialsUpdate struct { - // A reference to secret containing the password. - PasswordReference *string + // REQUIRED; The name of the secret containing the password. + PasswordSecretName *string - // A reference to secret containing the username. - UsernameReference *string + // REQUIRED; The name of the secret containing the username. + UsernameSecretName *string } // X509Credentials - The x509 certificate for authentication mode Certificate. type X509Credentials struct { - // REQUIRED; A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - CertificateReference *string -} - -// X509CredentialsUpdate - The x509 certificate for authentication mode Certificate. -type X509CredentialsUpdate struct { - // A reference to secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). - CertificateReference *string + // REQUIRED; The name of the secret containing the certificate and private key (e.g. stored as .der/.pem or .der/.pfx). + CertificateSecretName *string } diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models_serde.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models_serde.go index fe8efcacb494..95dc68c970e8 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models_serde.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models_serde.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -160,11 +156,13 @@ func (a *AssetEndpointProfileListResult) UnmarshalJSON(data []byte) error { func (a AssetEndpointProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalConfiguration", a.AdditionalConfiguration) + populate(objectMap, "authentication", a.Authentication) + populate(objectMap, "discoveredAssetEndpointProfileRef", a.DiscoveredAssetEndpointProfileRef) + populate(objectMap, "endpointProfileType", a.EndpointProfileType) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "status", a.Status) populate(objectMap, "targetAddress", a.TargetAddress) - populate(objectMap, "transportAuthentication", a.TransportAuthentication) populate(objectMap, "uuid", a.UUID) - populate(objectMap, "userAuthentication", a.UserAuthentication) return json.Marshal(objectMap) } @@ -180,20 +178,84 @@ func (a *AssetEndpointProfileProperties) UnmarshalJSON(data []byte) error { case "additionalConfiguration": err = unpopulate(val, "AdditionalConfiguration", &a.AdditionalConfiguration) delete(rawMsg, key) + case "authentication": + err = unpopulate(val, "Authentication", &a.Authentication) + delete(rawMsg, key) + case "discoveredAssetEndpointProfileRef": + err = unpopulate(val, "DiscoveredAssetEndpointProfileRef", &a.DiscoveredAssetEndpointProfileRef) + delete(rawMsg, key) + case "endpointProfileType": + err = unpopulate(val, "EndpointProfileType", &a.EndpointProfileType) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) case "targetAddress": err = unpopulate(val, "TargetAddress", &a.TargetAddress) delete(rawMsg, key) - case "transportAuthentication": - err = unpopulate(val, "TransportAuthentication", &a.TransportAuthentication) - delete(rawMsg, key) case "uuid": err = unpopulate(val, "UUID", &a.UUID) delete(rawMsg, key) - case "userAuthentication": - err = unpopulate(val, "UserAuthentication", &a.UserAuthentication) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssetEndpointProfileStatus. +func (a AssetEndpointProfileStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", a.Errors) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetEndpointProfileStatus. +func (a *AssetEndpointProfileStatus) 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 "errors": + err = unpopulate(val, "Errors", &a.Errors) + 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 AssetEndpointProfileStatusError. +func (a AssetEndpointProfileStatusError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", a.Code) + populate(objectMap, "message", a.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetEndpointProfileStatusError. +func (a *AssetEndpointProfileStatusError) 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 "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) delete(rawMsg, key) } if err != nil { @@ -238,9 +300,9 @@ func (a *AssetEndpointProfileUpdate) UnmarshalJSON(data []byte) error { func (a AssetEndpointProfileUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalConfiguration", a.AdditionalConfiguration) + populate(objectMap, "authentication", a.Authentication) + populate(objectMap, "endpointProfileType", a.EndpointProfileType) populate(objectMap, "targetAddress", a.TargetAddress) - populate(objectMap, "transportAuthentication", a.TransportAuthentication) - populate(objectMap, "userAuthentication", a.UserAuthentication) return json.Marshal(objectMap) } @@ -256,14 +318,14 @@ func (a *AssetEndpointProfileUpdateProperties) UnmarshalJSON(data []byte) error case "additionalConfiguration": err = unpopulate(val, "AdditionalConfiguration", &a.AdditionalConfiguration) delete(rawMsg, key) - case "targetAddress": - err = unpopulate(val, "TargetAddress", &a.TargetAddress) + case "authentication": + err = unpopulate(val, "Authentication", &a.Authentication) delete(rawMsg, key) - case "transportAuthentication": - err = unpopulate(val, "TransportAuthentication", &a.TransportAuthentication) + case "endpointProfileType": + err = unpopulate(val, "EndpointProfileType", &a.EndpointProfileType) delete(rawMsg, key) - case "userAuthentication": - err = unpopulate(val, "UserAuthentication", &a.UserAuthentication) + case "targetAddress": + err = unpopulate(val, "TargetAddress", &a.TargetAddress) delete(rawMsg, key) } if err != nil { @@ -307,13 +369,14 @@ func (a *AssetListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AssetProperties. func (a AssetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assetEndpointProfileUri", a.AssetEndpointProfileURI) - populate(objectMap, "assetType", a.AssetType) + populate(objectMap, "assetEndpointProfileRef", a.AssetEndpointProfileRef) populate(objectMap, "attributes", a.Attributes) - populate(objectMap, "dataPoints", a.DataPoints) - populate(objectMap, "defaultDataPointsConfiguration", a.DefaultDataPointsConfiguration) + populate(objectMap, "datasets", a.Datasets) + populate(objectMap, "defaultDatasetsConfiguration", a.DefaultDatasetsConfiguration) populate(objectMap, "defaultEventsConfiguration", a.DefaultEventsConfiguration) + populate(objectMap, "defaultTopic", a.DefaultTopic) populate(objectMap, "description", a.Description) + populate(objectMap, "discoveredAssetRefs", a.DiscoveredAssetRefs) populate(objectMap, "displayName", a.DisplayName) populate(objectMap, "documentationUri", a.DocumentationURI) populate(objectMap, "enabled", a.Enabled) @@ -342,27 +405,30 @@ func (a *AssetProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assetEndpointProfileUri": - err = unpopulate(val, "AssetEndpointProfileURI", &a.AssetEndpointProfileURI) - delete(rawMsg, key) - case "assetType": - err = unpopulate(val, "AssetType", &a.AssetType) + case "assetEndpointProfileRef": + err = unpopulate(val, "AssetEndpointProfileRef", &a.AssetEndpointProfileRef) delete(rawMsg, key) case "attributes": err = unpopulate(val, "Attributes", &a.Attributes) delete(rawMsg, key) - case "dataPoints": - err = unpopulate(val, "DataPoints", &a.DataPoints) + case "datasets": + err = unpopulate(val, "Datasets", &a.Datasets) delete(rawMsg, key) - case "defaultDataPointsConfiguration": - err = unpopulate(val, "DefaultDataPointsConfiguration", &a.DefaultDataPointsConfiguration) + case "defaultDatasetsConfiguration": + err = unpopulate(val, "DefaultDatasetsConfiguration", &a.DefaultDatasetsConfiguration) delete(rawMsg, key) case "defaultEventsConfiguration": err = unpopulate(val, "DefaultEventsConfiguration", &a.DefaultEventsConfiguration) delete(rawMsg, key) + case "defaultTopic": + err = unpopulate(val, "DefaultTopic", &a.DefaultTopic) + delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) + case "discoveredAssetRefs": + err = unpopulate(val, "DiscoveredAssetRefs", &a.DiscoveredAssetRefs) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) @@ -422,7 +488,9 @@ func (a *AssetProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AssetStatus. func (a AssetStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "datasets", a.Datasets) populate(objectMap, "errors", a.Errors) + populate(objectMap, "events", a.Events) populate(objectMap, "version", a.Version) return json.Marshal(objectMap) } @@ -436,9 +504,15 @@ func (a *AssetStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "datasets": + err = unpopulate(val, "Datasets", &a.Datasets) + delete(rawMsg, key) case "errors": err = unpopulate(val, "Errors", &a.Errors) delete(rawMsg, key) + case "events": + err = unpopulate(val, "Events", &a.Events) + delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &a.Version) delete(rawMsg, key) @@ -450,6 +524,37 @@ func (a *AssetStatus) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AssetStatusDataset. +func (a AssetStatusDataset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "messageSchemaReference", a.MessageSchemaReference) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetStatusDataset. +func (a *AssetStatusDataset) 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 "messageSchemaReference": + err = unpopulate(val, "MessageSchemaReference", &a.MessageSchemaReference) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 AssetStatusError. func (a AssetStatusError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -481,6 +586,37 @@ func (a *AssetStatusError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AssetStatusEvent. +func (a AssetStatusEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "messageSchemaReference", a.MessageSchemaReference) + populate(objectMap, "name", a.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssetStatusEvent. +func (a *AssetStatusEvent) 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 "messageSchemaReference": + err = unpopulate(val, "MessageSchemaReference", &a.MessageSchemaReference) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + 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 AssetUpdate. func (a AssetUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -515,11 +651,11 @@ func (a *AssetUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AssetUpdateProperties. func (a AssetUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "assetType", a.AssetType) populate(objectMap, "attributes", a.Attributes) - populate(objectMap, "dataPoints", a.DataPoints) - populate(objectMap, "defaultDataPointsConfiguration", a.DefaultDataPointsConfiguration) + populate(objectMap, "datasets", a.Datasets) + populate(objectMap, "defaultDatasetsConfiguration", a.DefaultDatasetsConfiguration) populate(objectMap, "defaultEventsConfiguration", a.DefaultEventsConfiguration) + populate(objectMap, "defaultTopic", a.DefaultTopic) populate(objectMap, "description", a.Description) populate(objectMap, "displayName", a.DisplayName) populate(objectMap, "documentationUri", a.DocumentationURI) @@ -544,21 +680,21 @@ func (a *AssetUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assetType": - err = unpopulate(val, "AssetType", &a.AssetType) - delete(rawMsg, key) case "attributes": err = unpopulate(val, "Attributes", &a.Attributes) delete(rawMsg, key) - case "dataPoints": - err = unpopulate(val, "DataPoints", &a.DataPoints) + case "datasets": + err = unpopulate(val, "Datasets", &a.Datasets) delete(rawMsg, key) - case "defaultDataPointsConfiguration": - err = unpopulate(val, "DefaultDataPointsConfiguration", &a.DefaultDataPointsConfiguration) + case "defaultDatasetsConfiguration": + err = unpopulate(val, "DefaultDatasetsConfiguration", &a.DefaultDatasetsConfiguration) delete(rawMsg, key) case "defaultEventsConfiguration": err = unpopulate(val, "DefaultEventsConfiguration", &a.DefaultEventsConfiguration) delete(rawMsg, key) + case "defaultTopic": + err = unpopulate(val, "DefaultTopic", &a.DefaultTopic) + delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) @@ -603,10 +739,149 @@ func (a *AssetUpdateProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Authentication. +func (a Authentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "method", a.Method) + populate(objectMap, "usernamePasswordCredentials", a.UsernamePasswordCredentials) + populate(objectMap, "x509Credentials", a.X509Credentials) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Authentication. +func (a *Authentication) 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 "method": + err = unpopulate(val, "Method", &a.Method) + delete(rawMsg, key) + case "usernamePasswordCredentials": + err = unpopulate(val, "UsernamePasswordCredentials", &a.UsernamePasswordCredentials) + delete(rawMsg, key) + case "x509Credentials": + err = unpopulate(val, "X509Credentials", &a.X509Credentials) + 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 BillingContainer. +func (b BillingContainer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", b.Etag) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingContainer. +func (b *BillingContainer) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &b.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingContainerListResult. +func (b BillingContainerListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingContainerListResult. +func (b *BillingContainerListResult) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BillingContainerProperties. +func (b BillingContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", b.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BillingContainerProperties. +func (b *BillingContainerProperties) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DataPoint. func (d DataPoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capabilityId", d.CapabilityID) populate(objectMap, "dataPointConfiguration", d.DataPointConfiguration) populate(objectMap, "dataSource", d.DataSource) populate(objectMap, "name", d.Name) @@ -623,9 +898,6 @@ func (d *DataPoint) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "capabilityId": - err = unpopulate(val, "CapabilityID", &d.CapabilityID) - delete(rawMsg, key) case "dataPointConfiguration": err = unpopulate(val, "DataPointConfiguration", &d.DataPointConfiguration) delete(rawMsg, key) @@ -646,10 +918,49 @@ func (d *DataPoint) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Dataset. +func (d Dataset) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataPoints", d.DataPoints) + populate(objectMap, "datasetConfiguration", d.DatasetConfiguration) + populate(objectMap, "name", d.Name) + populate(objectMap, "topic", d.Topic) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Dataset. +func (d *Dataset) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataPoints": + err = unpopulate(val, "DataPoints", &d.DataPoints) + delete(rawMsg, key) + case "datasetConfiguration": + err = unpopulate(val, "DatasetConfiguration", &d.DatasetConfiguration) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "topic": + err = unpopulate(val, "Topic", &d.Topic) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -723,11 +1034,11 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Event. func (e Event) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capabilityId", e.CapabilityID) populate(objectMap, "eventConfiguration", e.EventConfiguration) populate(objectMap, "eventNotifier", e.EventNotifier) populate(objectMap, "name", e.Name) populate(objectMap, "observabilityMode", e.ObservabilityMode) + populate(objectMap, "topic", e.Topic) return json.Marshal(objectMap) } @@ -740,9 +1051,6 @@ func (e *Event) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "capabilityId": - err = unpopulate(val, "CapabilityID", &e.CapabilityID) - delete(rawMsg, key) case "eventConfiguration": err = unpopulate(val, "EventConfiguration", &e.EventConfiguration) delete(rawMsg, key) @@ -755,6 +1063,9 @@ func (e *Event) UnmarshalJSON(data []byte) error { case "observabilityMode": err = unpopulate(val, "ObservabilityMode", &e.ObservabilityMode) delete(rawMsg, key) + case "topic": + err = unpopulate(val, "Topic", &e.Topic) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -794,6 +1105,41 @@ func (e *ExtendedLocation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MessageSchemaReference. +func (m MessageSchemaReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "schemaName", m.SchemaName) + populate(objectMap, "schemaRegistryNamespace", m.SchemaRegistryNamespace) + populate(objectMap, "schemaVersion", m.SchemaVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MessageSchemaReference. +func (m *MessageSchemaReference) 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 "schemaName": + err = unpopulate(val, "SchemaName", &m.SchemaName) + delete(rawMsg, key) + case "schemaRegistryNamespace": + err = unpopulate(val, "SchemaRegistryNamespace", &m.SchemaRegistryNamespace) + delete(rawMsg, key) + case "schemaVersion": + err = unpopulate(val, "SchemaVersion", &m.SchemaVersion) + 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]any) @@ -962,41 +1308,6 @@ func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OwnCertificate. -func (o OwnCertificate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "certPasswordReference", o.CertPasswordReference) - populate(objectMap, "certSecretReference", o.CertSecretReference) - populate(objectMap, "certThumbprint", o.CertThumbprint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OwnCertificate. -func (o *OwnCertificate) 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 "certPasswordReference": - err = unpopulate(val, "CertPasswordReference", &o.CertPasswordReference) - delete(rawMsg, key) - case "certSecretReference": - err = unpopulate(val, "CertSecretReference", &o.CertSecretReference) - delete(rawMsg, key) - case "certThumbprint": - err = unpopulate(val, "CertThumbprint", &o.CertThumbprint) - 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 SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1044,15 +1355,16 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TransportAuthentication. -func (t TransportAuthentication) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Topic. +func (t Topic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ownCertificates", t.OwnCertificates) + populate(objectMap, "path", t.Path) + populate(objectMap, "retain", t.Retain) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TransportAuthentication. -func (t *TransportAuthentication) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Topic. +func (t *Topic) 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", t, err) @@ -1060,35 +1372,11 @@ func (t *TransportAuthentication) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ownCertificates": - err = unpopulate(val, "OwnCertificates", &t.OwnCertificates) + case "path": + err = unpopulate(val, "Path", &t.Path) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TransportAuthenticationUpdate. -func (t TransportAuthenticationUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ownCertificates", t.OwnCertificates) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TransportAuthenticationUpdate. -func (t *TransportAuthenticationUpdate) 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", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ownCertificates": - err = unpopulate(val, "OwnCertificates", &t.OwnCertificates) + case "retain": + err = unpopulate(val, "Retain", &t.Retain) delete(rawMsg, key) } if err != nil { @@ -1098,81 +1386,11 @@ func (t *TransportAuthenticationUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAuthentication. -func (u UserAuthentication) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "mode", u.Mode) - populate(objectMap, "usernamePasswordCredentials", u.UsernamePasswordCredentials) - populate(objectMap, "x509Credentials", u.X509Credentials) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAuthentication. -func (u *UserAuthentication) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "mode": - err = unpopulate(val, "Mode", &u.Mode) - delete(rawMsg, key) - case "usernamePasswordCredentials": - err = unpopulate(val, "UsernamePasswordCredentials", &u.UsernamePasswordCredentials) - delete(rawMsg, key) - case "x509Credentials": - err = unpopulate(val, "X509Credentials", &u.X509Credentials) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UserAuthenticationUpdate. -func (u UserAuthenticationUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "mode", u.Mode) - populate(objectMap, "usernamePasswordCredentials", u.UsernamePasswordCredentials) - populate(objectMap, "x509Credentials", u.X509Credentials) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAuthenticationUpdate. -func (u *UserAuthenticationUpdate) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "mode": - err = unpopulate(val, "Mode", &u.Mode) - delete(rawMsg, key) - case "usernamePasswordCredentials": - err = unpopulate(val, "UsernamePasswordCredentials", &u.UsernamePasswordCredentials) - delete(rawMsg, key) - case "x509Credentials": - err = unpopulate(val, "X509Credentials", &u.X509Credentials) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UsernamePasswordCredentials. func (u UsernamePasswordCredentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "passwordReference", u.PasswordReference) - populate(objectMap, "usernameReference", u.UsernameReference) + populate(objectMap, "passwordSecretName", u.PasswordSecretName) + populate(objectMap, "usernameSecretName", u.UsernameSecretName) return json.Marshal(objectMap) } @@ -1185,42 +1403,11 @@ func (u *UsernamePasswordCredentials) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "passwordReference": - err = unpopulate(val, "PasswordReference", &u.PasswordReference) + case "passwordSecretName": + err = unpopulate(val, "PasswordSecretName", &u.PasswordSecretName) delete(rawMsg, key) - case "usernameReference": - err = unpopulate(val, "UsernameReference", &u.UsernameReference) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UsernamePasswordCredentialsUpdate. -func (u UsernamePasswordCredentialsUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "passwordReference", u.PasswordReference) - populate(objectMap, "usernameReference", u.UsernameReference) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UsernamePasswordCredentialsUpdate. -func (u *UsernamePasswordCredentialsUpdate) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "passwordReference": - err = unpopulate(val, "PasswordReference", &u.PasswordReference) - delete(rawMsg, key) - case "usernameReference": - err = unpopulate(val, "UsernameReference", &u.UsernameReference) + case "usernameSecretName": + err = unpopulate(val, "UsernameSecretName", &u.UsernameSecretName) delete(rawMsg, key) } if err != nil { @@ -1233,7 +1420,7 @@ func (u *UsernamePasswordCredentialsUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type X509Credentials. func (x X509Credentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "certificateReference", x.CertificateReference) + populate(objectMap, "certificateSecretName", x.CertificateSecretName) return json.Marshal(objectMap) } @@ -1246,35 +1433,8 @@ func (x *X509Credentials) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "certificateReference": - err = unpopulate(val, "CertificateReference", &x.CertificateReference) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", x, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type X509CredentialsUpdate. -func (x X509CredentialsUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "certificateReference", x.CertificateReference) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type X509CredentialsUpdate. -func (x *X509CredentialsUpdate) 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", x, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "certificateReference": - err = unpopulate(val, "CertificateReference", &x.CertificateReference) + case "certificateSecretName": + err = unpopulate(val, "CertificateSecretName", &x.CertificateSecretName) delete(rawMsg, key) } if err != nil { @@ -1294,16 +1454,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func unpopulate(data json.RawMessage, fn string, v any) error { if data == nil || string(data) == "null" { return nil diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client.go index 051bca222b01..5d5c5a5ab74d 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-11-01-preview +// Generated from API version v2024_09_01_preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DeviceRegistry/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go deleted file mode 100644 index e044d2e1c17b..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operations_client_example_test.go +++ /dev/null @@ -1,54 +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. -// DO NOT EDIT. - -package armdeviceregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/List_Operations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armdeviceregistry.OperationListResult{ - // Value: []*armdeviceregistry.Operation{ - // { - // Name: to.Ptr("Microsoft.DeviceRegistry/assets/write"), - // Display: &armdeviceregistry.OperationDisplay{ - // Operation: to.Ptr("write"), - // Provider: to.Ptr("Microsoft Azure Device Registry"), - // Resource: to.Ptr("Asset"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client.go index 19468b74562d..a36820591649 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -28,7 +24,7 @@ type OperationStatusClient struct { } // NewOperationStatusClient creates a new instance of OperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusClient, error) { @@ -46,8 +42,8 @@ func NewOperationStatusClient(subscriptionID string, credential azcore.TokenCred // Get - Returns the current status of an async operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01-preview -// - location - The name of Azure region. +// Generated from API version v2024_09_01_preview +// - location - The location name. // - operationID - The ID of an ongoing async operation. // - options - OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. func (client *OperationStatusClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusClientGetOptions) (OperationStatusClientGetResponse, error) { @@ -73,7 +69,7 @@ func (client *OperationStatusClient) Get(ctx context.Context, location string, o } // getCreateRequest creates the Get request. -func (client *OperationStatusClient) getCreateRequest(ctx context.Context, location string, operationID string, options *OperationStatusClientGetOptions) (*policy.Request, error) { +func (client *OperationStatusClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationStatusClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DeviceRegistry/locations/{location}/operationStatuses/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *OperationStatusClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01-preview") + reqQP.Set("api-version", "v2024_09_01_preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go deleted file mode 100644 index baccd5220666..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/operationstatus_client_example_test.go +++ /dev/null @@ -1,46 +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. -// DO NOT EDIT. - -package armdeviceregistry_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/c77bbf822be2deaac1b690270c6cd03a52df0e37/specification/deviceregistry/resource-manager/Microsoft.DeviceRegistry/preview/2023-11-01-preview/examples/Get_OperationStatus.json -func ExampleOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceregistry.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusClient().Get(ctx, "testLocation", "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OperationStatusResult = armdeviceregistry.OperationStatusResult{ - // Name: to.Ptr("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-21T13:28:03.898Z"); return t}()), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DeviceRegistry/locations/testLocation/operationStatuses/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"), - // PercentComplete: to.Ptr[float32](100), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-11-21T13:27:03.898Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/options.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/options.go index 2295e724a787..52021baca60b 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/options.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/options.go @@ -1,31 +1,27 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry // AssetEndpointProfilesClientBeginCreateOrReplaceOptions contains the optional parameters for the AssetEndpointProfilesClient.BeginCreateOrReplace // method. type AssetEndpointProfilesClientBeginCreateOrReplaceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AssetEndpointProfilesClientBeginDeleteOptions contains the optional parameters for the AssetEndpointProfilesClient.BeginDelete // method. type AssetEndpointProfilesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AssetEndpointProfilesClientBeginUpdateOptions contains the optional parameters for the AssetEndpointProfilesClient.BeginUpdate // method. type AssetEndpointProfilesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -48,19 +44,19 @@ type AssetEndpointProfilesClientListBySubscriptionOptions struct { // AssetsClientBeginCreateOrReplaceOptions contains the optional parameters for the AssetsClient.BeginCreateOrReplace method. type AssetsClientBeginCreateOrReplaceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AssetsClientBeginDeleteOptions contains the optional parameters for the AssetsClient.BeginDelete method. type AssetsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AssetsClientBeginUpdateOptions contains the optional parameters for the AssetsClient.BeginUpdate method. type AssetsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -81,6 +77,17 @@ type AssetsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } +// BillingContainersClientGetOptions contains the optional parameters for the BillingContainersClient.Get method. +type BillingContainersClientGetOptions struct { + // placeholder for future optional parameters +} + +// BillingContainersClientListBySubscriptionOptions contains the optional parameters for the BillingContainersClient.NewListBySubscriptionPager +// method. +type BillingContainersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + // OperationStatusClientGetOptions contains the optional parameters for the OperationStatusClient.Get method. type OperationStatusClientGetOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/responses.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/responses.go index 541f09679274..b22b6cbcbe8a 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/responses.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/responses.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -78,6 +74,18 @@ type AssetsClientUpdateResponse struct { Asset } +// BillingContainersClientGetResponse contains the response from method BillingContainersClient.Get. +type BillingContainersClientGetResponse struct { + // billingContainer Model as Azure resource whose sole purpose is to keep track of billables resources under a subscription. + BillingContainer +} + +// BillingContainersClientListBySubscriptionResponse contains the response from method BillingContainersClient.NewListBySubscriptionPager. +type BillingContainersClientListBySubscriptionResponse struct { + // The response of a BillingContainer list operation. + BillingContainerListResult +} + // OperationStatusClientGetResponse contains the response from method OperationStatusClient.Get. type OperationStatusClientGetResponse struct { // The current status of an async operation. diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/time_rfc3339.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/time_rfc3339.go index 81a768159744..53e35fdc2ba2 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/time_rfc3339.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/time_rfc3339.go @@ -1,10 +1,6 @@ -//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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armdeviceregistry @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml b/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml new file mode 100644 index 000000000000..57db78b5bfca --- /dev/null +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/deviceregistry/DeviceRegistry.Management +commit: bd37988c515821dcd48192ec1db5cb39c39e3c97 +repo: Azure/azure-rest-api-specs +additionalDirectories: