// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armcommunication_test

import (
	"context"
	"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/v3"
	"log"
)

// Generated from example definition: 2025-09-01/suppressionLists/createOrUpdateSuppressionList.json
func ExampleSuppressionListsClient_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("11112222-3333-4444-5555-666677778888", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSuppressionListsClient().CreateOrUpdate(ctx, "contosoResourceGroup", "contosoEmailService", "contoso.com", "aaaa1111-bbbb-2222-3333-aaaa11112222", armcommunication.SuppressionListResource{
		Properties: &armcommunication.SuppressionListProperties{
			ListName: 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 = armcommunication.SuppressionListsClientCreateOrUpdateResponse{
	// 	SuppressionListResource: armcommunication.SuppressionListResource{
	// 		Name: to.Ptr("aaaa1111-bbbb-2222-3333-aaaa11112222"),
	// 		Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SuppressionLists"),
	// 		ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/suppressionLists/aaaa1111-bbbb-2222-3333-aaaa11112222"),
	// 		Properties: &armcommunication.SuppressionListProperties{
	// 			CreatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
	// 			LastUpdatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
	// 			ListName: to.Ptr("contosoNewsAlerts"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01/suppressionLists/deleteSuppressionList.json
func ExampleSuppressionListsClient_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("11112222-3333-4444-5555-666677778888", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSuppressionListsClient().Delete(ctx, "MyResourceGroup", "MyEmailServiceResource", "mydomain.com", "aaaa1111-bbbb-2222-3333-aaaa11112222", 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 = armcommunication.SuppressionListsClientDeleteResponse{
	// }
}

// Generated from example definition: 2025-09-01/suppressionLists/getSuppressionList.json
func ExampleSuppressionListsClient_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("11112222-3333-4444-5555-666677778888", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewSuppressionListsClient().Get(ctx, "contosoResourceGroup", "contosoEmailService", "contoso.com", "aaaa1111-bbbb-2222-3333-aaaa11112222", 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 = armcommunication.SuppressionListsClientGetResponse{
	// 	SuppressionListResource: armcommunication.SuppressionListResource{
	// 		Name: to.Ptr("aaaa1111-bbbb-2222-3333-aaaa11112222"),
	// 		Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SuppressionLists"),
	// 		ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/suppressionLists/aaaa1111-bbbb-2222-3333-aaaa11112222"),
	// 		Properties: &armcommunication.SuppressionListProperties{
	// 			CreatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
	// 			LastUpdatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
	// 			ListName: to.Ptr("contosoNewsAlerts"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01/suppressionLists/getSuppressionLists.json
func ExampleSuppressionListsClient_NewListByDomainPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcommunication.NewClientFactory("11112222-3333-4444-5555-666677778888", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewSuppressionListsClient().NewListByDomainPager("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 = armcommunication.SuppressionListsClientListByDomainResponse{
		// 	SuppressionListResourceCollection: armcommunication.SuppressionListResourceCollection{
		// 		Value: []*armcommunication.SuppressionListResource{
		// 			{
		// 				Name: to.Ptr("aaaa1111-bbbb-2222-3333-aaaa11112222"),
		// 				Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SuppressionLists"),
		// 				ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/suppressionLists/aaaa1111-bbbb-2222-3333-aaaa11112222"),
		// 				Properties: &armcommunication.SuppressionListProperties{
		// 					CreatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
		// 					LastUpdatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
		// 					ListName: to.Ptr("contosoNewsAlerts"),
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("aaaa1111-bbbb-2222-3333-aaaa11112222"),
		// 				Type: to.Ptr("Microsoft.Communication/EmailServices/Domains/SuppressionLists"),
		// 				ID: to.Ptr("/subscriptions/11112222-3333-4444-5555-666677778888/resourceGroups/contosoResourceGroup/providers/Microsoft.Communication/EmailServices/contosoEmailService/Domains/contoso.com/suppressionLists/aaaa1111-bbbb-2222-3333-aaaa11112222"),
		// 				Properties: &armcommunication.SuppressionListProperties{
		// 					CreatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
		// 					LastUpdatedTimeStamp: to.Ptr("2023-06-06T17:06:26.100Z"),
		// 					ListName: to.Ptr("contosoShopping"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
