// 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 armstoragecache_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/storagecache/armstoragecache/v4"
	"log"
)

// Generated from example definition: 2026-01-01/importJobs_CreateOrUpdate.json
func ExampleImportJobsClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstoragecache.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImportJobsClient().BeginCreateOrUpdate(ctx, "scgroup", "fs1", "job1", armstoragecache.ImportJob{
		Location: to.Ptr("eastus"),
		Properties: &armstoragecache.ImportJobProperties{
			ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeOverwriteAlways),
			ImportPrefixes: []*string{
				to.Ptr("/"),
			},
			MaximumErrors: to.Ptr[int32](0),
		},
		Tags: map[string]*string{
			"Dept": to.Ptr("ContosoAds"),
		},
	}, 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 poll 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 = armstoragecache.ImportJobsClientCreateOrUpdateResponse{
	// 	ImportJob: armstoragecache.ImportJob{
	// 		Name: to.Ptr("job1"),
	// 		Type: to.Ptr("Microsoft.StorageCache/amlFilesystem/importJob"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlfilesystems/fs1/importJobs/job1"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armstoragecache.ImportJobProperties{
	// 			AdminStatus: to.Ptr(armstoragecache.ImportJobAdminStatusActive),
	// 			ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeOverwriteAlways),
	// 			ImportPrefixes: []*string{
	// 				to.Ptr("/"),
	// 			},
	// 			MaximumErrors: to.Ptr[int32](0),
	// 			ProvisioningState: to.Ptr(armstoragecache.ImportJobProvisioningStateTypeSucceeded),
	// 			Status: &armstoragecache.ImportJobPropertiesStatus{
	// 				BlobsImportedPerSecond: to.Ptr[int64](4000),
	// 				BlobsWalkedPerSecond: to.Ptr[int64](10000),
	// 				LastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T18:25:43.511Z"); return t}()),
	// 				LastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T17:25:43.511Z"); return t}()),
	// 				State: to.Ptr(armstoragecache.ImportStatusTypeCompleted),
	// 				StatusMessage: to.Ptr("Import job completed successfully"),
	// 				TotalBlobsImported: to.Ptr[int64](1000000),
	// 				TotalBlobsWalked: to.Ptr[int64](1000000),
	// 				TotalConflicts: to.Ptr[int32](1),
	// 				TotalErrors: to.Ptr[int32](1),
	// 			},
	// 		},
	// 		Tags: map[string]*string{
	// 			"Dept": to.Ptr("ContosoAds"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01/importJobs_Delete.json
func ExampleImportJobsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstoragecache.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImportJobsClient().BeginDelete(ctx, "scgroup", "fs1", "job1", 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 poll the result: %v", err)
	}
}

// Generated from example definition: 2026-01-01/importJobs_Get.json
func ExampleImportJobsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstoragecache.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewImportJobsClient().Get(ctx, "scgroup", "fs1", "job1", 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 = armstoragecache.ImportJobsClientGetResponse{
	// 	ImportJob: armstoragecache.ImportJob{
	// 		Name: to.Ptr("job1"),
	// 		Type: to.Ptr("Microsoft.StorageCache/amlFilesystem/importJob"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlfilesystems/fs1/importJobs/job1"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armstoragecache.ImportJobProperties{
	// 			AdminStatus: to.Ptr(armstoragecache.ImportJobAdminStatusActive),
	// 			ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeOverwriteAlways),
	// 			ImportPrefixes: []*string{
	// 				to.Ptr("/"),
	// 			},
	// 			MaximumErrors: to.Ptr[int32](0),
	// 			ProvisioningState: to.Ptr(armstoragecache.ImportJobProvisioningStateTypeSucceeded),
	// 			Status: &armstoragecache.ImportJobPropertiesStatus{
	// 				BlobsImportedPerSecond: to.Ptr[int64](4000),
	// 				BlobsWalkedPerSecond: to.Ptr[int64](10000),
	// 				ImportedDirectories: to.Ptr[int64](500),
	// 				ImportedFiles: to.Ptr[int64](1000),
	// 				ImportedSymlinks: to.Ptr[int64](1000),
	// 				LastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T18:25:43.511Z"); return t}()),
	// 				LastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T17:25:43.511Z"); return t}()),
	// 				PreexistingDirectories: to.Ptr[int64](100),
	// 				PreexistingFiles: to.Ptr[int64](500),
	// 				PreexistingSymlinks: to.Ptr[int64](200),
	// 				State: to.Ptr(armstoragecache.ImportStatusTypeCompleted),
	// 				StatusMessage: to.Ptr("Import job completed successfully"),
	// 				TotalBlobsImported: to.Ptr[int64](1000000),
	// 				TotalBlobsWalked: to.Ptr[int64](1000000),
	// 				TotalConflicts: to.Ptr[int32](1),
	// 				TotalErrors: to.Ptr[int32](1),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01/importJobs_ListByAmlFilesystem.json
func ExampleImportJobsClient_NewListByAmlFilesystemPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstoragecache.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewImportJobsClient().NewListByAmlFilesystemPager("scgroup", "fs1", 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 = armstoragecache.ImportJobsClientListByAmlFilesystemResponse{
		// 	ImportJobsListResult: armstoragecache.ImportJobsListResult{
		// 		Value: []*armstoragecache.ImportJob{
		// 			{
		// 				Name: to.Ptr("job1"),
		// 				Type: to.Ptr("Microsoft.StorageCache/amlFilesystem/importJob"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlfilesystems/fs1/importJobs/job1"),
		// 				Location: to.Ptr("eastus"),
		// 				Properties: &armstoragecache.ImportJobProperties{
		// 					AdminStatus: to.Ptr(armstoragecache.ImportJobAdminStatusActive),
		// 					ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeOverwriteAlways),
		// 					ImportPrefixes: []*string{
		// 						to.Ptr("/"),
		// 					},
		// 					MaximumErrors: to.Ptr[int32](0),
		// 					ProvisioningState: to.Ptr(armstoragecache.ImportJobProvisioningStateTypeSucceeded),
		// 					Status: &armstoragecache.ImportJobPropertiesStatus{
		// 						BlobsImportedPerSecond: to.Ptr[int64](4000),
		// 						BlobsWalkedPerSecond: to.Ptr[int64](10000),
		// 						ImportedDirectories: to.Ptr[int64](500),
		// 						ImportedFiles: to.Ptr[int64](1000),
		// 						ImportedSymlinks: to.Ptr[int64](1000),
		// 						LastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T18:25:43.511Z"); return t}()),
		// 						LastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T17:25:43.511Z"); return t}()),
		// 						PreexistingDirectories: to.Ptr[int64](100),
		// 						PreexistingFiles: to.Ptr[int64](500),
		// 						PreexistingSymlinks: to.Ptr[int64](200),
		// 						State: to.Ptr(armstoragecache.ImportStatusTypeCompleted),
		// 						StatusMessage: to.Ptr("Import job completed successfully"),
		// 						TotalBlobsImported: to.Ptr[int64](1000000),
		// 						TotalBlobsWalked: to.Ptr[int64](1000000),
		// 						TotalConflicts: to.Ptr[int32](1),
		// 						TotalErrors: to.Ptr[int32](1),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("job2"),
		// 				Type: to.Ptr("Microsoft.StorageCache/amlFilesystem/importJob"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlfilesystems/fs1/importJobs/job2"),
		// 				Location: to.Ptr("eastus"),
		// 				Properties: &armstoragecache.ImportJobProperties{
		// 					AdminStatus: to.Ptr(armstoragecache.ImportJobAdminStatusActive),
		// 					ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeSkip),
		// 					ImportPrefixes: []*string{
		// 						to.Ptr("/dir1"),
		// 					},
		// 					MaximumErrors: to.Ptr[int32](0),
		// 					ProvisioningState: to.Ptr(armstoragecache.ImportJobProvisioningStateTypeSucceeded),
		// 					Status: &armstoragecache.ImportJobPropertiesStatus{
		// 						BlobsImportedPerSecond: to.Ptr[int64](4000),
		// 						BlobsWalkedPerSecond: to.Ptr[int64](10000),
		// 						ImportedDirectories: to.Ptr[int64](500),
		// 						ImportedFiles: to.Ptr[int64](1000),
		// 						ImportedSymlinks: to.Ptr[int64](1000),
		// 						LastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T18:25:43.511Z"); return t}()),
		// 						LastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T17:25:43.511Z"); return t}()),
		// 						PreexistingDirectories: to.Ptr[int64](100),
		// 						PreexistingFiles: to.Ptr[int64](500),
		// 						PreexistingSymlinks: to.Ptr[int64](200),
		// 						State: to.Ptr(armstoragecache.ImportStatusTypeCompleted),
		// 						StatusMessage: to.Ptr("Import job completed successfully"),
		// 						TotalBlobsImported: to.Ptr[int64](1000000),
		// 						TotalBlobsWalked: to.Ptr[int64](1000000),
		// 						TotalConflicts: to.Ptr[int32](1),
		// 						TotalErrors: to.Ptr[int32](1),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-01-01/importJob_Update.json
func ExampleImportJobsClient_BeginUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armstoragecache.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewImportJobsClient().BeginUpdate(ctx, "scgroup", "fs1", "job1", armstoragecache.ImportJobUpdate{
		Tags: map[string]*string{
			"Dept": to.Ptr("ContosoAds"),
		},
	}, 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 poll 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 = armstoragecache.ImportJobsClientUpdateResponse{
	// 	ImportJob: armstoragecache.ImportJob{
	// 		Name: to.Ptr("job1"),
	// 		Type: to.Ptr("Microsoft.StorageCache/amlFilesystem/importJob"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.StorageCache/amlfilesystems/fs1/importJobs/job1"),
	// 		Location: to.Ptr("eastus"),
	// 		Properties: &armstoragecache.ImportJobProperties{
	// 			AdminStatus: to.Ptr(armstoragecache.ImportJobAdminStatusActive),
	// 			ConflictResolutionMode: to.Ptr(armstoragecache.ConflictResolutionModeOverwriteAlways),
	// 			ImportPrefixes: []*string{
	// 				to.Ptr("/"),
	// 			},
	// 			MaximumErrors: to.Ptr[int32](0),
	// 			ProvisioningState: to.Ptr(armstoragecache.ImportJobProvisioningStateTypeSucceeded),
	// 			Status: &armstoragecache.ImportJobPropertiesStatus{
	// 				BlobsImportedPerSecond: to.Ptr[int64](4000),
	// 				BlobsWalkedPerSecond: to.Ptr[int64](10000),
	// 				ImportedDirectories: to.Ptr[int64](500),
	// 				ImportedFiles: to.Ptr[int64](1000),
	// 				ImportedSymlinks: to.Ptr[int64](1000),
	// 				LastCompletionTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T18:25:43.511Z"); return t}()),
	// 				LastStartedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-21T17:25:43.511Z"); return t}()),
	// 				PreexistingDirectories: to.Ptr[int64](100),
	// 				PreexistingFiles: to.Ptr[int64](500),
	// 				PreexistingSymlinks: to.Ptr[int64](200),
	// 				State: to.Ptr(armstoragecache.ImportStatusTypeCompleted),
	// 				StatusMessage: to.Ptr("Import job completed successfully"),
	// 				TotalBlobsImported: to.Ptr[int64](1000000),
	// 				TotalBlobsWalked: to.Ptr[int64](1000000),
	// 				TotalConflicts: to.Ptr[int32](1),
	// 				TotalErrors: to.Ptr[int32](1),
	// 			},
	// 		},
	// 		Tags: map[string]*string{
	// 			"Dept": to.Ptr("ContosoAds"),
	// 		},
	// 	},
	// }
}
