// 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 armdevhub_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devhub/armdevhub"
	"log"
)

// Generated from example definition: 2025-03-01-preview/Template_Get.json
func ExampleTemplateClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdevhub.NewClientFactory("a0a37f63-7183-4e86-9ac7-ce8036a3ed31", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewTemplateClient().Get(ctx, "test-template", 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 = armdevhub.TemplateClientGetResponse{
	// 	Template: armdevhub.Template{
	// 		Name: to.Ptr("test-template"),
	// 		Type: to.Ptr("Micfosoft.DevHub/templates"),
	// 		ID: to.Ptr("/subscriptions/a0a37f63-7183-4e86-9ac7-ce8036a3ed31/providers/Microsoft.DevHub/templates/test-template"),
	// 		Properties: &armdevhub.TemplateProperties{
	// 			Description: to.Ptr("test description"),
	// 			DefaultVersion: to.Ptr("0.0.1"),
	// 			TemplateName: to.Ptr("test-template"),
	// 			TemplateType: to.Ptr(armdevhub.TemplateTypeManifest),
	// 			Versions: []*string{
	// 				to.Ptr("0.0.1"),
	// 			},
	// 		},
	// 		SystemData: &armdevhub.SystemData{
	// 			CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-16T09:56:23.933651400Z"); return t}()),
	// 			CreatedBy: to.Ptr(""),
	// 			CreatedByType: to.Ptr(armdevhub.CreatedByTypeUser),
	// 			LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-16T14:35:15.206059900Z"); return t}()),
	// 			LastModifiedBy: to.Ptr("aks-dev-hub-devhub"),
	// 			LastModifiedByType: to.Ptr(armdevhub.CreatedByTypeApplication),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-03-01-preview/Template_List.json
func ExampleTemplateClient_NewListPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdevhub.NewClientFactory("a0a37f63-7183-4e86-9ac7-ce8036a3ed31", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewTemplateClient().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 = armdevhub.TemplateClientListResponse{
		// 	TemplateListResult: armdevhub.TemplateListResult{
		// 		Value: []*armdevhub.Template{
		// 			{
		// 				Name: to.Ptr("test-template"),
		// 				Type: to.Ptr("Micfosoft.DevHub/templates"),
		// 				ID: to.Ptr("/subscriptions/a0a37f63-7183-4e86-9ac7-ce8036a3ed31/providers/Microsoft.DevHub/templates/test-template"),
		// 				Properties: &armdevhub.TemplateProperties{
		// 					Description: to.Ptr("test description"),
		// 					DefaultVersion: to.Ptr("0.0.1"),
		// 					TemplateName: to.Ptr("test-template"),
		// 					TemplateType: to.Ptr(armdevhub.TemplateTypeManifest),
		// 					Versions: []*string{
		// 						to.Ptr("0.0.1"),
		// 					},
		// 				},
		// 				SystemData: &armdevhub.SystemData{
		// 					CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-16T09:56:23.933651400Z"); return t}()),
		// 					CreatedBy: to.Ptr(""),
		// 					CreatedByType: to.Ptr(armdevhub.CreatedByTypeUser),
		// 					LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-16T14:35:15.206059900Z"); return t}()),
		// 					LastModifiedBy: to.Ptr("aks-dev-hub-devhub"),
		// 					LastModifiedByType: to.Ptr(armdevhub.CreatedByTypeApplication),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
