From 77ebba102d2383b62696171086362b6be2f2ec99 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 21 Nov 2024 18:09:48 +0000 Subject: [PATCH] CodeGen from PR 31635 in Azure/azure-rest-api-specs Merge 1c31d4bddd24a8bce89dda68c695890ecf05fd54 into f44ee842a7facb754ae4aa06c78157a0cbb8b30a --- .../CHANGELOG.md | 7 + .../armdeviceprovisioningservices/README.md | 2 +- .../armdeviceprovisioningservices/autorest.md | 7 +- .../client_factory.go | 26 +- .../constants.go | 20 +- .../dpscertificate_client.go | 106 +-- .../dpscertificate_client_example_test.go | 239 ----- .../fake/time_rfc1123.go | 6 +- .../fake/time_rfc3339.go | 42 +- .../armdeviceprovisioningservices/go.mod | 12 +- .../armdeviceprovisioningservices/go.sum | 17 - .../iotdpsresource_client.go | 78 +- .../iotdpsresource_client_example_test.go | 866 ------------------ .../armdeviceprovisioningservices/models.go | 17 +- .../models_serde.go | 34 +- .../operations_client.go | 4 +- .../operations_client_example_test.go | 326 ------- .../{response_types.go => responses.go} | 0 .../time_rfc1123.go | 6 +- .../time_rfc3339.go | 42 +- 20 files changed, 256 insertions(+), 1601 deletions(-) delete mode 100644 sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/dpscertificate_client_example_test.go delete mode 100644 sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client_example_test.go delete mode 100644 sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client_example_test.go rename sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/{response_types.go => responses.go} (100%) diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/CHANGELOG.md b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/CHANGELOG.md index a901ae51b08e..2038c55dfbb4 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/CHANGELOG.md +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.3.0-beta.2 (2024-11-21) +### Features Added + +- New enum type `IotHubAuthenticationType` with values `IotHubAuthenticationTypeKeyBased`, `IotHubAuthenticationTypeSystemAssigned`, `IotHubAuthenticationTypeUserAssigned` +- New field `AuthenticationType`, `HostName`, `SelectedUserAssignedIdentityResourceID` in struct `IotHubDefinitionDescription` + + ## 1.3.0-beta.1 (2023-11-30) ### Features Added diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/README.md b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/README.md index 4e21ad2497c0..76c8b17c9cd7 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/README.md +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/README.md @@ -55,7 +55,7 @@ clientFactory, err := armdeviceprovisioningservices.NewClientFactory(", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDpsCertificateClient().Get(ctx, "cert", "myResourceGroup", "myFirstProvisioningService", &armdeviceprovisioningservices.DpsCertificateClientGetOptions{IfMatch: 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.CertificateResponse = armdeviceprovisioningservices.CertificateResponse{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/andbuc-hub/certificates/cert"), - // Properties: &armdeviceprovisioningservices.CertificateProperties{ - // Certificate: []byte("MA=="), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2039-12-31T23:59:59.000Z"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSCertificateCreateOrUpdate.json -func ExampleDpsCertificateClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDpsCertificateClient().CreateOrUpdate(ctx, "myResourceGroup", "myFirstProvisioningService", "cert", armdeviceprovisioningservices.CertificateResponse{ - Properties: &armdeviceprovisioningservices.CertificateProperties{ - Certificate: []byte("MA=="), - }, - }, &armdeviceprovisioningservices.DpsCertificateClientCreateOrUpdateOptions{IfMatch: 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.CertificateResponse = armdeviceprovisioningservices.CertificateResponse{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServives/myFirstProvisioningService/certificates/cert"), - // Properties: &armdeviceprovisioningservices.CertificateProperties{ - // Certificate: []byte("MA=="), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2039-12-31T23:59:59.000Z"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSDeleteCertificate.json -func ExampleDpsCertificateClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDpsCertificateClient().Delete(ctx, "myResourceGroup", "AAAAAAAADGk=", "myFirstProvisioningService", "cert", &armdeviceprovisioningservices.DpsCertificateClientDeleteOptions{CertificateName1: nil, - CertificateIsVerified: nil, - CertificatePurpose: nil, - CertificateCreated: nil, - CertificateLastUpdated: nil, - CertificateHasPrivateKey: nil, - CertificateNonce: nil, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetCertificates.json -func ExampleDpsCertificateClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDpsCertificateClient().List(ctx, "myResourceGroup", "myFirstProvisioningService", 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.CertificateListDescription = armdeviceprovisioningservices.CertificateListDescription{ - // Value: []*armdeviceprovisioningservices.CertificateResponse{ - // { - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/Certificates"), - // Etag: to.Ptr("AAAAAAExpNs="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/IotHubs/andbuc-hub/certificates/cert"), - // Properties: &armdeviceprovisioningservices.CertificateProperties{ - // Certificate: []byte("MA=="), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2039-12-31T23:59:59.000Z"); return t}()), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=testdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGenerateVerificationCode.json -func ExampleDpsCertificateClient_GenerateVerificationCode() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDpsCertificateClient().GenerateVerificationCode(ctx, "cert", "AAAAAAAADGk=", "myResourceGroup", "myFirstProvisioningService", &armdeviceprovisioningservices.DpsCertificateClientGenerateVerificationCodeOptions{CertificateName1: nil, - CertificateIsVerified: nil, - CertificatePurpose: nil, - CertificateCreated: nil, - CertificateLastUpdated: nil, - CertificateHasPrivateKey: nil, - CertificateNonce: 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.VerificationCodeResponse = armdeviceprovisioningservices.VerificationCodeResponse{ - // Name: to.Ptr("cert"), - // Properties: &armdeviceprovisioningservices.VerificationCodeResponseProperties{ - // Certificate: []byte("MA=="), - // Created: to.Ptr("Thu, 12 Oct 2017 19:23:50 GMT"), - // Expiry: to.Ptr("Sat, 31 Dec 2039 23:59:59 GMT"), - // IsVerified: to.Ptr(false), - // Subject: to.Ptr("CN=andbucdevice1"), - // Thumbprint: to.Ptr("##############################"), - // Updated: to.Ptr("Thu, 12 Oct 2017 19:26:56 GMT"), - // VerificationCode: to.Ptr("##################################"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSVerifyCertificate.json -func ExampleDpsCertificateClient_VerifyCertificate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDpsCertificateClient().VerifyCertificate(ctx, "cert", "AAAAAAAADGk=", "myResourceGroup", "myFirstProvisioningService", armdeviceprovisioningservices.VerificationCodeRequest{ - Certificate: to.Ptr("#####################################"), - }, &armdeviceprovisioningservices.DpsCertificateClientVerifyCertificateOptions{CertificateName1: nil, - CertificateIsVerified: nil, - CertificatePurpose: nil, - CertificateCreated: nil, - CertificateLastUpdated: nil, - CertificateHasPrivateKey: nil, - CertificateNonce: 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.CertificateResponse = armdeviceprovisioningservices.CertificateResponse{ - // Name: to.Ptr("cert"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/Certificates"), - // Etag: to.Ptr("AAAAAAExpTQ="), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/certificates/cert"), - // Properties: &armdeviceprovisioningservices.CertificateProperties{ - // Certificate: []byte("MA=="), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:23:50.000Z"); return t}()), - // Expiry: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2039-12-31T23:59:59.000Z"); return t}()), - // IsVerified: to.Ptr(true), - // Subject: to.Ptr("CN=andbucdevice1"), - // Thumbprint: to.Ptr("97388663832D0393C9246CAB4FBA2C8677185A25"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC1123, "2017-10-12T19:26:56.000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc1123.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc1123.go index 61cb0a0e089f..6d54eacc9a89 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc1123.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc1123.go @@ -45,6 +45,10 @@ func (t *dateTimeRFC1123) UnmarshalText(data []byte) error { return err } +func (t dateTimeRFC1123) String() string { + return time.Time(t).Format(time.RFC1123) +} + func populateDateTimeRFC1123(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -58,7 +62,7 @@ func populateDateTimeRFC1123(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC1123(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC1123 diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc3339.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc3339.go index b0535a7b63e6..81f308b0d343 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc3339.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/fake/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.mod b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.mod index 0b200469c69d..34d2cebcf46d 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.mod +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceprovisionings go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.2.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.25.0 // indirect golang.org/x/net v0.27.0 // indirect - golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect ) diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.sum b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.sum index 09d275cb9a37..917448a001b7 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.sum +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/go.sum @@ -1,29 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0 h1:GJHeeA2N7xrG3q30L2UXDyuWRzDM900/65j70wcM4Ww= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.13.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg= 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-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= -github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -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/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/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client.go index 25c80d8e59f1..478b0770c744 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client.go @@ -47,7 +47,7 @@ func NewIotDpsResourceClient(subscriptionID string, credential azcore.TokenCrede // name is syntactically valid and if the name is usable // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - arguments - Set the name parameter in the OperationInputs structure to the name of the provisioning service to check. // - options - IotDpsResourceClientCheckProvisioningServiceNameAvailabilityOptions contains the optional parameters for the // IotDpsResourceClient.CheckProvisioningServiceNameAvailability method. @@ -85,7 +85,7 @@ func (client *IotDpsResourceClient) checkProvisioningServiceNameAvailabilityCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, arguments); err != nil { @@ -108,7 +108,7 @@ func (client *IotDpsResourceClient) checkProvisioningServiceNameAvailabilityHand // modified values in a new body to update the provisioning service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - Resource group identifier. // - provisioningServiceName - Name of provisioning service to create or update. // - iotDpsDescription - Description of the provisioning service to create or update. @@ -136,7 +136,7 @@ func (client *IotDpsResourceClient) BeginCreateOrUpdate(ctx context.Context, res // modified values in a new body to update the provisioning service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview func (client *IotDpsResourceClient) createOrUpdate(ctx context.Context, resourceGroupName string, provisioningServiceName string, iotDpsDescription ProvisioningServiceDescription, options *IotDpsResourceClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "IotDpsResourceClient.BeginCreateOrUpdate" @@ -178,7 +178,7 @@ func (client *IotDpsResourceClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, iotDpsDescription); err != nil { @@ -191,7 +191,7 @@ func (client *IotDpsResourceClient) createOrUpdateCreateRequest(ctx context.Cont // name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - privateEndpointConnectionName - The name of the private endpoint connection @@ -219,7 +219,7 @@ func (client *IotDpsResourceClient) BeginCreateOrUpdatePrivateEndpointConnection // name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview func (client *IotDpsResourceClient) createOrUpdatePrivateEndpointConnection(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *IotDpsResourceClientBeginCreateOrUpdatePrivateEndpointConnectionOptions) (*http.Response, error) { var err error const operationName = "IotDpsResourceClient.BeginCreateOrUpdatePrivateEndpointConnection" @@ -265,7 +265,7 @@ func (client *IotDpsResourceClient) createOrUpdatePrivateEndpointConnectionCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, privateEndpointConnection); err != nil { @@ -277,7 +277,7 @@ func (client *IotDpsResourceClient) createOrUpdatePrivateEndpointConnectionCreat // BeginDelete - Deletes the Provisioning Service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - provisioningServiceName - Name of provisioning service to delete. // - resourceGroupName - Resource group identifier. // - options - IotDpsResourceClientBeginDeleteOptions contains the optional parameters for the IotDpsResourceClient.BeginDelete @@ -302,7 +302,7 @@ func (client *IotDpsResourceClient) BeginDelete(ctx context.Context, provisionin // Delete - Deletes the Provisioning Service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview func (client *IotDpsResourceClient) deleteOperation(ctx context.Context, provisioningServiceName string, resourceGroupName string, options *IotDpsResourceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "IotDpsResourceClient.BeginDelete" @@ -344,7 +344,7 @@ func (client *IotDpsResourceClient) deleteCreateRequest(ctx context.Context, pro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -353,7 +353,7 @@ func (client *IotDpsResourceClient) deleteCreateRequest(ctx context.Context, pro // BeginDeletePrivateEndpointConnection - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - privateEndpointConnectionName - The name of the private endpoint connection @@ -379,7 +379,7 @@ func (client *IotDpsResourceClient) BeginDeletePrivateEndpointConnection(ctx con // DeletePrivateEndpointConnection - Delete private endpoint connection with the specified name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview func (client *IotDpsResourceClient) deletePrivateEndpointConnection(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, options *IotDpsResourceClientBeginDeletePrivateEndpointConnectionOptions) (*http.Response, error) { var err error const operationName = "IotDpsResourceClient.BeginDeletePrivateEndpointConnection" @@ -425,7 +425,7 @@ func (client *IotDpsResourceClient) deletePrivateEndpointConnectionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -434,7 +434,7 @@ func (client *IotDpsResourceClient) deletePrivateEndpointConnectionCreateRequest // Get - Get the metadata of the provisioning service without SAS keys. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - provisioningServiceName - Name of the provisioning service to retrieve. // - resourceGroupName - Resource group name. // - options - IotDpsResourceClientGetOptions contains the optional parameters for the IotDpsResourceClient.Get method. @@ -480,7 +480,7 @@ func (client *IotDpsResourceClient) getCreateRequest(ctx context.Context, provis return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -498,7 +498,7 @@ func (client *IotDpsResourceClient) getHandleResponse(resp *http.Response) (IotD // GetOperationResult - Gets the status of a long running operation, such as create, update or delete a provisioning service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - operationID - Operation id corresponding to long running operation. Use this to poll for the status. // - resourceGroupName - Resource group identifier. // - provisioningServiceName - Name of provisioning service that the operation is running on. @@ -551,8 +551,8 @@ func (client *IotDpsResourceClient) getOperationResultCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") reqQP.Set("asyncinfo", asyncinfo) - reqQP.Set("api-version", "2023-03-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -570,7 +570,7 @@ func (client *IotDpsResourceClient) getOperationResultHandleResponse(resp *http. // GetPrivateEndpointConnection - Get private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - privateEndpointConnectionName - The name of the private endpoint connection @@ -622,7 +622,7 @@ func (client *IotDpsResourceClient) getPrivateEndpointConnectionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -640,7 +640,7 @@ func (client *IotDpsResourceClient) getPrivateEndpointConnectionHandleResponse(r // GetPrivateLinkResources - Get the specified private link resource for the given provisioning service // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - groupID - The name of the private link resource @@ -692,7 +692,7 @@ func (client *IotDpsResourceClient) getPrivateLinkResourcesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -709,7 +709,7 @@ func (client *IotDpsResourceClient) getPrivateLinkResourcesHandleResponse(resp * // NewListByResourceGroupPager - Get a list of all provisioning services in the given resource group. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - Resource group identifier. // - options - IotDpsResourceClientListByResourceGroupOptions contains the optional parameters for the IotDpsResourceClient.NewListByResourceGroupPager // method. @@ -752,7 +752,7 @@ func (client *IotDpsResourceClient) listByResourceGroupCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -769,7 +769,7 @@ func (client *IotDpsResourceClient) listByResourceGroupHandleResponse(resp *http // NewListBySubscriptionPager - List all the provisioning services for a given subscription id. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - options - IotDpsResourceClientListBySubscriptionOptions contains the optional parameters for the IotDpsResourceClient.NewListBySubscriptionPager // method. func (client *IotDpsResourceClient) NewListBySubscriptionPager(options *IotDpsResourceClientListBySubscriptionOptions) *runtime.Pager[IotDpsResourceClientListBySubscriptionResponse] { @@ -807,7 +807,7 @@ func (client *IotDpsResourceClient) listBySubscriptionCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -824,7 +824,7 @@ func (client *IotDpsResourceClient) listBySubscriptionHandleResponse(resp *http. // NewListKeysPager - List the primary and secondary keys for a provisioning service. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - provisioningServiceName - The provisioning service name to get the shared access keys for. // - resourceGroupName - resource group name // - options - IotDpsResourceClientListKeysOptions contains the optional parameters for the IotDpsResourceClient.NewListKeysPager @@ -872,7 +872,7 @@ func (client *IotDpsResourceClient) listKeysCreateRequest(ctx context.Context, p return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -890,7 +890,7 @@ func (client *IotDpsResourceClient) listKeysHandleResponse(resp *http.Response) // ListKeysForKeyName - List primary and secondary keys for a specific key name // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - provisioningServiceName - Name of the provisioning service. // - keyName - Logical key name to get key-values for. // - resourceGroupName - The name of the resource group that contains the provisioning service. @@ -942,7 +942,7 @@ func (client *IotDpsResourceClient) listKeysForKeyNameCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -960,7 +960,7 @@ func (client *IotDpsResourceClient) listKeysForKeyNameHandleResponse(resp *http. // ListPrivateEndpointConnections - List private endpoint connection properties // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - options - IotDpsResourceClientListPrivateEndpointConnectionsOptions contains the optional parameters for the IotDpsResourceClient.ListPrivateEndpointConnections @@ -1007,7 +1007,7 @@ func (client *IotDpsResourceClient) listPrivateEndpointConnectionsCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1025,7 +1025,7 @@ func (client *IotDpsResourceClient) listPrivateEndpointConnectionsHandleResponse // ListPrivateLinkResources - List private link resources for the given provisioning service // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - The name of the resource group that contains the provisioning service. // - resourceName - The name of the provisioning service. // - options - IotDpsResourceClientListPrivateLinkResourcesOptions contains the optional parameters for the IotDpsResourceClient.ListPrivateLinkResources @@ -1072,7 +1072,7 @@ func (client *IotDpsResourceClient) listPrivateLinkResourcesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1089,7 +1089,7 @@ func (client *IotDpsResourceClient) listPrivateLinkResourcesHandleResponse(resp // NewListValidSKUsPager - Gets the list of valid SKUs and tiers for a provisioning service. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - provisioningServiceName - Name of provisioning service. // - resourceGroupName - Name of resource group. // - options - IotDpsResourceClientListValidSKUsOptions contains the optional parameters for the IotDpsResourceClient.NewListValidSKUsPager @@ -1137,7 +1137,7 @@ func (client *IotDpsResourceClient) listValidSKUsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1155,7 +1155,7 @@ func (client *IotDpsResourceClient) listValidSKUsHandleResponse(resp *http.Respo // BeginUpdate - Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview // - resourceGroupName - Resource group identifier. // - provisioningServiceName - Name of provisioning service to create or update. // - provisioningServiceTags - Updated tag information to set into the provisioning service instance. @@ -1181,7 +1181,7 @@ func (client *IotDpsResourceClient) BeginUpdate(ctx context.Context, resourceGro // Update - Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate method // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-01-preview func (client *IotDpsResourceClient) update(ctx context.Context, resourceGroupName string, provisioningServiceName string, provisioningServiceTags TagsResource, options *IotDpsResourceClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "IotDpsResourceClient.BeginUpdate" @@ -1223,7 +1223,7 @@ func (client *IotDpsResourceClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, provisioningServiceTags); err != nil { diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client_example_test.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client_example_test.go deleted file mode 100644 index 6f8cae8d8f26..000000000000 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/iotdpsresource_client_example_test.go +++ /dev/null @@ -1,866 +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 armdeviceprovisioningservices_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/deviceprovisioningservices/armdeviceprovisioningservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGet.json -func ExampleIotDpsResourceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().Get(ctx, "myFirstProvisioningService", "myResourceGroup", 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.ProvisioningServiceDescription = armdeviceprovisioningservices.ProvisioningServiceDescription{ - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("aa80bd74-a3f0-4f14-b9da-99c5351cf9d5"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("c38f618d-47f6-4260-8b3d-1dd8c130f323"), - // PrincipalID: to.Ptr("f1b0b133-10dc-4985-966f-a98a04675fe9"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // AuthorizationPolicies: []*armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleAccessRightsDescription{ - // }, - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSCreate.json -func ExampleIotDpsResourceClient_BeginCreateOrUpdate_dpsCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myFirstProvisioningService", armdeviceprovisioningservices.ProvisioningServiceDescription{ - Location: to.Ptr("East US"), - Tags: map[string]*string{}, - Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - EnableDataResidency: to.Ptr(false), - }, - SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - Capacity: to.Ptr[int64](1), - }, - }, 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.ProvisioningServiceDescription = armdeviceprovisioningservices.ProvisioningServiceDescription{ - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups//providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // AuthorizationPolicies: []*armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleAccessRightsDescription{ - // }, - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // EnableDataResidency: to.Ptr(false), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSUpdate.json -func ExampleIotDpsResourceClient_BeginCreateOrUpdate_dpsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myFirstProvisioningService", armdeviceprovisioningservices.ProvisioningServiceDescription{ - Location: to.Ptr("East US"), - Tags: map[string]*string{}, - Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": {}, - }, - }, - Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - EnableDataResidency: to.Ptr(false), - }, - SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - Capacity: to.Ptr[int64](1), - }, - }, 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.ProvisioningServiceDescription = armdeviceprovisioningservices.ProvisioningServiceDescription{ - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups//providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("aa80bd74-a3f0-4f14-b9da-99c5351cf9d5"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("c38f618d-47f6-4260-8b3d-1dd8c130f323"), - // PrincipalID: to.Ptr("f1b0b133-10dc-4985-966f-a98a04675fe9"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // AuthorizationPolicies: []*armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleAccessRightsDescription{ - // }, - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // EnableDataResidency: to.Ptr(false), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSPatch.json -func ExampleIotDpsResourceClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginUpdate(ctx, "myResourceGroup", "myFirstProvisioningService", armdeviceprovisioningservices.TagsResource{ - Tags: map[string]*string{ - "foo": to.Ptr("bar"), - }, - }, 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.ProvisioningServiceDescription = armdeviceprovisioningservices.ProvisioningServiceDescription{ - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // "foo": to.Ptr("bar"), - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("aa80bd74-a3f0-4f14-b9da-99c5351cf9d5"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("c38f618d-47f6-4260-8b3d-1dd8c130f323"), - // PrincipalID: to.Ptr("f1b0b133-10dc-4985-966f-a98a04675fe9"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSDelete.json -func ExampleIotDpsResourceClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginDelete(ctx, "myFirstProvisioningService", "myResourceGroup", 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) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSListBySubscription.json -func ExampleIotDpsResourceClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotDpsResourceClient().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.ProvisioningServiceDescriptionListResult = armdeviceprovisioningservices.ProvisioningServiceDescriptionListResult{ - // Value: []*armdeviceprovisioningservices.ProvisioningServiceDescription{ - // { - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("aa80bd74-a3f0-4f14-b9da-99c5351cf9d5"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("c38f618d-47f6-4260-8b3d-1dd8c130f323"), - // PrincipalID: to.Ptr("f1b0b133-10dc-4985-966f-a98a04675fe9"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("mySecondProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/mySecondProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("01341f2b-d497-4117-b5c1-1f1d50b25444"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity2": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("8cd6d250-17dd-4c1b-9847-225237b94c55"), - // PrincipalID: to.Ptr("8785a11f-848a-4d5d-a55b-e381b9e15512"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSListByResourceGroup.json -func ExampleIotDpsResourceClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotDpsResourceClient().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.ProvisioningServiceDescriptionListResult = armdeviceprovisioningservices.ProvisioningServiceDescriptionListResult{ - // Value: []*armdeviceprovisioningservices.ProvisioningServiceDescription{ - // { - // Name: to.Ptr("myFirstProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("aa80bd74-a3f0-4f14-b9da-99c5351cf9d5"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("c38f618d-47f6-4260-8b3d-1dd8c130f323"), - // PrincipalID: to.Ptr("f1b0b133-10dc-4985-966f-a98a04675fe9"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("myFirstProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }, - // { - // Name: to.Ptr("mySecondProvisioningService"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/mySecondProvisioningService"), - // Location: to.Ptr("eastus"), - // Resourcegroup: to.Ptr("myResourceGroup"), - // Subscriptionid: to.Ptr("91d12660-3dec-467a-be2a-213b5544ddc0"), - // Tags: map[string]*string{ - // }, - // Etag: to.Ptr("AAAAAAAADGk="), - // Identity: &armdeviceprovisioningservices.ManagedServiceIdentity{ - // Type: to.Ptr(armdeviceprovisioningservices.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("01341f2b-d497-4117-b5c1-1f1d50b25444"), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // UserAssignedIdentities: map[string]*armdeviceprovisioningservices.UserAssignedIdentity{ - // "/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourcegroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testidentity2": &armdeviceprovisioningservices.UserAssignedIdentity{ - // ClientID: to.Ptr("8cd6d250-17dd-4c1b-9847-225237b94c55"), - // PrincipalID: to.Ptr("8785a11f-848a-4d5d-a55b-e381b9e15512"), - // }, - // }, - // }, - // Properties: &armdeviceprovisioningservices.IotDpsPropertiesDescription{ - // AllocationPolicy: to.Ptr(armdeviceprovisioningservices.AllocationPolicyHashed), - // DeviceProvisioningHostName: to.Ptr("global.azure-devices-provisioning.net"), - // IDScope: to.Ptr("0ne00000012"), - // PortalOperationsHostName: to.Ptr("myFirstProvisioningService.services.azure-devices-provisioning.net"), - // ServiceOperationsHostName: to.Ptr("mySecondProvisioningService.azure-devices-provisioning.net"), - // State: to.Ptr(armdeviceprovisioningservices.StateActive), - // }, - // SKU: &armdeviceprovisioningservices.IotDpsSKUInfo{ - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // Capacity: to.Ptr[int64](1), - // Tier: to.Ptr("Standard"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetOperationResult.json -func ExampleIotDpsResourceClient_GetOperationResult() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().GetOperationResult(ctx, "MTY5OTNmZDctODI5Yy00N2E2LTkxNDQtMDU1NGIyYzY1ZjRl", "myResourceGroup", "myFirstProvisioningService", "1508265712453", 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.AsyncOperationResult = armdeviceprovisioningservices.AsyncOperationResult{ - // Status: to.Ptr("Succeeded"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetValidSku.json -func ExampleIotDpsResourceClient_NewListValidSKUsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotDpsResourceClient().NewListValidSKUsPager("myFirstProvisioningService", "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.IotDpsSKUDefinitionListResult = armdeviceprovisioningservices.IotDpsSKUDefinitionListResult{ - // Value: []*armdeviceprovisioningservices.IotDpsSKUDefinition{ - // { - // Name: to.Ptr(armdeviceprovisioningservices.IotDpsSKUS1), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSCheckNameAvailability.json -func ExampleIotDpsResourceClient_CheckProvisioningServiceNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().CheckProvisioningServiceNameAvailability(ctx, armdeviceprovisioningservices.OperationInputs{ - Name: to.Ptr("test213123"), - }, 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.NameAvailabilityInfo = armdeviceprovisioningservices.NameAvailabilityInfo{ - // Message: to.Ptr("name is valid"), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armdeviceprovisioningservices.NameUnavailabilityReasonInvalid), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSListKeys.json -func ExampleIotDpsResourceClient_NewListKeysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIotDpsResourceClient().NewListKeysPager("myFirstProvisioningService", "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.SharedAccessSignatureAuthorizationRuleListResult = armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleListResult{ - // Value: []*armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleAccessRightsDescription{ - // { - // KeyName: to.Ptr("key1"), - // PrimaryKey: to.Ptr("#####################################"), - // Rights: to.Ptr(armdeviceprovisioningservices.AccessRightsDescriptionServiceConfig), - // SecondaryKey: to.Ptr("###################################"), - // }, - // { - // KeyName: to.Ptr("key2"), - // PrimaryKey: to.Ptr("#######################################"), - // Rights: to.Ptr(armdeviceprovisioningservices.AccessRightsDescriptionServiceConfig), - // SecondaryKey: to.Ptr("####################################="), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetKey.json -func ExampleIotDpsResourceClient_ListKeysForKeyName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().ListKeysForKeyName(ctx, "myFirstProvisioningService", "testKey", "myResourceGroup", 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.SharedAccessSignatureAuthorizationRuleAccessRightsDescription = armdeviceprovisioningservices.SharedAccessSignatureAuthorizationRuleAccessRightsDescription{ - // KeyName: to.Ptr("testKey"), - // PrimaryKey: to.Ptr("##################################"), - // Rights: to.Ptr(armdeviceprovisioningservices.AccessRightsDescriptionRegistrationStatusWrite), - // SecondaryKey: to.Ptr("################################"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSListPrivateLinkResources.json -func ExampleIotDpsResourceClient_ListPrivateLinkResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().ListPrivateLinkResources(ctx, "myResourceGroup", "myFirstProvisioningService", 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.PrivateLinkResources = armdeviceprovisioningservices.PrivateLinkResources{ - // Value: []*armdeviceprovisioningservices.GroupIDInformation{ - // { - // Name: to.Ptr("iotDps"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateLinkResources/iotDps"), - // Properties: &armdeviceprovisioningservices.GroupIDInformationProperties{ - // GroupID: to.Ptr("iotDps"), - // RequiredMembers: []*string{ - // to.Ptr("iotDps")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azure-devices-provisioning.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetPrivateLinkResources.json -func ExampleIotDpsResourceClient_GetPrivateLinkResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().GetPrivateLinkResources(ctx, "myResourceGroup", "myFirstProvisioningService", "iotDps", 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.GroupIDInformation = armdeviceprovisioningservices.GroupIDInformation{ - // Name: to.Ptr("iotDps"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateLinkResources"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateLinkResources/iotDps"), - // Properties: &armdeviceprovisioningservices.GroupIDInformationProperties{ - // GroupID: to.Ptr("iotDps"), - // RequiredMembers: []*string{ - // to.Ptr("iotDps")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.azure-devices-provisioning.net")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSListPrivateEndpointConnections.json -func ExampleIotDpsResourceClient_ListPrivateEndpointConnections() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().ListPrivateEndpointConnections(ctx, "myResourceGroup", "myFirstProvisioningService", 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.PrivateEndpointConnectionArray = []*armdeviceprovisioningservices.PrivateEndpointConnection{ - // { - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armdeviceprovisioningservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armdeviceprovisioningservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armdeviceprovisioningservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request!"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armdeviceprovisioningservices.PrivateLinkServiceConnectionStatusPending), - // }, - // }, - // }} -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSGetPrivateEndpointConnection.json -func ExampleIotDpsResourceClient_GetPrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIotDpsResourceClient().GetPrivateEndpointConnection(ctx, "myResourceGroup", "myFirstProvisioningService", "myPrivateEndpointConnection", 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.PrivateEndpointConnection = armdeviceprovisioningservices.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armdeviceprovisioningservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armdeviceprovisioningservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armdeviceprovisioningservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my request!"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armdeviceprovisioningservices.PrivateLinkServiceConnectionStatusPending), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSCreateOrUpdatePrivateEndpointConnection.json -func ExampleIotDpsResourceClient_BeginCreateOrUpdatePrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginCreateOrUpdatePrivateEndpointConnection(ctx, "myResourceGroup", "myFirstProvisioningService", "myPrivateEndpointConnection", armdeviceprovisioningservices.PrivateEndpointConnection{ - Properties: &armdeviceprovisioningservices.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armdeviceprovisioningservices.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armdeviceprovisioningservices.PrivateLinkServiceConnectionStatusApproved), - }, - }, - }, 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.PrivateEndpointConnection = armdeviceprovisioningservices.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armdeviceprovisioningservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armdeviceprovisioningservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armdeviceprovisioningservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armdeviceprovisioningservices.PrivateLinkServiceConnectionStatusApproved), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSDeletePrivateEndpointConnection.json -func ExampleIotDpsResourceClient_BeginDeletePrivateEndpointConnection() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armdeviceprovisioningservices.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIotDpsResourceClient().BeginDeletePrivateEndpointConnection(ctx, "myResourceGroup", "myFirstProvisioningService", "myPrivateEndpointConnection", 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.PrivateEndpointConnection = armdeviceprovisioningservices.PrivateEndpointConnection{ - // Name: to.Ptr("myPrivateEndpointConnection"), - // Type: to.Ptr("Microsoft.Devices/ProvisioningServices/PrivateEndpointConnections"), - // ID: to.Ptr("/subscriptions/91d12660-3dec-467a-be2a-213b5544ddc0/resourceGroups/myResourceGroup/providers/Microsoft.Devices/ProvisioningServices/myFirstProvisioningService/PrivateEndpointConnections/myPrivateEndpointConnection"), - // Properties: &armdeviceprovisioningservices.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armdeviceprovisioningservices.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/a9eba280-4734-4d49-878f-b5549d1d0453/resourceGroups/networkResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint"), - // }, - // PrivateLinkServiceConnectionState: &armdeviceprovisioningservices.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Deleted"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armdeviceprovisioningservices.PrivateLinkServiceConnectionStatusDisconnected), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models.go index d00ab6bde002..6bc8e3416128 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models.go @@ -196,9 +196,6 @@ type IotDpsSKUInfo struct { // IotHubDefinitionDescription - Description of the IoT hub. type IotHubDefinitionDescription struct { - // REQUIRED; Connection string of the IoT hub. - ConnectionString *string - // REQUIRED; ARM region of the IoT hub. Location *string @@ -208,7 +205,19 @@ type IotHubDefinitionDescription struct { // flag for applying allocationPolicy or not for a given iot hub. ApplyAllocationPolicy *bool - // READ-ONLY; Host name of the IoT hub. + // IotHub MI authentication type: KeyBased, UserAssigned, SystemAssigned. + AuthenticationType *IotHubAuthenticationType + + // Connection string of the IoT hub. + ConnectionString *string + + // Host name of the IoT hub. + HostName *string + + // The selected user-assigned identity resource Id associated with IoT Hub. This is required when authenticationType is UserAssigned. + SelectedUserAssignedIdentityResourceID *string + + // READ-ONLY; Host name of the IoT hub derived from connection string. Name *string } diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models_serde.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models_serde.go index bbb19861d5e8..43438013bdc3 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models_serde.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/models_serde.go @@ -77,7 +77,9 @@ func (c *CertificateListDescription) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type CertificateProperties. func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateByteArray(objectMap, "certificate", c.Certificate, runtime.Base64StdFormat) + populateByteArray(objectMap, "certificate", c.Certificate, func() any { + return runtime.EncodeByteArray(c.Certificate, runtime.Base64StdFormat) + }) populateDateTimeRFC1123(objectMap, "created", c.Created) populateDateTimeRFC1123(objectMap, "expiry", c.Expiry) populate(objectMap, "isVerified", c.IsVerified) @@ -97,7 +99,9 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "certificate": - err = runtime.DecodeByteArray(string(val), &c.Certificate, runtime.Base64StdFormat) + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &c.Certificate, runtime.Base64StdFormat) + } delete(rawMsg, key) case "created": err = unpopulateDateTimeRFC1123(val, "Created", &c.Created) @@ -493,9 +497,12 @@ func (i IotHubDefinitionDescription) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allocationWeight", i.AllocationWeight) populate(objectMap, "applyAllocationPolicy", i.ApplyAllocationPolicy) + populate(objectMap, "authenticationType", i.AuthenticationType) populate(objectMap, "connectionString", i.ConnectionString) + populate(objectMap, "hostName", i.HostName) populate(objectMap, "location", i.Location) populate(objectMap, "name", i.Name) + populate(objectMap, "selectedUserAssignedIdentityResourceId", i.SelectedUserAssignedIdentityResourceID) return json.Marshal(objectMap) } @@ -514,15 +521,24 @@ func (i *IotHubDefinitionDescription) UnmarshalJSON(data []byte) error { case "applyAllocationPolicy": err = unpopulate(val, "ApplyAllocationPolicy", &i.ApplyAllocationPolicy) delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &i.AuthenticationType) + delete(rawMsg, key) case "connectionString": err = unpopulate(val, "ConnectionString", &i.ConnectionString) delete(rawMsg, key) + case "hostName": + err = unpopulate(val, "HostName", &i.HostName) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &i.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) + case "selectedUserAssignedIdentityResourceId": + err = unpopulate(val, "SelectedUserAssignedIdentityResourceID", &i.SelectedUserAssignedIdentityResourceID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -1242,7 +1258,9 @@ func (v *VerificationCodeResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type VerificationCodeResponseProperties. func (v VerificationCodeResponseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateByteArray(objectMap, "certificate", v.Certificate, runtime.Base64StdFormat) + populateByteArray(objectMap, "certificate", v.Certificate, func() any { + return runtime.EncodeByteArray(v.Certificate, runtime.Base64StdFormat) + }) populate(objectMap, "created", v.Created) populate(objectMap, "expiry", v.Expiry) populate(objectMap, "isVerified", v.IsVerified) @@ -1263,7 +1281,9 @@ func (v *VerificationCodeResponseProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "certificate": - err = runtime.DecodeByteArray(string(val), &v.Certificate, runtime.Base64StdFormat) + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &v.Certificate, runtime.Base64StdFormat) + } delete(rawMsg, key) case "created": err = unpopulate(val, "Created", &v.Created) @@ -1304,18 +1324,18 @@ func populate(m map[string]any, k string, v any) { } } -func populateByteArray(m map[string]any, k string, b []byte, f runtime.Base64Encoding) { +func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { if azcore.IsNullValue(b) { m[k] = nil } else if len(b) == 0 { return } else { - m[k] = runtime.EncodeByteArray(b, f) + m[k] = convert() } } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client.go index c941c602aed5..a93dfe9ad70c 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available Microsoft.Devices REST API operations. // -// Generated from API version 2023-03-01-preview +// Generated from API version 2025-02-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]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") + reqQP.Set("api-version", "2025-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client_example_test.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client_example_test.go deleted file mode 100644 index c0027d4ad079..000000000000 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/operations_client_example_test.go +++ /dev/null @@ -1,326 +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 armdeviceprovisioningservices_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/0d41e635294dce73dfa99b07f3da4b68a9c9e29c/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/preview/2023-03-01-preview/examples/DPSOperations.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 := armdeviceprovisioningservices.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 = armdeviceprovisioningservices.OperationListResult{ - // Value: []*armdeviceprovisioningservices.Operation{ - // { - // Name: to.Ptr("Microsoft.Devices/register/action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Register Resource Provider"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/diagnosticSettings/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/diagnosticSettings/write"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Set Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/metricDefinitions/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Read IotHub service metric definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/IotHubs/logDefinitions/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Read IotHub service log definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/operations/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get All ResourceProvider Operations"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/checkNameAvailability/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Check If IotHub name is available"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/usages/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Subscription Usages"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get IotHub(s)"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Write"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Create or update IotHub Resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/Delete"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Delete IotHub Resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/iotHubStats/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get IotHub Statistics"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/skus/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get valid IotHub Skus"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/listkeys/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get all IotHub Keys"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/iotHubKeys/listkeys/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get IotHub Key for the given name"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Write"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Create EventHub Consumer Group"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get EventHub Consumer Group(s)"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/eventHubEndpoints/consumerGroups/Delete"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Delete EventHub Consumer Group"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/exportDevices/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Export Devices"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/importDevices/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Import Devices"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/jobs/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get the Job(s) on IotHub"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/quotaMetrics/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Quota Metrics"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routing/routes/$testall/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Routing Rule Test All"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routing/routes/$testnew/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Routing Rule Test Route"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/iotHubs/routingEndpointsHealth/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Endpoint Health"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/diagnosticSettings/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/diagnosticSettings/write"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Set Diagnostic Setting"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/metricDefinitions/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Read DPS service metric definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/ProvisioningServices/logDefinitions/read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Read DPS service log definitions"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("IotHubs"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/checkProvisioningServiceNameAvailability/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Check If Provisioning Service name is available"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServives"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Get Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Write"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Create Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/Delete"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Delete Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/skus/Read"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("Delete Provisioning Service resource"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Devices/provisioningServices/listkeys/Action"), - // Display: &armdeviceprovisioningservices.OperationDisplay{ - // Operation: to.Ptr("get security related metadata"), - // Provider: to.Ptr("Microsoft Devices"), - // Resource: to.Ptr("ProvisioningServices"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/response_types.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/responses.go similarity index 100% rename from sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/response_types.go rename to sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/responses.go diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc1123.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc1123.go index 7c570cfacd32..ca9e00ad7fdf 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc1123.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc1123.go @@ -45,6 +45,10 @@ func (t *dateTimeRFC1123) UnmarshalText(data []byte) error { return err } +func (t dateTimeRFC1123) String() string { + return time.Time(t).Format(time.RFC1123) +} + func populateDateTimeRFC1123(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -58,7 +62,7 @@ func populateDateTimeRFC1123(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC1123(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC1123 diff --git a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc3339.go b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc3339.go index 3cbfd44363c7..560b49fb01f8 100644 --- a/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc3339.go +++ b/sdk/resourcemanager/deviceprovisioningservices/armdeviceprovisioningservices/time_rfc3339.go @@ -19,12 +19,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +44,33 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339