// 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 armcompute_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/compute/armcompute/v8"
	"log"
)

// Generated from example definition: 2025-12-03/galleryExamples/GalleryApplication_Create.json
func ExampleGalleryApplicationsClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginCreateOrUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplication{
		Location: to.Ptr("West US"),
		Properties: &armcompute.GalleryApplicationProperties{
			Description:         to.Ptr("This is the gallery application description."),
			Eula:                to.Ptr("This is the gallery application EULA."),
			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("myReleaseNoteUri"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
			CustomActions: []*armcompute.GalleryApplicationCustomAction{
				{
					Name:        to.Ptr("myCustomAction"),
					Script:      to.Ptr("myCustomActionScript"),
					Description: to.Ptr("This is the custom action description."),
					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
						{
							Name:         to.Ptr("myCustomActionParameter"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
							DefaultValue: to.Ptr("default value of parameter."),
							Description:  to.Ptr("This is the description of the parameter"),
						},
					},
				},
			},
		},
	}, 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 = armcompute.GalleryApplicationsClientCreateOrUpdateResponse{
	// 	GalleryApplication: armcompute.GalleryApplication{
	// 		Properties: &armcompute.GalleryApplicationProperties{
	// 			Description: to.Ptr("This is the gallery application description."),
	// 			Eula: to.Ptr("This is the gallery application EULA."),
	// 			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 			ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 			SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Script: to.Ptr("myCustomActionScript"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Required: to.Ptr(false),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("West US"),
	// 		Name: to.Ptr("myGalleryApplicationName"),
	// 		Type: to.Ptr("Microsoft.Compute/galleries"),
	// 		ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 	},
	// }
}

// Generated from example definition: 2025-12-03/galleryExamples/GalleryApplication_Delete.json
func ExampleGalleryApplicationsClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginDelete(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", 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 = armcompute.GalleryApplicationsClientDeleteResponse{
	// }
}

// Generated from example definition: 2025-12-03/galleryExamples/GalleryApplication_Get.json
func ExampleGalleryApplicationsClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewGalleryApplicationsClient().Get(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", 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 = armcompute.GalleryApplicationsClientGetResponse{
	// 	GalleryApplication: armcompute.GalleryApplication{
	// 		ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 		Properties: &armcompute.GalleryApplicationProperties{
	// 			Description: to.Ptr("This is the gallery application description."),
	// 			Eula: to.Ptr("This is the gallery application EULA."),
	// 			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 			ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 			SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Script: to.Ptr("myCustomActionScript"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Required: to.Ptr(false),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("West US"),
	// 		Name: to.Ptr("myGalleryApplicationName"),
	// 	},
	// }
}

// Generated from example definition: 2025-12-03/galleryExamples/GalleryApplication_ListByGallery.json
func ExampleGalleryApplicationsClient_NewListByGalleryPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewGalleryApplicationsClient().NewListByGalleryPager("myResourceGroup", "myGalleryName", 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 = armcompute.GalleryApplicationsClientListByGalleryResponse{
		// 	GalleryApplicationList: armcompute.GalleryApplicationList{
		// 		Value: []*armcompute.GalleryApplication{
		// 			{
		// 				ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
		// 				Properties: &armcompute.GalleryApplicationProperties{
		// 					Description: to.Ptr("This is the gallery application description."),
		// 					Eula: to.Ptr("This is the gallery application EULA."),
		// 					PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
		// 					ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
		// 					SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
		// 					CustomActions: []*armcompute.GalleryApplicationCustomAction{
		// 						{
		// 							Name: to.Ptr("myCustomAction"),
		// 							Script: to.Ptr("myCustomActionScript"),
		// 							Description: to.Ptr("This is the custom action description."),
		// 							Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
		// 								{
		// 									Name: to.Ptr("myCustomActionParameter"),
		// 									Required: to.Ptr(false),
		// 									Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
		// 									DefaultValue: to.Ptr("default value of parameter."),
		// 									Description: to.Ptr("This is the description of the parameter"),
		// 								},
		// 							},
		// 						},
		// 					},
		// 				},
		// 				Location: to.Ptr("West US"),
		// 				Name: to.Ptr("myGalleryApplicationName"),
		// 			},
		// 		},
		// 		NextLink: to.Ptr("http://svchost:99/subscriptions/subscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications?$skiptoken=token/Subscriptions/subscriptionId/ResourceGroups/myResourceGroup/galleries/myGalleryName/applications/myGalleryApplicationName"),
		// 	},
		// }
	}
}

// Generated from example definition: 2025-12-03/galleryExamples/GalleryApplication_Update.json
func ExampleGalleryApplicationsClient_BeginUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armcompute.NewClientFactory("{subscription-id}", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewGalleryApplicationsClient().BeginUpdate(ctx, "myResourceGroup", "myGalleryName", "myGalleryApplicationName", armcompute.GalleryApplicationUpdate{
		Properties: &armcompute.GalleryApplicationProperties{
			Description:         to.Ptr("This is the gallery application description."),
			Eula:                to.Ptr("This is the gallery application EULA."),
			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
			ReleaseNoteURI:      to.Ptr("myReleaseNoteUri"),
			SupportedOSType:     to.Ptr(armcompute.OperatingSystemTypesWindows),
			CustomActions: []*armcompute.GalleryApplicationCustomAction{
				{
					Name:        to.Ptr("myCustomAction"),
					Script:      to.Ptr("myCustomActionScript"),
					Description: to.Ptr("This is the custom action description."),
					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
						{
							Name:         to.Ptr("myCustomActionParameter"),
							Required:     to.Ptr(false),
							Type:         to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
							DefaultValue: to.Ptr("default value of parameter."),
							Description:  to.Ptr("This is the description of the parameter"),
						},
					},
				},
			},
		},
	}, 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 = armcompute.GalleryApplicationsClientUpdateResponse{
	// 	GalleryApplication: armcompute.GalleryApplication{
	// 		Properties: &armcompute.GalleryApplicationProperties{
	// 			Description: to.Ptr("This is the gallery application description."),
	// 			Eula: to.Ptr("This is the gallery application EULA."),
	// 			PrivacyStatementURI: to.Ptr("myPrivacyStatementUri}"),
	// 			ReleaseNoteURI: to.Ptr("myReleaseNoteUri"),
	// 			SupportedOSType: to.Ptr(armcompute.OperatingSystemTypesWindows),
	// 			CustomActions: []*armcompute.GalleryApplicationCustomAction{
	// 				{
	// 					Name: to.Ptr("myCustomAction"),
	// 					Script: to.Ptr("myCustomActionScript"),
	// 					Description: to.Ptr("This is the custom action description."),
	// 					Parameters: []*armcompute.GalleryApplicationCustomActionParameter{
	// 						{
	// 							Name: to.Ptr("myCustomActionParameter"),
	// 							Required: to.Ptr(false),
	// 							Type: to.Ptr(armcompute.GalleryApplicationCustomActionParameterTypeString),
	// 							DefaultValue: to.Ptr("default value of parameter."),
	// 							Description: to.Ptr("This is the description of the parameter"),
	// 						},
	// 					},
	// 				},
	// 			},
	// 		},
	// 		Location: to.Ptr("West US"),
	// 		Name: to.Ptr("myGalleryApplicationName"),
	// 		Type: to.Ptr("Microsoft.Compute/galleries"),
	// 		ID: to.Ptr("/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/galleries/myGalleryName/applications/myGalleryApplicationName"),
	// 	},
	// }
}
