diff --git a/sdk/resourcemanager/communication/armcommunication/CHANGELOG.md b/sdk/resourcemanager/communication/armcommunication/CHANGELOG.md index f248ed12a599..47f9af42928c 100644 --- a/sdk/resourcemanager/communication/armcommunication/CHANGELOG.md +++ b/sdk/resourcemanager/communication/armcommunication/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 2.3.0 (2025-05-07) +### Features Added + +- New field `DisableLocalAuth` in struct `ServiceProperties` + + ## 2.2.0 (2024-03-22) ### Features Added diff --git a/sdk/resourcemanager/communication/armcommunication/autorest.md b/sdk/resourcemanager/communication/armcommunication/autorest.md index a24dd30317ed..3c783b3f5d34 100644 --- a/sdk/resourcemanager/communication/armcommunication/autorest.md +++ b/sdk/resourcemanager/communication/armcommunication/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/communication/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/communication/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.2.0 -tag: package-2023-04 +module-version: 2.3.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/communication/armcommunication/client_factory.go b/sdk/resourcemanager/communication/armcommunication/client_factory.go index 3c337b050149..39a1702ef67c 100644 --- a/sdk/resourcemanager/communication/armcommunication/client_factory.go +++ b/sdk/resourcemanager/communication/armcommunication/client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. diff --git a/sdk/resourcemanager/communication/armcommunication/constants.go b/sdk/resourcemanager/communication/armcommunication/constants.go index 5c751fbab8fe..f61d0309ff56 100644 --- a/sdk/resourcemanager/communication/armcommunication/constants.go +++ b/sdk/resourcemanager/communication/armcommunication/constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -10,7 +7,7 @@ package armcommunication const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication" - moduleVersion = "v2.2.0" + moduleVersion = "v2.3.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/communication/armcommunication/domains_client.go b/sdk/resourcemanager/communication/armcommunication/domains_client.go index e4eb1db7bebe..18ba3075de35 100644 --- a/sdk/resourcemanager/communication/armcommunication/domains_client.go +++ b/sdk/resourcemanager/communication/armcommunication/domains_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewDomainsClient(subscriptionID string, credential azcore.TokenCredential, // BeginCancelVerification - Cancel verification of DNS record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -74,7 +71,7 @@ func (client *DomainsClient) BeginCancelVerification(ctx context.Context, resour // CancelVerification - Cancel verification of DNS record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *DomainsClient) cancelVerification(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, options *DomainsClientBeginCancelVerificationOptions) (*http.Response, error) { var err error const operationName = "DomainsClient.BeginCancelVerification" @@ -97,7 +94,7 @@ func (client *DomainsClient) cancelVerification(ctx context.Context, resourceGro } // cancelVerificationCreateRequest creates the CancelVerification request. -func (client *DomainsClient) cancelVerificationCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, options *DomainsClientBeginCancelVerificationOptions) (*policy.Request, error) { +func (client *DomainsClient) cancelVerificationCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, _ *DomainsClientBeginCancelVerificationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/cancelVerification" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,7 +117,7 @@ func (client *DomainsClient) cancelVerificationCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -132,7 +129,7 @@ func (client *DomainsClient) cancelVerificationCreateRequest(ctx context.Context // BeginCreateOrUpdate - Add a new Domains resource under the parent EmailService resource or update an existing Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -160,7 +157,7 @@ func (client *DomainsClient) BeginCreateOrUpdate(ctx context.Context, resourceGr // CreateOrUpdate - Add a new Domains resource under the parent EmailService resource or update an existing Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *DomainsClient) createOrUpdate(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters DomainResource, options *DomainsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DomainsClient.BeginCreateOrUpdate" @@ -183,7 +180,7 @@ func (client *DomainsClient) createOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters DomainResource, options *DomainsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters DomainResource, _ *DomainsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -206,7 +203,7 @@ func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -218,7 +215,7 @@ func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, re // BeginDelete - Operation to delete a Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -244,7 +241,7 @@ func (client *DomainsClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Operation to delete a Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *DomainsClient) deleteOperation(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, options *DomainsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DomainsClient.BeginDelete" @@ -267,7 +264,7 @@ func (client *DomainsClient) deleteOperation(ctx context.Context, resourceGroupN } // deleteCreateRequest creates the Delete request. -func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, options *DomainsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, _ *DomainsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -290,7 +287,7 @@ func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,7 +296,7 @@ func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get the Domains resource and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -327,7 +324,7 @@ func (client *DomainsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, options *DomainsClientGetOptions) (*policy.Request, error) { +func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, _ *DomainsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -350,7 +347,7 @@ func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -368,7 +365,7 @@ func (client *DomainsClient) getHandleResponse(resp *http.Response) (DomainsClie // BeginInitiateVerification - Initiate verification of DNS record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -396,7 +393,7 @@ func (client *DomainsClient) BeginInitiateVerification(ctx context.Context, reso // InitiateVerification - Initiate verification of DNS record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *DomainsClient) initiateVerification(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, options *DomainsClientBeginInitiateVerificationOptions) (*http.Response, error) { var err error const operationName = "DomainsClient.BeginInitiateVerification" @@ -419,7 +416,7 @@ func (client *DomainsClient) initiateVerification(ctx context.Context, resourceG } // initiateVerificationCreateRequest creates the InitiateVerification request. -func (client *DomainsClient) initiateVerificationCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, options *DomainsClientBeginInitiateVerificationOptions) (*policy.Request, error) { +func (client *DomainsClient) initiateVerificationCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters VerificationParameter, _ *DomainsClientBeginInitiateVerificationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/initiateVerification" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -442,7 +439,7 @@ func (client *DomainsClient) initiateVerificationCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -453,7 +450,7 @@ func (client *DomainsClient) initiateVerificationCreateRequest(ctx context.Conte // NewListByEmailServiceResourcePager - Handles requests to list all Domains resources under the parent EmailServices resource. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - options - DomainsClientListByEmailServiceResourceOptions contains the optional parameters for the DomainsClient.NewListByEmailServiceResourcePager @@ -482,7 +479,7 @@ func (client *DomainsClient) NewListByEmailServiceResourcePager(resourceGroupNam } // listByEmailServiceResourceCreateRequest creates the ListByEmailServiceResource request. -func (client *DomainsClient) listByEmailServiceResourceCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, options *DomainsClientListByEmailServiceResourceOptions) (*policy.Request, error) { +func (client *DomainsClient) listByEmailServiceResourceCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, _ *DomainsClientListByEmailServiceResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -501,7 +498,7 @@ func (client *DomainsClient) listByEmailServiceResourceCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -519,7 +516,7 @@ func (client *DomainsClient) listByEmailServiceResourceHandleResponse(resp *http // BeginUpdate - Operation to update an existing Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -546,7 +543,7 @@ func (client *DomainsClient) BeginUpdate(ctx context.Context, resourceGroupName // Update - Operation to update an existing Domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *DomainsClient) update(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters UpdateDomainRequestParameters, options *DomainsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DomainsClient.BeginUpdate" @@ -569,7 +566,7 @@ func (client *DomainsClient) update(ctx context.Context, resourceGroupName strin } // updateCreateRequest creates the Update request. -func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters UpdateDomainRequestParameters, options *DomainsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters UpdateDomainRequestParameters, _ *DomainsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -592,7 +589,7 @@ func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/communication/armcommunication/domains_client_example_test.go b/sdk/resourcemanager/communication/armcommunication/domains_client_example_test.go deleted file mode 100644 index eaa5e636e716..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/domains_client_example_test.go +++ /dev/null @@ -1,322 +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 armcommunication_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/communication/armcommunication/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/get.json -func ExampleDomainsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDomainsClient().Get(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", 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.DomainResource = armcommunication.DomainResource{ - // Name: to.Ptr("mydomain.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource/Domains/mydomain.com"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.DomainProperties{ - // DataLocation: to.Ptr("United States"), - // DomainManagement: to.Ptr(armcommunication.DomainManagementCustomerManaged), - // FromSenderDomain: to.Ptr("mydomain.com"), - // MailFromSenderDomain: to.Ptr("mydomain.com"), - // ProvisioningState: to.Ptr(armcommunication.DomainsProvisioningStateSucceeded), - // UserEngagementTracking: to.Ptr(armcommunication.UserEngagementTrackingDisabled), - // VerificationRecords: &armcommunication.DomainPropertiesVerificationRecords{ - // Domain: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // }, - // VerificationStates: &armcommunication.DomainPropertiesVerificationStates{ - // Domain: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusVerified), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/createOrUpdate.json -func ExampleDomainsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDomainsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", armcommunication.DomainResource{ - Location: to.Ptr("Global"), - Properties: &armcommunication.DomainProperties{ - DomainManagement: to.Ptr(armcommunication.DomainManagementCustomerManaged), - }, - }, 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.DomainResource = armcommunication.DomainResource{ - // Name: to.Ptr("mydomain.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource/Domains/mydomain.com"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.DomainProperties{ - // DataLocation: to.Ptr("United States"), - // DomainManagement: to.Ptr(armcommunication.DomainManagementCustomerManaged), - // FromSenderDomain: to.Ptr("mydomain.com"), - // MailFromSenderDomain: to.Ptr("mydomain.com"), - // ProvisioningState: to.Ptr(armcommunication.DomainsProvisioningStateSucceeded), - // UserEngagementTracking: to.Ptr(armcommunication.UserEngagementTrackingDisabled), - // VerificationRecords: &armcommunication.DomainPropertiesVerificationRecords{ - // Domain: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // }, - // VerificationStates: &armcommunication.DomainPropertiesVerificationStates{ - // Domain: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusNotStarted), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/delete.json -func ExampleDomainsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDomainsClient().BeginDelete(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", 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/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/update.json -func ExampleDomainsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDomainsClient().BeginUpdate(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", armcommunication.UpdateDomainRequestParameters{ - Properties: &armcommunication.UpdateDomainProperties{ - UserEngagementTracking: to.Ptr(armcommunication.UserEngagementTrackingEnabled), - }, - }, 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.DomainResource = armcommunication.DomainResource{ - // Name: to.Ptr("mydomain.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource/Domains/mydomain.com"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.DomainProperties{ - // DataLocation: to.Ptr("United States"), - // DomainManagement: to.Ptr(armcommunication.DomainManagementCustomerManaged), - // FromSenderDomain: to.Ptr("mydomain.com"), - // MailFromSenderDomain: to.Ptr("mydomain.com"), - // ProvisioningState: to.Ptr(armcommunication.DomainsProvisioningStateSucceeded), - // UserEngagementTracking: to.Ptr(armcommunication.UserEngagementTrackingEnabled), - // VerificationRecords: &armcommunication.DomainPropertiesVerificationRecords{ - // Domain: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // SPF: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // }, - // VerificationStates: &armcommunication.DomainPropertiesVerificationStates{ - // Domain: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusVerified), - // }, - // SPF: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusNotStarted), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/listByEmailService.json -func ExampleDomainsClient_NewListByEmailServiceResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDomainsClient().NewListByEmailServiceResourcePager("MyResourceGroup", "MyEmailServiceResource", 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.DomainResourceList = armcommunication.DomainResourceList{ - // Value: []*armcommunication.DomainResource{ - // { - // Name: to.Ptr("mydomain.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource/Domains/mydomain.com"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.DomainProperties{ - // DataLocation: to.Ptr("United States"), - // DomainManagement: to.Ptr(armcommunication.DomainManagementCustomerManaged), - // FromSenderDomain: to.Ptr("mydomain.com"), - // MailFromSenderDomain: to.Ptr("mydomain.com"), - // ProvisioningState: to.Ptr(armcommunication.DomainsProvisioningStateSucceeded), - // VerificationRecords: &armcommunication.DomainPropertiesVerificationRecords{ - // Domain: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // SPF: &armcommunication.DNSRecord{ - // Name: to.Ptr("recordName"), - // Type: to.Ptr("TXT"), - // TTL: to.Ptr[int32](3600), - // Value: to.Ptr("recordValue"), - // }, - // }, - // VerificationStates: &armcommunication.DomainPropertiesVerificationStates{ - // Domain: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusVerified), - // }, - // SPF: &armcommunication.VerificationStatusRecord{ - // ErrorCode: to.Ptr(""), - // Status: to.Ptr(armcommunication.VerificationStatusNotStarted), - // }, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/initiateVerification.json -func ExampleDomainsClient_BeginInitiateVerification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDomainsClient().BeginInitiateVerification(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", armcommunication.VerificationParameter{ - VerificationType: to.Ptr(armcommunication.VerificationTypeSPF), - }, 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/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/domains/cancelVerification.json -func ExampleDomainsClient_BeginCancelVerification() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDomainsClient().BeginCancelVerification(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", armcommunication.VerificationParameter{ - VerificationType: to.Ptr(armcommunication.VerificationTypeSPF), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/communication/armcommunication/emailservices_client.go b/sdk/resourcemanager/communication/armcommunication/emailservices_client.go index a35f41004bee..c4fa014b859f 100644 --- a/sdk/resourcemanager/communication/armcommunication/emailservices_client.go +++ b/sdk/resourcemanager/communication/armcommunication/emailservices_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewEmailServicesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create a new EmailService or update an existing EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - parameters - Parameters for the create or update operation @@ -73,7 +70,7 @@ func (client *EmailServicesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create a new EmailService or update an existing EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *EmailServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResource, options *EmailServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "EmailServicesClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *EmailServicesClient) createOrUpdate(ctx context.Context, resourceG } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EmailServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResource, options *EmailServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *EmailServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResource, _ *EmailServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *EmailServicesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -127,7 +124,7 @@ func (client *EmailServicesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Operation to delete a EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - options - EmailServicesClientBeginDeleteOptions contains the optional parameters for the EmailServicesClient.BeginDelete @@ -153,7 +150,7 @@ func (client *EmailServicesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Operation to delete a EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *EmailServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, emailServiceName string, options *EmailServicesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "EmailServicesClient.BeginDelete" @@ -176,7 +173,7 @@ func (client *EmailServicesClient) deleteOperation(ctx context.Context, resource } // deleteCreateRequest creates the Delete request. -func (client *EmailServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, options *EmailServicesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *EmailServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, _ *EmailServicesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +192,7 @@ func (client *EmailServicesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +201,7 @@ func (client *EmailServicesClient) deleteCreateRequest(ctx context.Context, reso // Get - Get the EmailService and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - options - EmailServicesClientGetOptions contains the optional parameters for the EmailServicesClient.Get method. @@ -231,7 +228,7 @@ func (client *EmailServicesClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *EmailServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, options *EmailServicesClientGetOptions) (*policy.Request, error) { +func (client *EmailServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, _ *EmailServicesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -250,7 +247,7 @@ func (client *EmailServicesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +264,7 @@ func (client *EmailServicesClient) getHandleResponse(resp *http.Response) (Email // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - EmailServicesClientListByResourceGroupOptions contains the optional parameters for the EmailServicesClient.NewListByResourceGroupPager // method. @@ -295,7 +292,7 @@ func (client *EmailServicesClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *EmailServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *EmailServicesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *EmailServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EmailServicesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -310,7 +307,7 @@ func (client *EmailServicesClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +324,7 @@ func (client *EmailServicesClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - options - EmailServicesClientListBySubscriptionOptions contains the optional parameters for the EmailServicesClient.NewListBySubscriptionPager // method. func (client *EmailServicesClient) NewListBySubscriptionPager(options *EmailServicesClientListBySubscriptionOptions) *runtime.Pager[EmailServicesClientListBySubscriptionResponse] { @@ -354,7 +351,7 @@ func (client *EmailServicesClient) NewListBySubscriptionPager(options *EmailServ } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *EmailServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *EmailServicesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *EmailServicesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EmailServicesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,7 +362,7 @@ func (client *EmailServicesClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,7 +380,7 @@ func (client *EmailServicesClient) listBySubscriptionHandleResponse(resp *http.R // ListVerifiedExchangeOnlineDomains - Get a list of domains that are fully verified in Exchange Online. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - options - EmailServicesClientListVerifiedExchangeOnlineDomainsOptions contains the optional parameters for the EmailServicesClient.ListVerifiedExchangeOnlineDomains // method. func (client *EmailServicesClient) ListVerifiedExchangeOnlineDomains(ctx context.Context, options *EmailServicesClientListVerifiedExchangeOnlineDomainsOptions) (EmailServicesClientListVerifiedExchangeOnlineDomainsResponse, error) { @@ -409,7 +406,7 @@ func (client *EmailServicesClient) ListVerifiedExchangeOnlineDomains(ctx context } // listVerifiedExchangeOnlineDomainsCreateRequest creates the ListVerifiedExchangeOnlineDomains request. -func (client *EmailServicesClient) listVerifiedExchangeOnlineDomainsCreateRequest(ctx context.Context, options *EmailServicesClientListVerifiedExchangeOnlineDomainsOptions) (*policy.Request, error) { +func (client *EmailServicesClient) listVerifiedExchangeOnlineDomainsCreateRequest(ctx context.Context, _ *EmailServicesClientListVerifiedExchangeOnlineDomainsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -420,7 +417,7 @@ func (client *EmailServicesClient) listVerifiedExchangeOnlineDomainsCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -438,7 +435,7 @@ func (client *EmailServicesClient) listVerifiedExchangeOnlineDomainsHandleRespon // BeginUpdate - Operation to update an existing EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - parameters - Parameters for the update operation @@ -465,7 +462,7 @@ func (client *EmailServicesClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Operation to update an existing EmailService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *EmailServicesClient) update(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResourceUpdate, options *EmailServicesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "EmailServicesClient.BeginUpdate" @@ -488,7 +485,7 @@ func (client *EmailServicesClient) update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *EmailServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResourceUpdate, options *EmailServicesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *EmailServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, parameters EmailServiceResourceUpdate, _ *EmailServicesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -507,7 +504,7 @@ func (client *EmailServicesClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/communication/armcommunication/emailservices_client_example_test.go b/sdk/resourcemanager/communication/armcommunication/emailservices_client_example_test.go deleted file mode 100644 index 1fd10ce65c14..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/emailservices_client_example_test.go +++ /dev/null @@ -1,249 +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 armcommunication_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/communication/armcommunication/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/get.json -func ExampleEmailServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailServicesClient().Get(ctx, "MyResourceGroup", "MyEmailServiceResource", 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.EmailServiceResource = armcommunication.EmailServiceResource{ - // Name: to.Ptr("MyEmailServiceResource"), - // Type: to.Ptr("Microsoft.Communication/EmailServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.EmailServiceProperties{ - // DataLocation: to.Ptr("United States"), - // ProvisioningState: to.Ptr(armcommunication.EmailServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/createOrUpdate.json -func ExampleEmailServicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEmailServicesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyEmailServiceResource", armcommunication.EmailServiceResource{ - Location: to.Ptr("Global"), - Properties: &armcommunication.EmailServiceProperties{ - DataLocation: to.Ptr("United States"), - }, - }, 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.EmailServiceResource = armcommunication.EmailServiceResource{ - // Name: to.Ptr("MyEmailServiceResource"), - // Type: to.Ptr("Microsoft.Communication/EmailServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.EmailServiceProperties{ - // DataLocation: to.Ptr("United States"), - // ProvisioningState: to.Ptr(armcommunication.EmailServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/delete.json -func ExampleEmailServicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEmailServicesClient().BeginDelete(ctx, "MyResourceGroup", "MyEmailServiceResource", 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/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/update.json -func ExampleEmailServicesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEmailServicesClient().BeginUpdate(ctx, "MyResourceGroup", "MyEmailServiceResource", armcommunication.EmailServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - }, 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.EmailServiceResource = armcommunication.EmailServiceResource{ - // Name: to.Ptr("MyEmailServiceResource"), - // Type: to.Ptr("Microsoft.Communication/EmailServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Properties: &armcommunication.EmailServiceProperties{ - // DataLocation: to.Ptr("United States"), - // ProvisioningState: to.Ptr(armcommunication.EmailServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/listBySubscription.json -func ExampleEmailServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEmailServicesClient().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.EmailServiceResourceList = armcommunication.EmailServiceResourceList{ - // Value: []*armcommunication.EmailServiceResource{ - // { - // Name: to.Ptr("MyEmailServiceResource"), - // Type: to.Ptr("Microsoft.Communication/EmailServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.EmailServiceProperties{ - // DataLocation: to.Ptr("United States"), - // ProvisioningState: to.Ptr(armcommunication.EmailServicesProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/listByResourceGroup.json -func ExampleEmailServicesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEmailServicesClient().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.EmailServiceResourceList = armcommunication.EmailServiceResourceList{ - // Value: []*armcommunication.EmailServiceResource{ - // { - // Name: to.Ptr("MyEmailServiceResource"), - // Type: to.Ptr("Microsoft.Communication/EmailServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/EmailServices/MyEmailServiceResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.EmailServiceProperties{ - // DataLocation: to.Ptr("United States"), - // ProvisioningState: to.Ptr(armcommunication.EmailServicesProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/emailServices/getVerifiedExchangeOnlineDomains.json -func ExampleEmailServicesClient_ListVerifiedExchangeOnlineDomains() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailServicesClient().ListVerifiedExchangeOnlineDomains(ctx, 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.StringArray = []*string{ - // to.Ptr("example.com"), - // to.Ptr("contoso.com")} -} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/domains_server.go b/sdk/resourcemanager/communication/armcommunication/fake/domains_server.go index 01cd8e3ba4be..1e78ab7853c5 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/domains_server.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/domains_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -25,7 +22,7 @@ import ( // DomainsServer is a fake server for instances of the armcommunication.DomainsClient type. type DomainsServer struct { // BeginCancelVerification is the fake for method DomainsClient.BeginCancelVerification - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCancelVerification func(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters armcommunication.VerificationParameter, options *armcommunication.DomainsClientBeginCancelVerificationOptions) (resp azfake.PollerResponder[armcommunication.DomainsClientCancelVerificationResponse], errResp azfake.ErrorResponder) // BeginCreateOrUpdate is the fake for method DomainsClient.BeginCreateOrUpdate @@ -41,7 +38,7 @@ type DomainsServer struct { Get func(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, options *armcommunication.DomainsClientGetOptions) (resp azfake.Responder[armcommunication.DomainsClientGetResponse], errResp azfake.ErrorResponder) // BeginInitiateVerification is the fake for method DomainsClient.BeginInitiateVerification - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginInitiateVerification func(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, parameters armcommunication.VerificationParameter, options *armcommunication.DomainsClientBeginInitiateVerificationOptions) (resp azfake.PollerResponder[armcommunication.DomainsClientInitiateVerificationResponse], errResp azfake.ErrorResponder) // NewListByEmailServiceResourcePager is the fake for method DomainsClient.NewListByEmailServiceResourcePager @@ -88,33 +85,52 @@ func (d *DomainsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "DomainsClient.BeginCancelVerification": - resp, err = d.dispatchBeginCancelVerification(req) - case "DomainsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DomainsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DomainsClient.Get": - resp, err = d.dispatchGet(req) - case "DomainsClient.BeginInitiateVerification": - resp, err = d.dispatchBeginInitiateVerification(req) - case "DomainsClient.NewListByEmailServiceResourcePager": - resp, err = d.dispatchNewListByEmailServiceResourcePager(req) - case "DomainsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return d.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (d *DomainsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if domainsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = domainsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DomainsClient.BeginCancelVerification": + res.resp, res.err = d.dispatchBeginCancelVerification(req) + case "DomainsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DomainsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DomainsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DomainsClient.BeginInitiateVerification": + res.resp, res.err = d.dispatchBeginInitiateVerification(req) + case "DomainsClient.NewListByEmailServiceResourcePager": + res.resp, res.err = d.dispatchNewListByEmailServiceResourcePager(req) + case "DomainsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (d *DomainsServerTransport) dispatchBeginCancelVerification(req *http.Request) (*http.Response, error) { @@ -158,9 +174,9 @@ func (d *DomainsServerTransport) dispatchBeginCancelVerification(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginCancelVerification.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginCancelVerification) { d.beginCancelVerification.remove(req) @@ -347,9 +363,9 @@ func (d *DomainsServerTransport) dispatchBeginInitiateVerification(req *http.Req return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginInitiateVerification.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginInitiateVerification) { d.beginInitiateVerification.remove(req) @@ -450,3 +466,9 @@ func (d *DomainsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.R return resp, nil } + +// set this to conditionally intercept incoming requests to DomainsServerTransport +var domainsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/emailservices_server.go b/sdk/resourcemanager/communication/armcommunication/fake/emailservices_server.go index 6eaa8e5156e3..ed88366fd804 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/emailservices_server.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/emailservices_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -86,33 +83,52 @@ func (e *EmailServicesServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "EmailServicesClient.BeginCreateOrUpdate": - resp, err = e.dispatchBeginCreateOrUpdate(req) - case "EmailServicesClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "EmailServicesClient.Get": - resp, err = e.dispatchGet(req) - case "EmailServicesClient.NewListByResourceGroupPager": - resp, err = e.dispatchNewListByResourceGroupPager(req) - case "EmailServicesClient.NewListBySubscriptionPager": - resp, err = e.dispatchNewListBySubscriptionPager(req) - case "EmailServicesClient.ListVerifiedExchangeOnlineDomains": - resp, err = e.dispatchListVerifiedExchangeOnlineDomains(req) - case "EmailServicesClient.BeginUpdate": - resp, err = e.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return e.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (e *EmailServicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if emailServicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = emailServicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmailServicesClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EmailServicesClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EmailServicesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmailServicesClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EmailServicesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EmailServicesClient.ListVerifiedExchangeOnlineDomains": + res.resp, res.err = e.dispatchListVerifiedExchangeOnlineDomains(req) + case "EmailServicesClient.BeginUpdate": + res.resp, res.err = e.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *EmailServicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -382,3 +398,9 @@ func (e *EmailServicesServerTransport) dispatchBeginUpdate(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to EmailServicesServerTransport +var emailServicesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/internal.go b/sdk/resourcemanager/communication/armcommunication/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/internal.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/internal.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -14,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/communication/armcommunication/fake/operations_server.go b/sdk/resourcemanager/communication/armcommunication/fake/operations_server.go index 86bd8d0c1a19..0969236adce4 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/operations_server.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/operations_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -51,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/senderusernames_server.go b/sdk/resourcemanager/communication/armcommunication/fake/senderusernames_server.go index f2576a0f3cfc..665727a9bac1 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/senderusernames_server.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/senderusernames_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -66,27 +63,46 @@ func (s *SenderUsernamesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SenderUsernamesClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "SenderUsernamesClient.Delete": - resp, err = s.dispatchDelete(req) - case "SenderUsernamesClient.Get": - resp, err = s.dispatchGet(req) - case "SenderUsernamesClient.NewListByDomainsPager": - resp, err = s.dispatchNewListByDomainsPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SenderUsernamesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if senderUsernamesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = senderUsernamesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SenderUsernamesClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SenderUsernamesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SenderUsernamesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SenderUsernamesClient.NewListByDomainsPager": + res.resp, res.err = s.dispatchNewListByDomainsPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SenderUsernamesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -260,3 +276,9 @@ func (s *SenderUsernamesServerTransport) dispatchNewListByDomainsPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to SenderUsernamesServerTransport +var senderUsernamesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/server_factory.go b/sdk/resourcemanager/communication/armcommunication/fake/server_factory.go index 17f483494d4d..a2ec547d7a99 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/server_factory.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/server_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -19,11 +16,20 @@ import ( // ServerFactory is a fake server for instances of the armcommunication.ClientFactory type. type ServerFactory struct { - DomainsServer DomainsServer - EmailServicesServer EmailServicesServer - OperationsServer OperationsServer + // DomainsServer contains the fakes for client DomainsClient + DomainsServer DomainsServer + + // EmailServicesServer contains the fakes for client EmailServicesClient + EmailServicesServer EmailServicesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // SenderUsernamesServer contains the fakes for client SenderUsernamesClient SenderUsernamesServer SenderUsernamesServer - ServicesServer ServicesServer + + // ServicesServer contains the fakes for client ServicesClient + ServicesServer ServicesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/communication/armcommunication/fake/services_server.go b/sdk/resourcemanager/communication/armcommunication/fake/services_server.go index f7a8a7836654..477921e105a1 100644 --- a/sdk/resourcemanager/communication/armcommunication/fake/services_server.go +++ b/sdk/resourcemanager/communication/armcommunication/fake/services_server.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -97,39 +94,58 @@ func (s *ServicesServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ServicesClient.CheckNameAvailability": - resp, err = s.dispatchCheckNameAvailability(req) - case "ServicesClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "ServicesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ServicesClient.Get": - resp, err = s.dispatchGet(req) - case "ServicesClient.LinkNotificationHub": - resp, err = s.dispatchLinkNotificationHub(req) - case "ServicesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "ServicesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "ServicesClient.ListKeys": - resp, err = s.dispatchListKeys(req) - case "ServicesClient.RegenerateKey": - resp, err = s.dispatchRegenerateKey(req) - case "ServicesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *ServicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if servicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = servicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServicesClient.CheckNameAvailability": + res.resp, res.err = s.dispatchCheckNameAvailability(req) + case "ServicesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "ServicesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ServicesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServicesClient.LinkNotificationHub": + res.resp, res.err = s.dispatchLinkNotificationHub(req) + case "ServicesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "ServicesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "ServicesClient.ListKeys": + res.resp, res.err = s.dispatchListKeys(req) + case "ServicesClient.RegenerateKey": + res.resp, res.err = s.dispatchRegenerateKey(req) + case "ServicesClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ServicesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -505,3 +521,9 @@ func (s *ServicesServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to ServicesServerTransport +var servicesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/communication/armcommunication/fake/time_rfc3339.go b/sdk/resourcemanager/communication/armcommunication/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// 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+)*"*$`) - -const ( - 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 - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - 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 { - 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)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - 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 - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/communication/armcommunication/go.mod b/sdk/resourcemanager/communication/armcommunication/go.mod index a17ad43acc51..2258cd83d7a5 100644 --- a/sdk/resourcemanager/communication/armcommunication/go.mod +++ b/sdk/resourcemanager/communication/armcommunication/go.mod @@ -4,13 +4,13 @@ go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.10.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/communication/armcommunication/models.go b/sdk/resourcemanager/communication/armcommunication/models.go index 3d71ce0651c1..5a486211729b 100644 --- a/sdk/resourcemanager/communication/armcommunication/models.go +++ b/sdk/resourcemanager/communication/armcommunication/models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -417,6 +414,9 @@ type ServiceProperties struct { // REQUIRED; The location where the communication service stores its data at rest. DataLocation *string + // Disable local authentication for the CommunicationService. + DisableLocalAuth *bool + // List of email Domain resource Ids. LinkedDomains []*string diff --git a/sdk/resourcemanager/communication/armcommunication/models_serde.go b/sdk/resourcemanager/communication/armcommunication/models_serde.go index e684c2441df9..a9ccab9ccc6d 100644 --- a/sdk/resourcemanager/communication/armcommunication/models_serde.go +++ b/sdk/resourcemanager/communication/armcommunication/models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -1086,6 +1083,7 @@ func (s *ServiceKeys) UnmarshalJSON(data []byte) error { func (s ServiceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "dataLocation", s.DataLocation) + populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) populate(objectMap, "hostName", s.HostName) populate(objectMap, "immutableResourceId", s.ImmutableResourceID) populate(objectMap, "linkedDomains", s.LinkedDomains) @@ -1107,6 +1105,9 @@ func (s *ServiceProperties) UnmarshalJSON(data []byte) error { case "dataLocation": err = unpopulate(val, "DataLocation", &s.DataLocation) delete(rawMsg, key) + case "disableLocalAuth": + err = unpopulate(val, "DisableLocalAuth", &s.DisableLocalAuth) + delete(rawMsg, key) case "hostName": err = unpopulate(val, "HostName", &s.HostName) delete(rawMsg, key) diff --git a/sdk/resourcemanager/communication/armcommunication/operations_client.go b/sdk/resourcemanager/communication/armcommunication/operations_client.go index 2b8096a99730..5cdc7b0f9a53 100644 --- a/sdk/resourcemanager/communication/armcommunication/operations_client.go +++ b/sdk/resourcemanager/communication/armcommunication/operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all of the available REST API operations of the Microsoft.Communication provider. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Communication/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/communication/armcommunication/operations_client_example_test.go b/sdk/resourcemanager/communication/armcommunication/operations_client_example_test.go deleted file mode 100644 index 8f181e5f7f41..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/operations_client_example_test.go +++ /dev/null @@ -1,56 +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 armcommunication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/communication/armcommunication/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/operationsList.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.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 = armcommunication.OperationListResult{ - // Value: []*armcommunication.Operation{ - // { - // Name: to.Ptr(""), - // Display: &armcommunication.OperationDisplay{ - // Description: to.Ptr(""), - // Operation: to.Ptr(""), - // Provider: to.Ptr(""), - // Resource: to.Ptr(""), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/communication/armcommunication/options.go b/sdk/resourcemanager/communication/armcommunication/options.go index 383564f06879..4d533783c116 100644 --- a/sdk/resourcemanager/communication/armcommunication/options.go +++ b/sdk/resourcemanager/communication/armcommunication/options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -11,32 +8,32 @@ package armcommunication // DomainsClientBeginCancelVerificationOptions contains the optional parameters for the DomainsClient.BeginCancelVerification // method. type DomainsClientBeginCancelVerificationOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DomainsClientBeginCreateOrUpdateOptions contains the optional parameters for the DomainsClient.BeginCreateOrUpdate method. type DomainsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DomainsClientBeginDeleteOptions contains the optional parameters for the DomainsClient.BeginDelete method. type DomainsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DomainsClientBeginInitiateVerificationOptions contains the optional parameters for the DomainsClient.BeginInitiateVerification // method. type DomainsClientBeginInitiateVerificationOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DomainsClientBeginUpdateOptions contains the optional parameters for the DomainsClient.BeginUpdate method. type DomainsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -54,19 +51,19 @@ type DomainsClientListByEmailServiceResourceOptions struct { // EmailServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmailServicesClient.BeginCreateOrUpdate // method. type EmailServicesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // EmailServicesClientBeginDeleteOptions contains the optional parameters for the EmailServicesClient.BeginDelete method. type EmailServicesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // EmailServicesClientBeginUpdateOptions contains the optional parameters for the EmailServicesClient.BeginUpdate method. type EmailServicesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -122,13 +119,13 @@ type SenderUsernamesClientListByDomainsOptions struct { // ServicesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServicesClient.BeginCreateOrUpdate method. type ServicesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServicesClientBeginDeleteOptions contains the optional parameters for the ServicesClient.BeginDelete method. type ServicesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/communication/armcommunication/responses.go b/sdk/resourcemanager/communication/armcommunication/responses.go index 82803f8cbad0..15a835958f5d 100644 --- a/sdk/resourcemanager/communication/armcommunication/responses.go +++ b/sdk/resourcemanager/communication/armcommunication/responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. diff --git a/sdk/resourcemanager/communication/armcommunication/senderusernames_client.go b/sdk/resourcemanager/communication/armcommunication/senderusernames_client.go index 17789d3b4793..a319f2bfc788 100644 --- a/sdk/resourcemanager/communication/armcommunication/senderusernames_client.go +++ b/sdk/resourcemanager/communication/armcommunication/senderusernames_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -47,7 +44,7 @@ func NewSenderUsernamesClient(subscriptionID string, credential azcore.TokenCred // resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -78,7 +75,7 @@ func (client *SenderUsernamesClient) CreateOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SenderUsernamesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, parameters SenderUsernameResource, options *SenderUsernamesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SenderUsernamesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, parameters SenderUsernameResource, _ *SenderUsernamesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -105,7 +102,7 @@ func (client *SenderUsernamesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -126,7 +123,7 @@ func (client *SenderUsernamesClient) createOrUpdateHandleResponse(resp *http.Res // Delete - Operation to delete a SenderUsernames resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -154,7 +151,7 @@ func (client *SenderUsernamesClient) Delete(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *SenderUsernamesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, options *SenderUsernamesClientDeleteOptions) (*policy.Request, error) { +func (client *SenderUsernamesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, _ *SenderUsernamesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -181,7 +178,7 @@ func (client *SenderUsernamesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +187,7 @@ func (client *SenderUsernamesClient) deleteCreateRequest(ctx context.Context, re // Get - Get a valid sender username for a domains resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -219,7 +216,7 @@ func (client *SenderUsernamesClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *SenderUsernamesClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, options *SenderUsernamesClientGetOptions) (*policy.Request, error) { +func (client *SenderUsernamesClient) getCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, senderUsername string, _ *SenderUsernamesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -246,7 +243,7 @@ func (client *SenderUsernamesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +260,7 @@ func (client *SenderUsernamesClient) getHandleResponse(resp *http.Response) (Sen // NewListByDomainsPager - List all valid sender usernames for a domains resource. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - emailServiceName - The name of the EmailService resource. // - domainName - The name of the Domains resource. @@ -293,7 +290,7 @@ func (client *SenderUsernamesClient) NewListByDomainsPager(resourceGroupName str } // listByDomainsCreateRequest creates the ListByDomains request. -func (client *SenderUsernamesClient) listByDomainsCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, options *SenderUsernamesClientListByDomainsOptions) (*policy.Request, error) { +func (client *SenderUsernamesClient) listByDomainsCreateRequest(ctx context.Context, resourceGroupName string, emailServiceName string, domainName string, _ *SenderUsernamesClientListByDomainsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -316,7 +313,7 @@ func (client *SenderUsernamesClient) listByDomainsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/communication/armcommunication/senderusernames_client_example_test.go b/sdk/resourcemanager/communication/armcommunication/senderusernames_client_example_test.go deleted file mode 100644 index 4c9f332ca514..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/senderusernames_client_example_test.go +++ /dev/null @@ -1,149 +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 armcommunication_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/communication/armcommunication/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/listByDomain.json -func ExampleSenderUsernamesClient_NewListByDomainsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSenderUsernamesClient().NewListByDomainsPager("contosoResourceGroup", "contosoEmailService", "contoso.com", 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.SenderUsernameResourceCollection = armcommunication.SenderUsernameResourceCollection{ - // Value: []*armcommunication.SenderUsernameResource{ - // { - // Name: to.Ptr("contosoNews"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SenderUsernames"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/senderUsernames/contosoNews"), - // Properties: &armcommunication.SenderUsernameProperties{ - // DataLocation: to.Ptr("United States"), - // DisplayName: to.Ptr("Contoso News"), - // Username: to.Ptr("contosoNews"), - // }, - // }, - // { - // Name: to.Ptr("contosoAlerts"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SenderUsernames"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/senderUsernames/contosoAlerts"), - // Properties: &armcommunication.SenderUsernameProperties{ - // DataLocation: to.Ptr("United States"), - // DisplayName: to.Ptr("Contoso Alerts"), - // Username: to.Ptr("contosoAlerts"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/get.json -func ExampleSenderUsernamesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSenderUsernamesClient().Get(ctx, "contosoResourceGroup", "contosoEmailService", "contoso.com", "contosoNewsAlerts", 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.SenderUsernameResource = armcommunication.SenderUsernameResource{ - // Name: to.Ptr("contoso.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SenderUsernames"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/senderUsernames/contosoNewsAlerts"), - // Properties: &armcommunication.SenderUsernameProperties{ - // DataLocation: to.Ptr("United States"), - // DisplayName: to.Ptr("Contoso News Alerts"), - // Username: to.Ptr("contosoNewsAlerts"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/createOrUpdate.json -func ExampleSenderUsernamesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSenderUsernamesClient().CreateOrUpdate(ctx, "contosoResourceGroup", "contosoEmailService", "contoso.com", "contosoNewsAlerts", armcommunication.SenderUsernameResource{ - Properties: &armcommunication.SenderUsernameProperties{ - DisplayName: to.Ptr("Contoso News Alerts"), - Username: to.Ptr("contosoNewsAlerts"), - }, - }, 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.SenderUsernameResource = armcommunication.SenderUsernameResource{ - // Name: to.Ptr("contoso.com"), - // Type: to.Ptr("Microsoft.Communication/EmailServices/Domains"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/senderUsernames/contosoNewsAlerts"), - // Properties: &armcommunication.SenderUsernameProperties{ - // DataLocation: to.Ptr("United States"), - // DisplayName: to.Ptr("Contoso News Alerts"), - // Username: to.Ptr("contosoNewsAlerts"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/senderUsernames/delete.json -func ExampleSenderUsernamesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSenderUsernamesClient().Delete(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", "contosoNewsAlerts", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/communication/armcommunication/services_client.go b/sdk/resourcemanager/communication/armcommunication/services_client.go index 4ed6bdeb2e03..9e87c7a6b3d3 100644 --- a/sdk/resourcemanager/communication/armcommunication/services_client.go +++ b/sdk/resourcemanager/communication/armcommunication/services_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -46,7 +43,7 @@ func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, // CheckNameAvailability - Checks that the CommunicationService name is valid and is not already in use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - nameAvailabilityParameters - Parameters supplied to the operation. // - options - ServicesClientCheckNameAvailabilityOptions contains the optional parameters for the ServicesClient.CheckNameAvailability // method. @@ -73,7 +70,7 @@ func (client *ServicesClient) CheckNameAvailability(ctx context.Context, nameAva } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Context, nameAvailabilityParameters NameAvailabilityParameters, options *ServicesClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Context, nameAvailabilityParameters NameAvailabilityParameters, _ *ServicesClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -84,7 +81,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, nameAvailabilityParameters); err != nil { @@ -105,7 +102,7 @@ func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Res // BeginCreateOrUpdate - Create a new CommunicationService or update an existing CommunicationService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - parameters - Parameters for the create or update operation @@ -132,7 +129,7 @@ func (client *ServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a new CommunicationService or update an existing CommunicationService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResource, options *ServicesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.BeginCreateOrUpdate" @@ -155,7 +152,7 @@ func (client *ServicesClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResource, options *ServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResource, _ *ServicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -174,7 +171,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -186,7 +183,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Operation to delete a CommunicationService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - options - ServicesClientBeginDeleteOptions contains the optional parameters for the ServicesClient.BeginDelete method. @@ -211,7 +208,7 @@ func (client *ServicesClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Operation to delete a CommunicationService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 func (client *ServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServicesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ServicesClient.BeginDelete" @@ -234,7 +231,7 @@ func (client *ServicesClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServicesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, _ *ServicesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -253,7 +250,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +259,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get the CommunicationService and its properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - options - ServicesClientGetOptions contains the optional parameters for the ServicesClient.Get method. @@ -289,7 +286,7 @@ func (client *ServicesClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServicesClientGetOptions) (*policy.Request, error) { +func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, _ *ServicesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -308,7 +305,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +323,7 @@ func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesCl // LinkNotificationHub - Links an Azure Notification Hub to this communication service. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - options - ServicesClientLinkNotificationHubOptions contains the optional parameters for the ServicesClient.LinkNotificationHub @@ -373,7 +370,7 @@ func (client *ServicesClient) linkNotificationHubCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.LinkNotificationHubParameters != nil { @@ -396,7 +393,7 @@ func (client *ServicesClient) linkNotificationHubHandleResponse(resp *http.Respo // NewListByResourceGroupPager - Handles requests to list all resources in a resource group. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ServicesClientListByResourceGroupOptions contains the optional parameters for the ServicesClient.NewListByResourceGroupPager // method. @@ -424,7 +421,7 @@ func (client *ServicesClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ServicesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ServicesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -439,7 +436,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -456,7 +453,7 @@ func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - Handles requests to list all resources in a subscription. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - options - ServicesClientListBySubscriptionOptions contains the optional parameters for the ServicesClient.NewListBySubscriptionPager // method. func (client *ServicesClient) NewListBySubscriptionPager(options *ServicesClientListBySubscriptionOptions) *runtime.Pager[ServicesClientListBySubscriptionResponse] { @@ -483,7 +480,7 @@ func (client *ServicesClient) NewListBySubscriptionPager(options *ServicesClient } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ServicesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ServicesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -494,7 +491,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -512,7 +509,7 @@ func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Respon // ListKeys - Get the access keys of the CommunicationService resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - options - ServicesClientListKeysOptions contains the optional parameters for the ServicesClient.ListKeys method. @@ -539,7 +536,7 @@ func (client *ServicesClient) ListKeys(ctx context.Context, resourceGroupName st } // listKeysCreateRequest creates the ListKeys request. -func (client *ServicesClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, options *ServicesClientListKeysOptions) (*policy.Request, error) { +func (client *ServicesClient) listKeysCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, _ *ServicesClientListKeysOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -558,7 +555,7 @@ func (client *ServicesClient) listKeysCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -577,7 +574,7 @@ func (client *ServicesClient) listKeysHandleResponse(resp *http.Response) (Servi // time. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - parameters - Parameter that describes the Regenerate Key Operation. @@ -605,7 +602,7 @@ func (client *ServicesClient) RegenerateKey(ctx context.Context, resourceGroupNa } // regenerateKeyCreateRequest creates the RegenerateKey request. -func (client *ServicesClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters RegenerateKeyParameters, options *ServicesClientRegenerateKeyOptions) (*policy.Request, error) { +func (client *ServicesClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters RegenerateKeyParameters, _ *ServicesClientRegenerateKeyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -624,7 +621,7 @@ func (client *ServicesClient) regenerateKeyCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -645,7 +642,7 @@ func (client *ServicesClient) regenerateKeyHandleResponse(resp *http.Response) ( // Update - Operation to update an existing CommunicationService. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-01 +// Generated from API version 2025-06-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - communicationServiceName - The name of the CommunicationService resource. // - parameters - Parameters for the update operation @@ -673,7 +670,7 @@ func (client *ServicesClient) Update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResourceUpdate, options *ServicesClientUpdateOptions) (*policy.Request, error) { +func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, communicationServiceName string, parameters ServiceResourceUpdate, _ *ServicesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -692,7 +689,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-01") + reqQP.Set("api-version", "2025-06-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/communication/armcommunication/services_client_example_test.go b/sdk/resourcemanager/communication/armcommunication/services_client_example_test.go deleted file mode 100644 index da7c69d9d3a8..000000000000 --- a/sdk/resourcemanager/communication/armcommunication/services_client_example_test.go +++ /dev/null @@ -1,621 +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 armcommunication_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/communication/armcommunication/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/checkNameAvailabilityAvailable.json -func ExampleServicesClient_CheckNameAvailability_checkNameAvailabilityAvailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, armcommunication.NameAvailabilityParameters{ - Name: to.Ptr("MyCommunicationService"), - Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - }, 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.CheckNameAvailabilityResponse = armcommunication.CheckNameAvailabilityResponse{ - // Message: to.Ptr("Requested name is available for the requested type"), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr(armcommunication.CheckNameAvailabilityReason("NameAvailable")), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/checkNameAvailabilityUnavailable.json -func ExampleServicesClient_CheckNameAvailability_checkNameAvailabilityUnavailable() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().CheckNameAvailability(ctx, armcommunication.NameAvailabilityParameters{ - Name: to.Ptr("MyCommunicationService"), - Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - }, 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.CheckNameAvailabilityResponse = armcommunication.CheckNameAvailabilityResponse{ - // Message: to.Ptr("Requested name is unavailable for the requested type"), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armcommunication.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/linkNotificationHub.json -func ExampleServicesClient_LinkNotificationHub() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().LinkNotificationHub(ctx, "MyResourceGroup", "MyCommunicationResource", &armcommunication.ServicesClientLinkNotificationHubOptions{LinkNotificationHubParameters: &armcommunication.LinkNotificationHubParameters{ - ConnectionString: to.Ptr("Endpoint=sb://MyNamespace.servicebus.windows.net/;SharedAccessKey=abcd1234"), - ResourceID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub"), - }, - }) - 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.LinkedNotificationHub = armcommunication.LinkedNotificationHub{ - // ResourceID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyOtherResourceGroup/providers/Microsoft.NotificationHubs/namespaces/MyNamespace/notificationHubs/MyHub"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/listBySubscription.json -func ExampleServicesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().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.ServiceResourceList = armcommunication.ServiceResourceList{ - // Value: []*armcommunication.ServiceResource{ - // { - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationservice.comms.azure.net"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/listByResourceGroup.json -func ExampleServicesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServicesClient().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.ServiceResourceList = armcommunication.ServiceResourceList{ - // Value: []*armcommunication.ServiceResource{ - // { - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationservice.comms.azure.net"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/update.json -func ExampleServicesClient_Update_updateResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAndUserIdentity.json -func ExampleServicesClient_Update_updateResourceToAddSystemAndUserManagedIdentities() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - Identity: &armcommunication.ManagedServiceIdentity{ - Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{ - "/user/assigned/resource/id": {}, - }, - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{ - // "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{ - // ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"), - // PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"), - // }, - // }, - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithSystemAssignedIdentity.json -func ExampleServicesClient_Update_updateResourceToAddASystemAssignedManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - Identity: &armcommunication.ManagedServiceIdentity{ - Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned), - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateWithUserAssignedIdentity.json -func ExampleServicesClient_Update_updateResourceToAddAUserAssignedManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - Identity: &armcommunication.ManagedServiceIdentity{ - Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{ - "/user/assigned/resource/id": {}, - }, - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeUserAssigned), - // UserAssignedIdentities: map[string]*armcommunication.UserAssignedIdentity{ - // "/user/assigned/resource/id": &armcommunication.UserAssignedIdentity{ - // ClientID: to.Ptr("11112222-3333-4444-5555-666677778888"), - // PrincipalID: to.Ptr("11112222-3333-4444-5555-666677778888"), - // }, - // }, - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/updateRemoveSystemIdentity.json -func ExampleServicesClient_Update_updateResourceToRemoveIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Update(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResourceUpdate{ - Tags: map[string]*string{ - "newTag": to.Ptr("newVal"), - }, - Identity: &armcommunication.ManagedServiceIdentity{ - Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone), - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "newTag": to.Ptr("newVal"), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communication.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/get.json -func ExampleServicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().Get(ctx, "MyResourceGroup", "MyCommunicationResource", 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationservice.comms.azure.net"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // Version: to.Ptr("0.2.0"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/createOrUpdate.json -func ExampleServicesClient_BeginCreateOrUpdate_createOrUpdateResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResource{ - Location: to.Ptr("Global"), - Properties: &armcommunication.ServiceProperties{ - DataLocation: to.Ptr("United States"), - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeNone), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json -func ExampleServicesClient_BeginCreateOrUpdate_createOrUpdateResourceWithManagedIdentity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.ServiceResource{ - Location: to.Ptr("Global"), - Identity: &armcommunication.ManagedServiceIdentity{ - Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned), - }, - Properties: &armcommunication.ServiceProperties{ - DataLocation: to.Ptr("United States"), - }, - }, 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.ServiceResource = armcommunication.ServiceResource{ - // Name: to.Ptr("MyCommunicationResource"), - // Type: to.Ptr("Microsoft.Communication/CommunicationServices"), - // ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/MyResourceGroup/providers/Microsoft.Communication/CommunicationServices/MyCommunicationResource"), - // Location: to.Ptr("Global"), - // Identity: &armcommunication.ManagedServiceIdentity{ - // Type: to.Ptr(armcommunication.ManagedServiceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("22222222-2222-2222-2222-222222222222"), - // }, - // Properties: &armcommunication.ServiceProperties{ - // DataLocation: to.Ptr("United States"), - // HostName: to.Ptr("mycommunicationresource.communications.azure.com"), - // ProvisioningState: to.Ptr(armcommunication.CommunicationServicesProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/delete.json -func ExampleServicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServicesClient().BeginDelete(ctx, "MyResourceGroup", "MyCommunicationResource", 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/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/listKeys.json -func ExampleServicesClient_ListKeys() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().ListKeys(ctx, "MyResourceGroup", "MyCommunicationResource", 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.ServiceKeys = armcommunication.ServiceKeys{ - // PrimaryKey: to.Ptr(""), - // SecondaryKey: to.Ptr(""), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/cf5ad1932d00c7d15497705ad6b71171d3d68b1e/specification/communication/resource-manager/Microsoft.Communication/stable/2023-04-01/examples/communicationServices/regenerateKey.json -func ExampleServicesClient_RegenerateKey() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcommunication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServicesClient().RegenerateKey(ctx, "MyResourceGroup", "MyCommunicationResource", armcommunication.RegenerateKeyParameters{ - KeyType: to.Ptr(armcommunication.KeyTypePrimary), - }, 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.ServiceKeys = armcommunication.ServiceKeys{ - // PrimaryConnectionString: to.Ptr("endpoint=http://example.com;accesskey=1234"), - // PrimaryKey: to.Ptr("1234"), - // } -} diff --git a/sdk/resourcemanager/communication/armcommunication/time_rfc3339.go b/sdk/resourcemanager/communication/armcommunication/time_rfc3339.go index 80d8be011a50..d7edc50fe170 100644 --- a/sdk/resourcemanager/communication/armcommunication/time_rfc3339.go +++ b/sdk/resourcemanager/communication/armcommunication/time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string