// 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 armapimanagement_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/apimanagement/armapimanagement/v4"
	"log"
)

// Generated from example definition: 2025-09-01-preview/ApiManagementCreateAuthorizationProviderAADAuthCode.json
func ExampleAuthorizationProviderClient_CreateOrUpdate_apiManagementCreateAuthorizationProviderAadAuthCode() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "aadwithauthcode", armapimanagement.AuthorizationProviderContract{
		Properties: &armapimanagement.AuthorizationProviderContractProperties{
			DisplayName:      to.Ptr("aadwithauthcode"),
			IdentityProvider: to.Ptr("aad"),
			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
					AuthorizationCode: map[string]*string{
						"clientId":     to.Ptr("clientsecretid"),
						"clientSecret": to.Ptr("clientsecretvalue"),
						"resourceUri":  to.Ptr("https://graph.microsoft.com"),
						"scopes":       to.Ptr("User.Read.All Group.Read.All"),
					},
				},
				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
			},
		},
	}, 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 = armapimanagement.AuthorizationProviderClientCreateOrUpdateResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("aadwithauthcode"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("aadwithauthcode"),
	// 			IdentityProvider: to.Ptr("aad"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
	// 						"loginUri": to.Ptr("https://login.windows.net"),
	// 						"resourceUri": to.Ptr("https://graph.microsoft.com"),
	// 						"scopes": to.Ptr("User.Read.All Group.Read.All"),
	// 						"tenantId": to.Ptr("common"),
	// 					},
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementCreateAuthorizationProviderAADAuthCodeWithKeyVault.json
func ExampleAuthorizationProviderClient_CreateOrUpdate_apiManagementCreateAuthorizationProviderAadAuthCodeWithKeyVault() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "aadwithkeyvault", armapimanagement.AuthorizationProviderContract{
		Properties: &armapimanagement.AuthorizationProviderContractProperties{
			DisplayName:      to.Ptr("Azure AD with Key Vault"),
			IdentityProvider: to.Ptr("aad"),
			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
					AuthorizationCode: map[string]*string{
						"clientId":    to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
						"resourceUri": to.Ptr("https://graph.microsoft.com"),
						"scopes":      to.Ptr("User.Read.All Group.Read.All"),
					},
				},
				KeyVault: &armapimanagement.AuthorizationProviderKeyVaultContract{
					SecretIdentifier: to.Ptr("https://my.vault.azure.net/secrets/clientSecret"),
				},
				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
			},
		},
	}, 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 = armapimanagement.AuthorizationProviderClientCreateOrUpdateResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("aadwithkeyvault"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithkeyvault"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("Azure AD with Key Vault"),
	// 			IdentityProvider: to.Ptr("aad"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
	// 						"resourceUri": to.Ptr("https://graph.microsoft.com"),
	// 						"scopes": to.Ptr("User.Read.All Group.Read.All"),
	// 					},
	// 				},
	// 				KeyVault: &armapimanagement.AuthorizationProviderKeyVaultContract{
	// 					LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{
	// 						Code: to.Ptr("Success"),
	// 						Message: to.Ptr("Successfully retrieved secret from Key Vault."),
	// 						TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
	// 					},
	// 					SecretIdentifier: to.Ptr("https://my.vault.azure.net/secrets/clientSecret"),
	// 					Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementCreateAuthorizationProviderAADClientCred.json
func ExampleAuthorizationProviderClient_CreateOrUpdate_apiManagementCreateAuthorizationProviderAadClientCred() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "aadwithclientcred", armapimanagement.AuthorizationProviderContract{
		Properties: &armapimanagement.AuthorizationProviderContractProperties{
			DisplayName:      to.Ptr("aadwithclientcred"),
			IdentityProvider: to.Ptr("aad"),
			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
					AuthorizationCode: map[string]*string{
						"resourceUri": to.Ptr("https://graph.microsoft.com"),
						"scopes":      to.Ptr("User.Read.All Group.Read.All"),
					},
				},
				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
			},
		},
	}, 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 = armapimanagement.AuthorizationProviderClientCreateOrUpdateResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("aadwithclientcred"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithclientcred"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("aadwithclientcred"),
	// 			IdentityProvider: to.Ptr("aad"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					ClientCredentials: map[string]*string{
	// 						"loginUri": to.Ptr("https://login.windows.net"),
	// 						"resourceUri": to.Ptr("https://graph.microsoft.com"),
	// 						"scopes": to.Ptr("User.Read.All Group.Read.All"),
	// 						"tenantId": to.Ptr("common"),
	// 					},
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementCreateAuthorizationProviderGenericOAuth2.json
func ExampleAuthorizationProviderClient_CreateOrUpdate_apiManagementCreateAuthorizationProviderGenericOAuth2() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "eventbrite", armapimanagement.AuthorizationProviderContract{
		Properties: &armapimanagement.AuthorizationProviderContractProperties{
			DisplayName:      to.Ptr("eventbrite"),
			IdentityProvider: to.Ptr("oauth2"),
			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
					AuthorizationCode: map[string]*string{
						"authorizationUrl": to.Ptr("https://www.eventbrite.com/oauth/authorize"),
						"clientId":         to.Ptr("clientid"),
						"clientSecret":     to.Ptr("clientsecretvalue"),
						"refreshUrl":       to.Ptr("https://www.eventbrite.com/oauth/token"),
						"tokenUrl":         to.Ptr("https://www.eventbrite.com/oauth/token"),
					},
				},
				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
			},
		},
	}, 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 = armapimanagement.AuthorizationProviderClientCreateOrUpdateResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("eventbrite"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/eventbrite"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("eventbrite"),
	// 			IdentityProvider: to.Ptr("oauth2"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"authorizationUrl": to.Ptr("https://www.eventbrite.com/oauth/authorize"),
	// 						"clientId": to.Ptr("clientid"),
	// 						"refreshUrl": to.Ptr("https://www.eventbrite.com/oauth/token"),
	// 						"tokenUrl": to.Ptr("https://www.eventbrite.com/oauth/token"),
	// 					},
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementCreateAuthorizationProviderOOBGoogle.json
func ExampleAuthorizationProviderClient_CreateOrUpdate_apiManagementCreateAuthorizationProviderOobGoogle() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().CreateOrUpdate(ctx, "rg1", "apimService1", "google", armapimanagement.AuthorizationProviderContract{
		Properties: &armapimanagement.AuthorizationProviderContractProperties{
			DisplayName:      to.Ptr("google"),
			IdentityProvider: to.Ptr("google"),
			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
					AuthorizationCode: map[string]*string{
						"clientId":     to.Ptr("99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"),
						"clientSecret": to.Ptr("clientsecretvalue"),
						"scopes":       to.Ptr("openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"),
					},
				},
				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
			},
		},
	}, 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 = armapimanagement.AuthorizationProviderClientCreateOrUpdateResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("google"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/google"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("google"),
	// 			IdentityProvider: to.Ptr("google"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"clientId": to.Ptr("99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"),
	// 						"scopes": to.Ptr("openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"),
	// 					},
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementDeleteAuthorizationProvider.json
func ExampleAuthorizationProviderClient_Delete() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().Delete(ctx, "rg1", "apimService1", "aadwithauthcode", "*", 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 = armapimanagement.AuthorizationProviderClientDeleteResponse{
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementGetAuthorizationProvider.json
func ExampleAuthorizationProviderClient_Get() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().Get(ctx, "rg1", "apimService1", "aadwithauthcode", 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 = armapimanagement.AuthorizationProviderClientGetResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("aadwithauthcode"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("aadwithauthcode"),
	// 			IdentityProvider: to.Ptr("aad"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
	// 						"loginUri": to.Ptr("https://login.windows.net"),
	// 						"resourceUri": to.Ptr("https://graph.microsoft.com"),
	// 						"scopes": to.Ptr("User.Read.All Group.Read.All"),
	// 						"tenantId": to.Ptr("common"),
	// 					},
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}

// Generated from example definition: 2025-09-01-preview/ApiManagementListAuthorizationProviders.json
func ExampleAuthorizationProviderClient_NewListByServicePager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewAuthorizationProviderClient().NewListByServicePager("rg1", "apimService1", 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 = armapimanagement.AuthorizationProviderClientListByServiceResponse{
		// 	AuthorizationProviderCollection: armapimanagement.AuthorizationProviderCollection{
		// 		NextLink: to.Ptr(""),
		// 		Value: []*armapimanagement.AuthorizationProviderContract{
		// 			{
		// 				Name: to.Ptr("aadwithauthcode"),
		// 				Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithauthcode"),
		// 				Properties: &armapimanagement.AuthorizationProviderContractProperties{
		// 					DisplayName: to.Ptr("aadwithauthcode"),
		// 					IdentityProvider: to.Ptr("aad"),
		// 					Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
		// 						GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
		// 							AuthorizationCode: map[string]*string{
		// 								"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
		// 								"loginUri": to.Ptr("https://login.windows.net"),
		// 								"resourceUri": to.Ptr("https://graph.microsoft.com"),
		// 								"scopes": to.Ptr("User.Read.All Group.Read.All"),
		// 								"tenantId": to.Ptr("common"),
		// 							},
		// 						},
		// 						RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("aadwithkeyvault"),
		// 				Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithkeyvault"),
		// 				Properties: &armapimanagement.AuthorizationProviderContractProperties{
		// 					DisplayName: to.Ptr("Azure AD with Key Vault"),
		// 					IdentityProvider: to.Ptr("aad"),
		// 					Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
		// 						GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
		// 							AuthorizationCode: map[string]*string{
		// 								"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
		// 								"resourceUri": to.Ptr("https://graph.microsoft.com"),
		// 								"scopes": to.Ptr("User.Read.All Group.Read.All"),
		// 							},
		// 						},
		// 						KeyVault: &armapimanagement.AuthorizationProviderKeyVaultContract{
		// 							LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{
		// 								Code: to.Ptr("Success"),
		// 								Message: to.Ptr("Successfully refreshed secret from Key Vault."),
		// 								TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
		// 							},
		// 							SecretIdentifier: to.Ptr("https://my.vault.azure.net/secrets/clientSecret"),
		// 							Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
		// 						},
		// 						RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("aadwithclientcred"),
		// 				Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithclientcred"),
		// 				Properties: &armapimanagement.AuthorizationProviderContractProperties{
		// 					DisplayName: to.Ptr("aadwithclientcred"),
		// 					IdentityProvider: to.Ptr("aad"),
		// 					Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
		// 						GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
		// 							ClientCredentials: map[string]*string{
		// 								"loginUri": to.Ptr("https://login.windows.net"),
		// 								"resourceUri": to.Ptr("https://graph.microsoft.com"),
		// 								"scopes": to.Ptr("User.Read.All Group.Read.All"),
		// 								"tenantId": to.Ptr("common"),
		// 							},
		// 						},
		// 						RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("google"),
		// 				Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/google"),
		// 				Properties: &armapimanagement.AuthorizationProviderContractProperties{
		// 					DisplayName: to.Ptr("google"),
		// 					IdentityProvider: to.Ptr("google"),
		// 					Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
		// 						GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
		// 							AuthorizationCode: map[string]*string{
		// 								"clientId": to.Ptr("99999999-xxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"),
		// 								"scopes": to.Ptr("openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"),
		// 							},
		// 						},
		// 						RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
		// 					},
		// 				},
		// 			},
		// 			{
		// 				Name: to.Ptr("eventbrite"),
		// 				Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
		// 				ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/eventbrite"),
		// 				Properties: &armapimanagement.AuthorizationProviderContractProperties{
		// 					DisplayName: to.Ptr("eventbrite"),
		// 					IdentityProvider: to.Ptr("oauth2"),
		// 					Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
		// 						GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
		// 							AuthorizationCode: map[string]*string{
		// 								"authorizationUrl": to.Ptr("https://www.eventbrite.com/oauth/authorize"),
		// 								"clientId": to.Ptr("clientid"),
		// 								"refreshUrl": to.Ptr("https://www.eventbrite.com/oauth/token"),
		// 								"tokenUrl": to.Ptr("https://www.eventbrite.com/oauth/token"),
		// 							},
		// 						},
		// 						RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
		// 					},
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}

// Generated from example definition: 2025-09-01-preview/ApiManagementRefreshAuthorizationProviderSecret.json
func ExampleAuthorizationProviderClient_RefreshSecret() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armapimanagement.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewAuthorizationProviderClient().RefreshSecret(ctx, "rg1", "apimService1", "aadwithkeyvault", 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 = armapimanagement.AuthorizationProviderClientRefreshSecretResponse{
	// 	AuthorizationProviderContract: armapimanagement.AuthorizationProviderContract{
	// 		Name: to.Ptr("aadwithkeyvault"),
	// 		Type: to.Ptr("Microsoft.ApiManagement/service/authorizationProviders"),
	// 		ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/authorizationProviders/aadwithkeyvault"),
	// 		Properties: &armapimanagement.AuthorizationProviderContractProperties{
	// 			DisplayName: to.Ptr("Azure AD with Key Vault"),
	// 			IdentityProvider: to.Ptr("aad"),
	// 			Oauth2: &armapimanagement.AuthorizationProviderOAuth2Settings{
	// 				GrantTypes: &armapimanagement.AuthorizationProviderOAuth2GrantTypes{
	// 					AuthorizationCode: map[string]*string{
	// 						"clientId": to.Ptr("53790825-fdd3-4b80-bc7a-4c3aaf25801d"),
	// 						"scopes": to.Ptr("User.Read.All Group.Read.All"),
	// 						"tenantId": to.Ptr("common"),
	// 					},
	// 				},
	// 				KeyVault: &armapimanagement.AuthorizationProviderKeyVaultContract{
	// 					LastStatus: &armapimanagement.KeyVaultLastAccessStatusContractProperties{
	// 						Code: to.Ptr("Success"),
	// 						Message: to.Ptr("Successfully refreshed secret from Key Vault."),
	// 						TimeStampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
	// 					},
	// 					SecretIdentifier: to.Ptr("https://my.vault.azure.net/secrets/clientSecret"),
	// 					Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-09-08T10:30:45.1234567Z"); return t}()),
	// 				},
	// 				RedirectURL: to.Ptr("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
	// 			},
	// 		},
	// 	},
	// }
}
