// 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 armdatabricks_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/databricks/armdatabricks/v2"
	"log"
)

// Generated from example definition: 2026-01-01/WorkspaceVirtualNetworkPeeringCreateOrUpdate.json
func ExampleVNetPeeringClient_BeginCreateOrUpdate() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdatabricks.NewClientFactory("0140911e-1040-48da-8bc9-b99fb3dd88a6/", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVNetPeeringClient().BeginCreateOrUpdate(ctx, "subramantest", "adbworkspace", "vNetPeeringTest", armdatabricks.VirtualNetworkPeering{
		Properties: &armdatabricks.VirtualNetworkPeeringPropertiesFormat{
			AllowForwardedTraffic:     to.Ptr(false),
			AllowGatewayTransit:       to.Ptr(false),
			AllowVirtualNetworkAccess: to.Ptr(true),
			RemoteVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork{
				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Network/virtualNetworks/subramanvnet"),
			},
			UseRemoteGateways: to.Ptr(false),
		},
	}, 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 = armdatabricks.VNetPeeringClientCreateOrUpdateResponse{
	// 	VirtualNetworkPeering: armdatabricks.VirtualNetworkPeering{
	// 		Name: to.Ptr("vNetPeeringTest"),
	// 		ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Databricks/workspaces/adbworkspace/virtualNetworkPeerings/vNetPeeringTest"),
	// 		Properties: &armdatabricks.VirtualNetworkPeeringPropertiesFormat{
	// 			AllowForwardedTraffic: to.Ptr(false),
	// 			AllowGatewayTransit: to.Ptr(false),
	// 			AllowVirtualNetworkAccess: to.Ptr(true),
	// 			DatabricksAddressSpace: &armdatabricks.AddressSpace{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.139.0.0/16"),
	// 				},
	// 			},
	// 			DatabricksVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork{
	// 				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/databricks-rg-adbworkspace-2jsxhmzoyooxm/providers/Microsoft.Network/virtualNetworks/workers-vnet"),
	// 			},
	// 			PeeringState: to.Ptr(armdatabricks.PeeringStateInitiated),
	// 			ProvisioningState: to.Ptr(armdatabricks.PeeringProvisioningStateUpdating),
	// 			RemoteAddressSpace: &armdatabricks.AddressSpace{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.203.0.0/16"),
	// 				},
	// 			},
	// 			RemoteVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork{
	// 				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Network/virtualNetworks/subramanvnet"),
	// 			},
	// 			UseRemoteGateways: to.Ptr(false),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01/WorkspaceVirtualNetworkPeeringDelete.json
func ExampleVNetPeeringClient_BeginDelete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdatabricks.NewClientFactory("0140911e-1040-48da-8bc9-b99fb3dd88a6/", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	poller, err := clientFactory.NewVNetPeeringClient().BeginDelete(ctx, "subramantest", "adbworkspace", "vNetPeeringTest", 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 = armdatabricks.VNetPeeringClientDeleteResponse{
	// }
}

// Generated from example definition: 2026-01-01/WorkspaceVirtualNetPeeringGet.json
func ExampleVNetPeeringClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdatabricks.NewClientFactory("0140911e-1040-48da-8bc9-b99fb3dd88a6/", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewVNetPeeringClient().Get(ctx, "subramantest", "adbworkspace", "vNetPeeringTest", 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 = armdatabricks.VNetPeeringClientGetResponse{
	// 	VirtualNetworkPeering: armdatabricks.VirtualNetworkPeering{
	// 		Name: to.Ptr("vNetPeeringTest"),
	// 		ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Databricks/workspaces/adbworkspace/virtualNetworkPeerings/vNetPeeringTest"),
	// 		Properties: &armdatabricks.VirtualNetworkPeeringPropertiesFormat{
	// 			AllowForwardedTraffic: to.Ptr(false),
	// 			AllowGatewayTransit: to.Ptr(false),
	// 			AllowVirtualNetworkAccess: to.Ptr(true),
	// 			DatabricksAddressSpace: &armdatabricks.AddressSpace{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.139.0.0/16"),
	// 				},
	// 			},
	// 			DatabricksVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork{
	// 				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/databricks-rg-adbworkspace-2jsxhmzoyooxm/providers/Microsoft.Network/virtualNetworks/workers-vnet"),
	// 			},
	// 			PeeringState: to.Ptr(armdatabricks.PeeringStateInitiated),
	// 			ProvisioningState: to.Ptr(armdatabricks.PeeringProvisioningStateSucceeded),
	// 			RemoteAddressSpace: &armdatabricks.AddressSpace{
	// 				AddressPrefixes: []*string{
	// 					to.Ptr("10.203.0.0/16"),
	// 				},
	// 			},
	// 			RemoteVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork{
	// 				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Network/virtualNetworks/subramanvnet"),
	// 			},
	// 			UseRemoteGateways: to.Ptr(false),
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2026-01-01/WorkspaceVirtualNetPeeringList.json
func ExampleVNetPeeringClient_NewListByWorkspacePager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armdatabricks.NewClientFactory("0140911e-1040-48da-8bc9-b99fb3dd88a6/", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewVNetPeeringClient().NewListByWorkspacePager("subramantest", "adbworkspace", 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 = armdatabricks.VNetPeeringClientListByWorkspaceResponse{
		// 	VirtualNetworkPeeringList: armdatabricks.VirtualNetworkPeeringList{
		// 		Value: []*armdatabricks.VirtualNetworkPeering{
		// 			{
		// 				Name: to.Ptr("vNetPeeringTest"),
		// 				ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Databricks/workspaces/adbworkspace/virtualNetworkPeerings/vNetPeeringTest"),
		// 				Properties: &armdatabricks.VirtualNetworkPeeringPropertiesFormat{
		// 					AllowForwardedTraffic: to.Ptr(false),
		// 					AllowGatewayTransit: to.Ptr(false),
		// 					AllowVirtualNetworkAccess: to.Ptr(true),
		// 					DatabricksAddressSpace: &armdatabricks.AddressSpace{
		// 						AddressPrefixes: []*string{
		// 							to.Ptr("10.139.0.0/16"),
		// 						},
		// 					},
		// 					DatabricksVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork{
		// 						ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/databricks-rg-adbworkspace-2jsxhmzoyooxm/providers/Microsoft.Network/virtualNetworks/workers-vnet"),
		// 					},
		// 					PeeringState: to.Ptr(armdatabricks.PeeringStateInitiated),
		// 					ProvisioningState: to.Ptr(armdatabricks.PeeringProvisioningStateSucceeded),
		// 					RemoteAddressSpace: &armdatabricks.AddressSpace{
		// 						AddressPrefixes: []*string{
		// 							to.Ptr("10.203.0.0/16"),
		// 						},
		// 					},
		// 					RemoteVirtualNetwork: &armdatabricks.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork{
		// 						ID: to.Ptr("/subscriptions/0140911e-1040-48da-8bc9-b99fb3dd88a6/resourceGroups/subramantest/providers/Microsoft.Network/virtualNetworks/subramanvnet"),
		// 					},
		// 					UseRemoteGateways: to.Ptr(false),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
