// 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 armservicefabricmanagedclusters_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/servicefabricmanagedclusters/armservicefabricmanagedclusters"
	"log"
)

// Generated from example definition: 2026-05-01-preview/ApplicationTypeVersionPutOperation_example.json
func ExampleApplicationTypeVersionsClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armservicefabricmanagedclusters.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewApplicationTypeVersionsClient().BeginCreateOrUpdate(ctx, "resRg", "myCluster", "myAppType", "1.0", armservicefabricmanagedclusters.ApplicationTypeVersionResource{
		Location: to.Ptr("eastus"),
		Properties: &armservicefabricmanagedclusters.ApplicationTypeVersionResourceProperties{
			AppPackageURL: to.Ptr("http://fakelink.test.com/MyAppType"),
		},
	}, 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 = armservicefabricmanagedclusters.ApplicationTypeVersionsClientCreateOrUpdateResponse{
	// 	ApplicationTypeVersionResource: armservicefabricmanagedclusters.ApplicationTypeVersionResource{
	// 		Name: to.Ptr("1.0"),
	// 		Type: to.Ptr("Microsoft.ServiceFabric/managedClusters/applicationTypes/versions"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applicationTypes/myAppType/versions/1.0"),
	// 		Properties: &armservicefabricmanagedclusters.ApplicationTypeVersionResourceProperties{
	// 			AppPackageURL: to.Ptr("http://fakelink.test.com/MyAppType"),
	// 			ProvisioningState: to.Ptr("Creating"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-05-01-preview/ApplicationTypeVersionDeleteOperation_example.json
func ExampleApplicationTypeVersionsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armservicefabricmanagedclusters.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewApplicationTypeVersionsClient().BeginDelete(ctx, "resRg", "myCluster", "myAppType", "1.0", 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-05-01-preview/ApplicationTypeVersionGetOperation_example.json
func ExampleApplicationTypeVersionsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armservicefabricmanagedclusters.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewApplicationTypeVersionsClient().Get(ctx, "resRg", "myCluster", "myAppType", "1.0", 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 = armservicefabricmanagedclusters.ApplicationTypeVersionsClientGetResponse{
	// 	ApplicationTypeVersionResource: armservicefabricmanagedclusters.ApplicationTypeVersionResource{
	// 		Name: to.Ptr("1.0"),
	// 		Type: to.Ptr("Microsoft.ServiceFabric/managedClusters/applicationTypes/versions"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applicationTypes/myAppType/versions/1.0"),
	// 		Properties: &armservicefabricmanagedclusters.ApplicationTypeVersionResourceProperties{
	// 			AppPackageURL: to.Ptr("http://fakelink.test.com/MyAppType"),
	// 			ProvisioningState: to.Ptr("Updating"),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-05-01-preview/ApplicationTypeVersionListOperation_example.json
func ExampleApplicationTypeVersionsClient_NewListByApplicationTypesPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armservicefabricmanagedclusters.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewApplicationTypeVersionsClient().NewListByApplicationTypesPager("resRg", "myCluster", "myAppType", 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 = armservicefabricmanagedclusters.ApplicationTypeVersionsClientListByApplicationTypesResponse{
		// 	ApplicationTypeVersionResourceList: armservicefabricmanagedclusters.ApplicationTypeVersionResourceList{
		// 		NextLink: to.Ptr("http://examplelink.com"),
		// 		Value: []*armservicefabricmanagedclusters.ApplicationTypeVersionResource{
		// 			{
		// 				Name: to.Ptr("1.0"),
		// 				Type: to.Ptr("Microsoft.ServiceFabric/managedClusters/applicationTypes/versions"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applicationTypes/myAppType/versions/1.0"),
		// 				Properties: &armservicefabricmanagedclusters.ApplicationTypeVersionResourceProperties{
		// 					AppPackageURL: to.Ptr("http://fakelink.test.com/MyAppType"),
		// 					ProvisioningState: to.Ptr("Updating"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2026-05-01-preview/ApplicationTypeVersionPatchOperation_example.json
func ExampleApplicationTypeVersionsClient_Update() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armservicefabricmanagedclusters.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewApplicationTypeVersionsClient().Update(ctx, "resRg", "myCluster", "myAppType", "1.0", armservicefabricmanagedclusters.ApplicationTypeVersionUpdateParameters{
		Tags: map[string]*string{
			"a": to.Ptr("b"),
		},
	}, 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 = armservicefabricmanagedclusters.ApplicationTypeVersionsClientUpdateResponse{
	// 	ApplicationTypeVersionResource: armservicefabricmanagedclusters.ApplicationTypeVersionResource{
	// 		Name: to.Ptr("1.0"),
	// 		Type: to.Ptr("Microsoft.ServiceFabric/managedClusters/applicationTypes/versions"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resRg/providers/Microsoft.ServiceFabric/managedclusters/myCluster/applicationTypes/myAppType/versions/1.0"),
	// 		Properties: &armservicefabricmanagedclusters.ApplicationTypeVersionResourceProperties{
	// 			AppPackageURL: to.Ptr("http://fakelink.test.com/MyAppType"),
	// 			ProvisioningState: to.Ptr("Succeeded"),
	// 		},
	// 		Tags: map[string]*string{
	// 			"a": to.Ptr("b"),
	// 		},
	// 	},
	// }
}
