[Automation] Collect examples from azure-sdk-for-net#Azure.ResourceManager.ApiManagement_1.3.0-beta.1
This commit is contained in:
Родитель
5b6f88ed6d
Коммит
c110b16d37
|
@ -0,0 +1,40 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementApplyNetworkConfigurationUpdates.json
|
||||
// this example is just showing the usage of "ApiManagementService_ApplyNetworkConfigurationUpdates" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiManagementServiceApplyNetworkConfigurationContent content = new ApiManagementServiceApplyNetworkConfigurationContent()
|
||||
{
|
||||
Location = new AzureLocation("west us"),
|
||||
};
|
||||
ArmOperation<ApiManagementServiceResource> lro = await apiManagementService.ApplyNetworkConfigurationUpdatesAsync(WaitUntil.Completed, content: content);
|
||||
ApiManagementServiceResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementServiceData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementApproveOrRejectPrivateEndpointConnection.json
|
||||
// this example is just showing the usage of "PrivateEndpointConnection_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementPrivateEndpointConnectionResource created on azure
|
||||
// for more information of creating ApiManagementPrivateEndpointConnectionResource, please refer to the document of ApiManagementPrivateEndpointConnectionResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string privateEndpointConnectionName = "privateEndpointConnectionName";
|
||||
ResourceIdentifier apiManagementPrivateEndpointConnectionResourceId = ApiManagementPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, privateEndpointConnectionName);
|
||||
ApiManagementPrivateEndpointConnectionResource apiManagementPrivateEndpointConnection = client.GetApiManagementPrivateEndpointConnectionResource(apiManagementPrivateEndpointConnectionResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiManagementPrivateEndpointConnectionCreateOrUpdateContent content = new ApiManagementPrivateEndpointConnectionCreateOrUpdateContent()
|
||||
{
|
||||
Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/privateEndpointConnections/connectionName"),
|
||||
PrivateLinkServiceConnectionState = new ApiManagementPrivateLinkServiceConnectionState()
|
||||
{
|
||||
Status = ApiManagementPrivateEndpointServiceConnectionStatus.Approved,
|
||||
Description = "The Private Endpoint Connection is approved.",
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiManagementPrivateEndpointConnectionResource> lro = await apiManagementPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, content);
|
||||
ApiManagementPrivateEndpointConnectionResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementPrivateEndpointConnectionData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,30 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementAuthorizationServerListSecrets.json
|
||||
// this example is just showing the usage of "AuthorizationServer_ListSecrets" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementAuthorizationServerResource created on azure
|
||||
// for more information of creating ApiManagementAuthorizationServerResource, please refer to the document of ApiManagementAuthorizationServerResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authsid = "newauthServer2";
|
||||
ResourceIdentifier apiManagementAuthorizationServerResourceId = ApiManagementAuthorizationServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authsid);
|
||||
ApiManagementAuthorizationServerResource apiManagementAuthorizationServer = client.GetApiManagementAuthorizationServerResource(apiManagementAuthorizationServerResourceId);
|
||||
|
||||
// invoke the operation
|
||||
AuthorizationServerSecretsContract result = await apiManagementAuthorizationServer.GetSecretsAsync();
|
||||
|
||||
Console.WriteLine($"Succeeded: {result}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementBackendReconnect.json
|
||||
// this example is just showing the usage of "Backend_Reconnect" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementBackendResource created on azure
|
||||
// for more information of creating ApiManagementBackendResource, please refer to the document of ApiManagementBackendResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string backendId = "proxybackend";
|
||||
ResourceIdentifier apiManagementBackendResourceId = ApiManagementBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, backendId);
|
||||
ApiManagementBackendResource apiManagementBackend = client.GetApiManagementBackendResource(apiManagementBackendResourceId);
|
||||
|
||||
// invoke the operation
|
||||
BackendReconnectContract backendReconnectContract = new BackendReconnectContract()
|
||||
{
|
||||
After = XmlConvert.ToTimeSpan("PT3S"),
|
||||
};
|
||||
await apiManagementBackend.ReconnectAsync(backendReconnectContract: backendReconnectContract);
|
||||
|
||||
Console.WriteLine($"Succeeded");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,41 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementBackupWithAccessKey.json
|
||||
// this example is just showing the usage of "ApiManagementService_Backup" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiManagementServiceBackupRestoreContent content = new ApiManagementServiceBackupRestoreContent("teststorageaccount", "backupContainer", "apimService1backup_2017_03_19")
|
||||
{
|
||||
AccessType = StorageAccountAccessType.AccessKey,
|
||||
AccessKey = "**************************************************",
|
||||
};
|
||||
ArmOperation<ApiManagementServiceResource> lro = await apiManagementService.BackupAsync(WaitUntil.Completed, content);
|
||||
ApiManagementServiceResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementServiceData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,40 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementBackupWithSystemManagedIdentity.json
|
||||
// this example is just showing the usage of "ApiManagementService_Backup" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiManagementServiceBackupRestoreContent content = new ApiManagementServiceBackupRestoreContent("contosorpstorage", "apim-backups", "backup5")
|
||||
{
|
||||
AccessType = StorageAccountAccessType.SystemAssignedManagedIdentity,
|
||||
};
|
||||
ArmOperation<ApiManagementServiceResource> lro = await apiManagementService.BackupAsync(WaitUntil.Completed, content);
|
||||
ApiManagementServiceResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementServiceData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,41 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementBackupWithUserAssignedManagedIdentity.json
|
||||
// this example is just showing the usage of "ApiManagementService_Backup" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiManagementServiceBackupRestoreContent content = new ApiManagementServiceBackupRestoreContent("contosorpstorage", "apim-backups", "backup5")
|
||||
{
|
||||
AccessType = StorageAccountAccessType.UserAssignedManagedIdentity,
|
||||
ClientId = "XXXXX-a154-4830-XXXX-46a12da1a1e2",
|
||||
};
|
||||
ArmOperation<ApiManagementServiceResource> lro = await apiManagementService.BackupAsync(WaitUntil.Completed, content);
|
||||
ApiManagementServiceResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementServiceData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,47 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAILogger.json
|
||||
// this example is just showing the usage of "Logger_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementLoggerResource
|
||||
ApiManagementLoggerCollection collection = apiManagementService.GetApiManagementLoggers();
|
||||
|
||||
// invoke the operation
|
||||
string loggerId = "loggerId";
|
||||
ApiManagementLoggerData data = new ApiManagementLoggerData()
|
||||
{
|
||||
LoggerType = LoggerType.ApplicationInsights,
|
||||
Description = "adding a new logger",
|
||||
Credentials =
|
||||
{
|
||||
["instrumentationKey"] = "11................a1",
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiManagementLoggerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, loggerId, data);
|
||||
ApiManagementLoggerResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementLoggerData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,62 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApi.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "tempgroup";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "apidescription5200",
|
||||
AuthenticationSettings = new AuthenticationSettingsContract()
|
||||
{
|
||||
OAuth2 = new OAuth2AuthenticationSettingsContract()
|
||||
{
|
||||
AuthorizationServerId = "authorizationServerId2283",
|
||||
Scope = "oauth2scope2580",
|
||||
},
|
||||
},
|
||||
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
|
||||
{
|
||||
Header = "header4520",
|
||||
Query = "query3037",
|
||||
},
|
||||
DisplayName = "apiname1463",
|
||||
ServiceLink = "http://newechoapi.cloudapp.net/api",
|
||||
Path = "newapiPath",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,52 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiClone.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "echo-api2";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "Copy of Existing Echo Api including Operations.",
|
||||
IsCurrent = true,
|
||||
IsSubscriptionRequired = true,
|
||||
SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/58a4aeac497000007d040001"),
|
||||
DisplayName = "Echo API2",
|
||||
ServiceLink = "http://echoapi.cloudapp.net/api",
|
||||
Path = "echo2",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,87 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiDiagnostic.json
|
||||
// this example is just showing the usage of "ApiDiagnostic_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "57d1f7558aa04f15146d9d8a";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiDiagnosticResource
|
||||
ApiDiagnosticCollection collection = api.GetApiDiagnostics();
|
||||
|
||||
// invoke the operation
|
||||
string diagnosticId = "applicationinsights";
|
||||
DiagnosticContractData data = new DiagnosticContractData()
|
||||
{
|
||||
AlwaysLog = AlwaysLog.AllErrors,
|
||||
LoggerId = "/loggers/applicationinsights",
|
||||
Sampling = new SamplingSettings()
|
||||
{
|
||||
SamplingType = SamplingType.Fixed,
|
||||
Percentage = 50,
|
||||
},
|
||||
Frontend = new PipelineDiagnosticSettings()
|
||||
{
|
||||
Request = new HttpMessageDiagnostic()
|
||||
{
|
||||
Headers =
|
||||
{
|
||||
"Content-type"
|
||||
},
|
||||
BodyBytes = 512,
|
||||
},
|
||||
Response = new HttpMessageDiagnostic()
|
||||
{
|
||||
Headers =
|
||||
{
|
||||
"Content-type"
|
||||
},
|
||||
BodyBytes = 512,
|
||||
},
|
||||
},
|
||||
Backend = new PipelineDiagnosticSettings()
|
||||
{
|
||||
Request = new HttpMessageDiagnostic()
|
||||
{
|
||||
Headers =
|
||||
{
|
||||
"Content-type"
|
||||
},
|
||||
BodyBytes = 512,
|
||||
},
|
||||
Response = new HttpMessageDiagnostic()
|
||||
{
|
||||
Headers =
|
||||
{
|
||||
"Content-type"
|
||||
},
|
||||
BodyBytes = 512,
|
||||
},
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiDiagnosticResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, diagnosticId, data);
|
||||
ApiDiagnosticResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
DiagnosticContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,47 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiIssue.json
|
||||
// this example is just showing the usage of "ApiIssue_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "57d1f7558aa04f15146d9d8a";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiIssueResource
|
||||
ApiIssueCollection collection = api.GetApiIssues();
|
||||
|
||||
// invoke the operation
|
||||
string issueId = "57d2ef278aa04f0ad01d6cdc";
|
||||
IssueContractData data = new IssueContractData()
|
||||
{
|
||||
CreatedOn = DateTimeOffset.Parse("2018-02-01T22:21:20.467Z"),
|
||||
State = IssueState.Open,
|
||||
Title = "New API issue",
|
||||
Description = "New API issue description",
|
||||
UserId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"),
|
||||
};
|
||||
ArmOperation<ApiIssueResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, issueId, data);
|
||||
ApiIssueResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
IssueContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,42 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiIssueAttachment.json
|
||||
// this example is just showing the usage of "ApiIssueAttachment_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiIssueAttachmentResource created on azure
|
||||
// for more information of creating ApiIssueAttachmentResource, please refer to the document of ApiIssueAttachmentResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "57d1f7558aa04f15146d9d8a";
|
||||
string issueId = "57d2ef278aa04f0ad01d6cdc";
|
||||
string attachmentId = "57d2ef278aa04f0888cba3f3";
|
||||
ResourceIdentifier apiIssueAttachmentResourceId = ApiIssueAttachmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, issueId, attachmentId);
|
||||
ApiIssueAttachmentResource apiIssueAttachment = client.GetApiIssueAttachmentResource(apiIssueAttachmentResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiIssueAttachmentData data = new ApiIssueAttachmentData()
|
||||
{
|
||||
Title = "Issue attachment.",
|
||||
ContentFormat = "image/jpeg",
|
||||
Content = "IEJhc2U2NA==",
|
||||
};
|
||||
ArmOperation<ApiIssueAttachmentResource> lro = await apiIssueAttachment.UpdateAsync(WaitUntil.Completed, data);
|
||||
ApiIssueAttachmentResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiIssueAttachmentData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,42 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiIssueComment.json
|
||||
// this example is just showing the usage of "ApiIssueComment_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiIssueCommentResource created on azure
|
||||
// for more information of creating ApiIssueCommentResource, please refer to the document of ApiIssueCommentResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "57d1f7558aa04f15146d9d8a";
|
||||
string issueId = "57d2ef278aa04f0ad01d6cdc";
|
||||
string commentId = "599e29ab193c3c0bd0b3e2fb";
|
||||
ResourceIdentifier apiIssueCommentResourceId = ApiIssueCommentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, issueId, commentId);
|
||||
ApiIssueCommentResource apiIssueComment = client.GetApiIssueCommentResource(apiIssueCommentResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ApiIssueCommentData data = new ApiIssueCommentData()
|
||||
{
|
||||
Text = "Issue comment.",
|
||||
CreatedOn = DateTimeOffset.Parse("2018-02-01T22:21:20.467Z"),
|
||||
UserId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/1"),
|
||||
};
|
||||
ArmOperation<ApiIssueCommentResource> lro = await apiIssueComment.UpdateAsync(WaitUntil.Completed, data);
|
||||
ApiIssueCommentResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiIssueCommentData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,54 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiNewVersionUsingExistingApi.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "echoapiv3";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "Create Echo API into a new Version using Existing Version Set and Copy all Operations.",
|
||||
ApiVersion = "v4",
|
||||
IsCurrent = true,
|
||||
ApiVersionSetId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apiVersionSets/aa9c59e6-c0cd-4258-9356-9ca7d2f0b458"),
|
||||
IsSubscriptionRequired = true,
|
||||
SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echoPath"),
|
||||
DisplayName = "Echo API2",
|
||||
ServiceLink = "http://echoapi.cloudapp.net/api",
|
||||
Path = "echo2",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Http,ApiOperationInvokableProtocol.Https
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,81 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiOperation.json
|
||||
// this example is just showing the usage of "ApiOperation_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "PetStoreTemplate2";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiOperationResource
|
||||
ApiOperationCollection collection = api.GetApiOperations();
|
||||
|
||||
// invoke the operation
|
||||
string operationId = "newoperations";
|
||||
ApiOperationData data = new ApiOperationData()
|
||||
{
|
||||
TemplateParameters =
|
||||
{
|
||||
},
|
||||
Description = "This can only be done by the logged in user.",
|
||||
Request = new RequestContract()
|
||||
{
|
||||
Description = "Created user object",
|
||||
QueryParameters =
|
||||
{
|
||||
},
|
||||
Headers =
|
||||
{
|
||||
},
|
||||
Representations =
|
||||
{
|
||||
new RepresentationContract("application/json")
|
||||
{
|
||||
SchemaId = "592f6c1d0af5840ca8897f0c",
|
||||
TypeName = "User",
|
||||
}
|
||||
},
|
||||
},
|
||||
Responses =
|
||||
{
|
||||
new ResponseContract(200)
|
||||
{
|
||||
Description = "successful operation",
|
||||
Representations =
|
||||
{
|
||||
new RepresentationContract("application/xml"),new RepresentationContract("application/json")
|
||||
},
|
||||
Headers =
|
||||
{
|
||||
},
|
||||
}
|
||||
},
|
||||
DisplayName = "createUser2",
|
||||
Method = "POST",
|
||||
UriTemplate = "/user1",
|
||||
};
|
||||
ArmOperation<ApiOperationResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, operationId, data);
|
||||
ApiOperationResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiOperationData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,43 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiOperationPolicy.json
|
||||
// this example is just showing the usage of "ApiOperationPolicy_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiOperationPolicyResource created on azure
|
||||
// for more information of creating ApiOperationPolicyResource, please refer to the document of ApiOperationPolicyResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5600b57e7e8880006a040001";
|
||||
string operationId = "5600b57e7e8880006a080001";
|
||||
PolicyName policyId = PolicyName.Policy;
|
||||
ResourceIdentifier apiOperationPolicyResourceId = ApiOperationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId, policyId);
|
||||
ApiOperationPolicyResource apiOperationPolicy = client.GetApiOperationPolicyResource(apiOperationPolicyResourceId);
|
||||
|
||||
// invoke the operation
|
||||
PolicyContractData data = new PolicyContractData()
|
||||
{
|
||||
Value = "<policies> <inbound /> <backend> <forward-request /> </backend> <outbound /></policies>",
|
||||
Format = PolicyContentFormat.Xml,
|
||||
};
|
||||
ETag? ifMatch = new ETag("*");
|
||||
ArmOperation<ApiOperationPolicyResource> lro = await apiOperationPolicy.UpdateAsync(WaitUntil.Completed, data, ifMatch: ifMatch);
|
||||
ApiOperationPolicyResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
PolicyContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,36 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiOperationTag.json
|
||||
// this example is just showing the usage of "Tag_AssignToOperation" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiOperationTagResource created on azure
|
||||
// for more information of creating ApiOperationTagResource, please refer to the document of ApiOperationTagResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5931a75ae4bbd512a88c680b";
|
||||
string operationId = "5931a75ae4bbd512a88c680a";
|
||||
string tagId = "tagId1";
|
||||
ResourceIdentifier apiOperationTagResourceId = ApiOperationTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, operationId, tagId);
|
||||
ApiOperationTagResource apiOperationTag = client.GetApiOperationTagResource(apiOperationTagResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ArmOperation<ApiOperationTagResource> lro = await apiOperationTag.UpdateAsync(WaitUntil.Completed);
|
||||
ApiOperationTagResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
TagContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiPolicy.json
|
||||
// this example is just showing the usage of "ApiPolicy_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5600b57e7e8880006a040001";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiPolicyResource
|
||||
ApiPolicyCollection collection = api.GetApiPolicies();
|
||||
|
||||
// invoke the operation
|
||||
PolicyName policyId = PolicyName.Policy;
|
||||
PolicyContractData data = new PolicyContractData()
|
||||
{
|
||||
Value = "<policies> <inbound /> <backend> <forward-request /> </backend> <outbound /></policies>",
|
||||
Format = PolicyContentFormat.Xml,
|
||||
};
|
||||
ETag? ifMatch = new ETag("*");
|
||||
ArmOperation<ApiPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch);
|
||||
ApiPolicyResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
PolicyContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiPolicyNonXmlEncoded.json
|
||||
// this example is just showing the usage of "ApiPolicy_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5600b57e7e8880006a040001";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiPolicyResource
|
||||
ApiPolicyCollection collection = api.GetApiPolicies();
|
||||
|
||||
// invoke the operation
|
||||
PolicyName policyId = PolicyName.Policy;
|
||||
PolicyContractData data = new PolicyContractData()
|
||||
{
|
||||
Value = "<policies>\r\n <inbound>\r\n <base />\r\n <set-header name=\"newvalue\" exists-action=\"override\">\r\n <value>\"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" </value>\r\n </set-header>\r\n </inbound>\r\n </policies>",
|
||||
Format = PolicyContentFormat.RawXml,
|
||||
};
|
||||
ETag? ifMatch = new ETag("*");
|
||||
ArmOperation<ApiPolicyResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyId, data, ifMatch: ifMatch);
|
||||
ApiPolicyResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
PolicyContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,43 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiRelease.json
|
||||
// this example is just showing the usage of "ApiRelease_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "a1";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiReleaseResource
|
||||
ApiReleaseCollection collection = api.GetApiReleases();
|
||||
|
||||
// invoke the operation
|
||||
string releaseId = "testrev";
|
||||
ApiReleaseData data = new ApiReleaseData()
|
||||
{
|
||||
ApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/a1"),
|
||||
Notes = "yahooagain",
|
||||
};
|
||||
ArmOperation<ApiReleaseResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, releaseId, data);
|
||||
ApiReleaseResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiReleaseData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiRevisionFromExistingApi.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "echo-api;rev=3";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
ApiRevisionDescription = "Creating a Revision of an existing API",
|
||||
SourceApiId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api"),
|
||||
ServiceLink = "http://echoapi.cloudapp.net/apiv3",
|
||||
Path = "echo",
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiTag.json
|
||||
// this example is just showing the usage of "Tag_AssignToApi" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiTagResource created on azure
|
||||
// for more information of creating ApiTagResource, please refer to the document of ApiTagResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5931a75ae4bbd512a88c680b";
|
||||
string tagId = "tagId1";
|
||||
ResourceIdentifier apiTagResourceId = ApiTagResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId, tagId);
|
||||
ApiTagResource apiTag = client.GetApiTagResource(apiTagResourceId);
|
||||
|
||||
// invoke the operation
|
||||
ArmOperation<ApiTagResource> lro = await apiTag.UpdateAsync(WaitUntil.Completed);
|
||||
ApiTagResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
TagContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiTagDescription.json
|
||||
// this example is just showing the usage of "ApiTagDescription_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiResource created on azure
|
||||
// for more information of creating ApiResource, please refer to the document of ApiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "5931a75ae4bbd512a88c680b";
|
||||
ResourceIdentifier apiResourceId = ApiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ApiResource api = client.GetApiResource(apiResourceId);
|
||||
|
||||
// get the collection of this ApiTagDescriptionResource
|
||||
ApiTagDescriptionCollection collection = api.GetApiTagDescriptions();
|
||||
|
||||
// invoke the operation
|
||||
string tagDescriptionId = "tagId1";
|
||||
ApiTagDescriptionCreateOrUpdateContent content = new ApiTagDescriptionCreateOrUpdateContent()
|
||||
{
|
||||
Description = "Some description that will be displayed for operation's tag if the tag is assigned to operation of the API",
|
||||
ExternalDocsUri = new Uri("http://some.url/additionaldoc"),
|
||||
ExternalDocsDescription = "Description of the external docs resource",
|
||||
};
|
||||
ArmOperation<ApiTagDescriptionResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, tagDescriptionId, content);
|
||||
ApiTagDescriptionResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiTagDescriptionData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiUsingImportOverrideServiceUrl.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "apidocs";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
ServiceLink = "http://petstore.swagger.wordnik.com/api",
|
||||
Path = "petstoreapi123",
|
||||
Value = "http://apimpimportviaurl.azurewebsites.net/api/apidocs/",
|
||||
Format = new ContentFormat("swagger-link"),
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiUsingOai3Import.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "petstore";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Path = "petstore",
|
||||
Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
|
||||
Format = ContentFormat.OpenApiLink,
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,45 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiUsingOai3ImportWithTranslateRequiredQueryParametersConduct.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "petstore";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Path = "petstore",
|
||||
Value = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml",
|
||||
Format = ContentFormat.OpenApiLink,
|
||||
TranslateRequiredQueryParametersConduct = TranslateRequiredQueryParametersConduct.Template,
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiUsingSwaggerImport.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "petstore";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Path = "petstore",
|
||||
Value = "http://petstore.swagger.io/v2/swagger.json",
|
||||
Format = ContentFormat.SwaggerLinkJson,
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiUsingWadlImport.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "petstore";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Path = "collector",
|
||||
Value = "https://developer.cisco.com/media/wae-release-6-2-api-reference/wae-collector-rest-api/application.wadl",
|
||||
Format = ContentFormat.WadlLinkJson,
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiVersionSet.json
|
||||
// this example is just showing the usage of "ApiVersionSet_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiVersionSetResource
|
||||
ApiVersionSetCollection collection = apiManagementService.GetApiVersionSets();
|
||||
|
||||
// invoke the operation
|
||||
string versionSetId = "api1";
|
||||
ApiVersionSetData data = new ApiVersionSetData()
|
||||
{
|
||||
Description = "Version configuration",
|
||||
DisplayName = "api set 1",
|
||||
VersioningScheme = VersioningScheme.Segment,
|
||||
};
|
||||
ArmOperation<ApiVersionSetResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, versionSetId, data);
|
||||
ApiVersionSetResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiVersionSetData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,48 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiWiki.json
|
||||
// this example is just showing the usage of "ApiWiki_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ServiceApiWikiResource created on azure
|
||||
// for more information of creating ServiceApiWikiResource, please refer to the document of ServiceApiWikiResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string apiId = "57d1f7558aa04f15146d9d8a";
|
||||
ResourceIdentifier serviceApiWikiResourceId = ServiceApiWikiResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, apiId);
|
||||
ServiceApiWikiResource serviceApiWiki = client.GetServiceApiWikiResource(serviceApiWikiResourceId);
|
||||
|
||||
// invoke the operation
|
||||
WikiContractData data = new WikiContractData()
|
||||
{
|
||||
Documents =
|
||||
{
|
||||
new WikiDocumentationContract()
|
||||
{
|
||||
DocumentationId = "docId1",
|
||||
},new WikiDocumentationContract()
|
||||
{
|
||||
DocumentationId = "docId2",
|
||||
}
|
||||
},
|
||||
};
|
||||
ArmOperation<ServiceApiWikiResource> lro = await serviceApiWiki.CreateOrUpdateAsync(WaitUntil.Completed, data);
|
||||
ServiceApiWikiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
WikiContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,69 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiWithMultipleAuthServers.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "tempgroup";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "apidescription5200",
|
||||
AuthenticationSettings = new AuthenticationSettingsContract()
|
||||
{
|
||||
OAuth2AuthenticationSettings =
|
||||
{
|
||||
new OAuth2AuthenticationSettingsContract()
|
||||
{
|
||||
AuthorizationServerId = "authorizationServerId2283",
|
||||
Scope = "oauth2scope2580",
|
||||
},new OAuth2AuthenticationSettingsContract()
|
||||
{
|
||||
AuthorizationServerId = "authorizationServerId2284",
|
||||
Scope = "oauth2scope2581",
|
||||
}
|
||||
},
|
||||
},
|
||||
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
|
||||
{
|
||||
Header = "header4520",
|
||||
Query = "query3037",
|
||||
},
|
||||
DisplayName = "apiname1463",
|
||||
ServiceLink = "http://newechoapi.cloudapp.net/api",
|
||||
Path = "newapiPath",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,75 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiWithMultipleOpenIdConnectProviders.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "tempgroup";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "apidescription5200",
|
||||
AuthenticationSettings = new AuthenticationSettingsContract()
|
||||
{
|
||||
OpenidAuthenticationSettings =
|
||||
{
|
||||
new OpenIdAuthenticationSettingsContract()
|
||||
{
|
||||
OpenIdProviderId = "openidProviderId2283",
|
||||
BearerTokenSendingMethods =
|
||||
{
|
||||
BearerTokenSendingMethod.AuthorizationHeader
|
||||
},
|
||||
},new OpenIdAuthenticationSettingsContract()
|
||||
{
|
||||
OpenIdProviderId = "openidProviderId2284",
|
||||
BearerTokenSendingMethods =
|
||||
{
|
||||
BearerTokenSendingMethod.AuthorizationHeader
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
|
||||
{
|
||||
Header = "header4520",
|
||||
Query = "query3037",
|
||||
},
|
||||
DisplayName = "apiname1463",
|
||||
ServiceLink = "http://newechoapi.cloudapp.net/api",
|
||||
Path = "newapiPath",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Https,ApiOperationInvokableProtocol.Http
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,65 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateApiWithOpenIdConnect.json
|
||||
// this example is just showing the usage of "Api_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiResource
|
||||
ApiCollection collection = apiManagementService.GetApis();
|
||||
|
||||
// invoke the operation
|
||||
string apiId = "tempgroup";
|
||||
ApiCreateOrUpdateContent content = new ApiCreateOrUpdateContent()
|
||||
{
|
||||
Description = "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
AuthenticationSettings = new AuthenticationSettingsContract()
|
||||
{
|
||||
OpenId = new OpenIdAuthenticationSettingsContract()
|
||||
{
|
||||
OpenIdProviderId = "testopenid",
|
||||
BearerTokenSendingMethods =
|
||||
{
|
||||
BearerTokenSendingMethod.AuthorizationHeader
|
||||
},
|
||||
},
|
||||
},
|
||||
SubscriptionKeyParameterNames = new SubscriptionKeyParameterNamesContract()
|
||||
{
|
||||
Header = "Ocp-Apim-Subscription-Key",
|
||||
Query = "subscription-key",
|
||||
},
|
||||
DisplayName = "Swagger Petstore",
|
||||
ServiceLink = "http://petstore.swagger.io/v2",
|
||||
Path = "petstore",
|
||||
Protocols =
|
||||
{
|
||||
ApiOperationInvokableProtocol.Https
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, apiId, content);
|
||||
ApiResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationAADAuthCode.json
|
||||
// this example is just showing the usage of "Authorization_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "aadwithauthcode";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// get the collection of this AuthorizationContractResource
|
||||
AuthorizationContractCollection collection = authorizationProviderContract.GetAuthorizationContracts();
|
||||
|
||||
// invoke the operation
|
||||
string authorizationId = "authz2";
|
||||
AuthorizationContractData data = new AuthorizationContractData()
|
||||
{
|
||||
AuthorizationType = ApiManagementAuthorizationType.OAuth2,
|
||||
OAuth2GrantType = OAuth2GrantType.AuthorizationCode,
|
||||
};
|
||||
ArmOperation<AuthorizationContractResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationId, data);
|
||||
AuthorizationContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,49 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationAADClientCred.json
|
||||
// this example is just showing the usage of "Authorization_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "aadwithclientcred";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// get the collection of this AuthorizationContractResource
|
||||
AuthorizationContractCollection collection = authorizationProviderContract.GetAuthorizationContracts();
|
||||
|
||||
// invoke the operation
|
||||
string authorizationId = "authz1";
|
||||
AuthorizationContractData data = new AuthorizationContractData()
|
||||
{
|
||||
AuthorizationType = ApiManagementAuthorizationType.OAuth2,
|
||||
OAuth2GrantType = OAuth2GrantType.AuthorizationCode,
|
||||
Parameters =
|
||||
{
|
||||
["clientId"] = "53790925-fdd3-4b80-bc7a-4c3aaf25801d",
|
||||
["clientSecret"] = "xxxxxxxxxxxxxxx~xxxxxxxxx",
|
||||
},
|
||||
};
|
||||
ArmOperation<AuthorizationContractResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationId, data);
|
||||
AuthorizationContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationAccessPolicy.json
|
||||
// this example is just showing the usage of "AuthorizationAccessPolicy_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationContractResource created on azure
|
||||
// for more information of creating AuthorizationContractResource, please refer to the document of AuthorizationContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "aadwithauthcode";
|
||||
string authorizationId = "authz1";
|
||||
ResourceIdentifier authorizationContractResourceId = AuthorizationContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId, authorizationId);
|
||||
AuthorizationContractResource authorizationContract = client.GetAuthorizationContractResource(authorizationContractResourceId);
|
||||
|
||||
// get the collection of this AuthorizationAccessPolicyContractResource
|
||||
AuthorizationAccessPolicyContractCollection collection = authorizationContract.GetAuthorizationAccessPolicyContracts();
|
||||
|
||||
// invoke the operation
|
||||
string authorizationAccessPolicyId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab";
|
||||
AuthorizationAccessPolicyContractData data = new AuthorizationAccessPolicyContractData()
|
||||
{
|
||||
TenantId = Guid.Parse("13932a0d-5c63-4d37-901d-1df9c97722ff"),
|
||||
ObjectId = "fe0bed83-631f-4149-bd0b-0464b1bc7cab",
|
||||
};
|
||||
ArmOperation<AuthorizationAccessPolicyContractResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authorizationAccessPolicyId, data);
|
||||
AuthorizationAccessPolicyContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationAccessPolicyContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,54 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationProviderAADAuthCode.json
|
||||
// this example is just showing the usage of "AuthorizationProvider_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "aadwithauthcode";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// invoke the operation
|
||||
AuthorizationProviderContractData data = new AuthorizationProviderContractData()
|
||||
{
|
||||
DisplayName = "aadwithauthcode",
|
||||
IdentityProvider = "aad",
|
||||
Oauth2 = new AuthorizationProviderOAuth2Settings()
|
||||
{
|
||||
RedirectUri = new Uri("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
|
||||
GrantTypes = new AuthorizationProviderOAuth2GrantTypes()
|
||||
{
|
||||
AuthorizationCode =
|
||||
{
|
||||
["clientId"] = "59790825-fdd3-4b10-bc7a-4c3aaf25801d",
|
||||
["clientSecret"] = "xxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
["resourceUri"] = "https://graph.microsoft.com",
|
||||
["scopes"] = "User.Read.All Group.Read.All",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
ArmOperation<AuthorizationProviderContractResource> lro = await authorizationProviderContract.UpdateAsync(WaitUntil.Completed, data);
|
||||
AuthorizationProviderContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationProviderContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,52 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationProviderAADClientCred.json
|
||||
// this example is just showing the usage of "AuthorizationProvider_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "aadwithclientcred";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// invoke the operation
|
||||
AuthorizationProviderContractData data = new AuthorizationProviderContractData()
|
||||
{
|
||||
DisplayName = "aadwithclientcred",
|
||||
IdentityProvider = "aad",
|
||||
Oauth2 = new AuthorizationProviderOAuth2Settings()
|
||||
{
|
||||
RedirectUri = new Uri("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
|
||||
GrantTypes = new AuthorizationProviderOAuth2GrantTypes()
|
||||
{
|
||||
AuthorizationCode =
|
||||
{
|
||||
["resourceUri"] = "https://graph.microsoft.com",
|
||||
["scopes"] = "User.Read.All Group.Read.All",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
ArmOperation<AuthorizationProviderContractResource> lro = await authorizationProviderContract.UpdateAsync(WaitUntil.Completed, data);
|
||||
AuthorizationProviderContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationProviderContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,56 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationProviderGenericOAuth2.json
|
||||
// this example is just showing the usage of "AuthorizationProvider_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "eventbrite";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// invoke the operation
|
||||
AuthorizationProviderContractData data = new AuthorizationProviderContractData()
|
||||
{
|
||||
DisplayName = "eventbrite",
|
||||
IdentityProvider = "oauth2",
|
||||
Oauth2 = new AuthorizationProviderOAuth2Settings()
|
||||
{
|
||||
RedirectUri = new Uri("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
|
||||
GrantTypes = new AuthorizationProviderOAuth2GrantTypes()
|
||||
{
|
||||
AuthorizationCode =
|
||||
{
|
||||
["authorizationUrl"] = "https://www.eventbrite.com/oauth/authorize",
|
||||
["clientId"] = "genericClientId",
|
||||
["clientSecret"] = "xxxxxxxxxxxxxxxxxxxxxxxx",
|
||||
["refreshUrl"] = "https://www.eventbrite.com/oauth/token",
|
||||
["scopes"] = null,
|
||||
["tokenUrl"] = "https://www.eventbrite.com/oauth/token",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
ArmOperation<AuthorizationProviderContractResource> lro = await authorizationProviderContract.UpdateAsync(WaitUntil.Completed, data);
|
||||
AuthorizationProviderContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationProviderContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,53 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationProviderOOBGoogle.json
|
||||
// this example is just showing the usage of "AuthorizationProvider_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this AuthorizationProviderContractResource created on azure
|
||||
// for more information of creating AuthorizationProviderContractResource, please refer to the document of AuthorizationProviderContractResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
string authorizationProviderId = "google";
|
||||
ResourceIdentifier authorizationProviderContractResourceId = AuthorizationProviderContractResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName, authorizationProviderId);
|
||||
AuthorizationProviderContractResource authorizationProviderContract = client.GetAuthorizationProviderContractResource(authorizationProviderContractResourceId);
|
||||
|
||||
// invoke the operation
|
||||
AuthorizationProviderContractData data = new AuthorizationProviderContractData()
|
||||
{
|
||||
DisplayName = "google",
|
||||
IdentityProvider = "google",
|
||||
Oauth2 = new AuthorizationProviderOAuth2Settings()
|
||||
{
|
||||
RedirectUri = new Uri("https://authorization-manager.consent.azure-apim.net/redirect/apim/apimService1"),
|
||||
GrantTypes = new AuthorizationProviderOAuth2GrantTypes()
|
||||
{
|
||||
AuthorizationCode =
|
||||
{
|
||||
["clientId"] = "99999999-xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
|
||||
["clientSecret"] = "XXXXXXXXXXXXXXXXXXXX",
|
||||
["scopes"] = "openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
ArmOperation<AuthorizationProviderContractResource> lro = await authorizationProviderContract.UpdateAsync(WaitUntil.Completed, data);
|
||||
AuthorizationProviderContractResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
AuthorizationProviderContractData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,66 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateAuthorizationServer.json
|
||||
// this example is just showing the usage of "AuthorizationServer_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementAuthorizationServerResource
|
||||
ApiManagementAuthorizationServerCollection collection = apiManagementService.GetApiManagementAuthorizationServers();
|
||||
|
||||
// invoke the operation
|
||||
string authsid = "newauthServer";
|
||||
ApiManagementAuthorizationServerData data = new ApiManagementAuthorizationServerData()
|
||||
{
|
||||
Description = "test server",
|
||||
AuthorizationMethods =
|
||||
{
|
||||
AuthorizationMethod.Get
|
||||
},
|
||||
TokenEndpoint = "https://www.contoso.com/oauth2/token",
|
||||
DoesSupportState = true,
|
||||
DefaultScope = "read write",
|
||||
BearerTokenSendingMethods =
|
||||
{
|
||||
BearerTokenSendingMethod.AuthorizationHeader
|
||||
},
|
||||
ResourceOwnerUsername = "un",
|
||||
ResourceOwnerPassword = "pwd",
|
||||
DisplayName = "test2",
|
||||
UseInTestConsole = false,
|
||||
UseInApiDocumentation = true,
|
||||
ClientRegistrationEndpoint = "https://www.contoso.com/apps",
|
||||
AuthorizationEndpoint = "https://www.contoso.com/oauth2/auth",
|
||||
GrantTypes =
|
||||
{
|
||||
GrantType.AuthorizationCode,GrantType.Implicit
|
||||
},
|
||||
ClientId = "1",
|
||||
ClientSecret = "2",
|
||||
};
|
||||
ArmOperation<ApiManagementAuthorizationServerResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, authsid, data);
|
||||
ApiManagementAuthorizationServerResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementAuthorizationServerData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,72 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateBackendProxyBackend.json
|
||||
// this example is just showing the usage of "Backend_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementBackendResource
|
||||
ApiManagementBackendCollection collection = apiManagementService.GetApiManagementBackends();
|
||||
|
||||
// invoke the operation
|
||||
string backendId = "proxybackend";
|
||||
ApiManagementBackendData data = new ApiManagementBackendData()
|
||||
{
|
||||
Description = "description5308",
|
||||
Credentials = new BackendCredentialsContract()
|
||||
{
|
||||
Query =
|
||||
{
|
||||
["sv"] = new string[]
|
||||
{
|
||||
"xx","bb","cc"
|
||||
},
|
||||
},
|
||||
Header =
|
||||
{
|
||||
["x-my-1"] = new string[]
|
||||
{
|
||||
"val1","val2"
|
||||
},
|
||||
},
|
||||
Authorization = new BackendAuthorizationHeaderCredentials("Basic", "opensesma"),
|
||||
},
|
||||
Proxy = new BackendProxyContract(new Uri("http://192.168.1.1:8080"))
|
||||
{
|
||||
Username = "Contoso\\admin",
|
||||
Password = "<password>",
|
||||
},
|
||||
Tls = new BackendTlsProperties()
|
||||
{
|
||||
ShouldValidateCertificateChain = true,
|
||||
ShouldValidateCertificateName = true,
|
||||
},
|
||||
Uri = new Uri("https://backendname2644/"),
|
||||
Protocol = BackendProtocol.Http,
|
||||
};
|
||||
ArmOperation<ApiManagementBackendResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, backendId, data);
|
||||
ApiManagementBackendResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementBackendData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,60 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateBackendServiceFabric.json
|
||||
// this example is just showing the usage of "Backend_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementBackendResource
|
||||
ApiManagementBackendCollection collection = apiManagementService.GetApiManagementBackends();
|
||||
|
||||
// invoke the operation
|
||||
string backendId = "sfbackend";
|
||||
ApiManagementBackendData data = new ApiManagementBackendData()
|
||||
{
|
||||
Description = "Service Fabric Test App 1",
|
||||
BackendServiceFabricCluster = new BackendServiceFabricClusterProperties(new string[]
|
||||
{
|
||||
"https://somecluster.com"
|
||||
})
|
||||
{
|
||||
ClientCertificateId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/certificates/cert1",
|
||||
MaxPartitionResolutionRetries = 5,
|
||||
ServerX509Names =
|
||||
{
|
||||
new X509CertificateName()
|
||||
{
|
||||
Name = "ServerCommonName1",
|
||||
IssuerCertificateThumbprint = "IssuerCertificateThumbprint1",
|
||||
}
|
||||
},
|
||||
},
|
||||
Uri = new Uri("fabric:/mytestapp/mytestservice"),
|
||||
Protocol = BackendProtocol.Http,
|
||||
};
|
||||
ArmOperation<ApiManagementBackendResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, backendId, data);
|
||||
ApiManagementBackendResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementBackendData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,44 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateCache.json
|
||||
// this example is just showing the usage of "Cache_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementCacheResource
|
||||
ApiManagementCacheCollection collection = apiManagementService.GetApiManagementCaches();
|
||||
|
||||
// invoke the operation
|
||||
string cacheId = "c1";
|
||||
ApiManagementCacheData data = new ApiManagementCacheData()
|
||||
{
|
||||
Description = "Redis cache instances in West India",
|
||||
ConnectionString = "apim.redis.cache.windows.net:6380,password=xc,ssl=True,abortConnect=False",
|
||||
UseFromLocation = "default",
|
||||
ResourceUri = new Uri("https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redis/apimservice1"),
|
||||
};
|
||||
ArmOperation<ApiManagementCacheResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, cacheId, data);
|
||||
ApiManagementCacheResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementCacheData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,43 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateCertificate.json
|
||||
// this example is just showing the usage of "Certificate_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementCertificateResource
|
||||
ApiManagementCertificateCollection collection = apiManagementService.GetApiManagementCertificates();
|
||||
|
||||
// invoke the operation
|
||||
string certificateId = "tempcert";
|
||||
ApiManagementCertificateCreateOrUpdateContent content = new ApiManagementCertificateCreateOrUpdateContent()
|
||||
{
|
||||
Data = "****************Base 64 Encoded Certificate *******************************",
|
||||
Password = "****Certificate Password******",
|
||||
};
|
||||
ArmOperation<ApiManagementCertificateResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, certificateId, content);
|
||||
ApiManagementCertificateResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementCertificateData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,46 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateCertificateWithKeyVault.json
|
||||
// this example is just showing the usage of "Certificate_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// get the collection of this ApiManagementCertificateResource
|
||||
ApiManagementCertificateCollection collection = apiManagementService.GetApiManagementCertificates();
|
||||
|
||||
// invoke the operation
|
||||
string certificateId = "templateCertkv";
|
||||
ApiManagementCertificateCreateOrUpdateContent content = new ApiManagementCertificateCreateOrUpdateContent()
|
||||
{
|
||||
KeyVaultDetails = new KeyVaultContractCreateProperties()
|
||||
{
|
||||
SecretIdentifier = "https://rpbvtkeyvaultintegration.vault-int.azure-int.net/secrets/msitestingCert",
|
||||
IdentityClientId = "ceaa6b06-c00f-43ef-99ac-f53d1fe876a0",
|
||||
},
|
||||
};
|
||||
ArmOperation<ApiManagementCertificateResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, certificateId, content);
|
||||
ApiManagementCertificateResource result = lro.Value;
|
||||
|
||||
// the variable result is a resource, you could call other operations on this instance as well
|
||||
// but just for demo, we get its data from this resource instance
|
||||
ApiManagementCertificateData resourceData = result.Data;
|
||||
// for demo we just print out the id
|
||||
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,32 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateContentType.json
|
||||
// this example is just showing the usage of "ContentType_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
string contentTypeId = "page";
|
||||
ApiManagementContentType result = await apiManagementService.CreateOrUpdateContentTypeAsync(contentTypeId);
|
||||
|
||||
Console.WriteLine($"Succeeded: {result}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
|
@ -0,0 +1,33 @@
|
|||
using Azure;
|
||||
using Azure.ResourceManager;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using Azure.Core;
|
||||
using Azure.Identity;
|
||||
using Azure.ResourceManager.ApiManagement.Models;
|
||||
using Azure.ResourceManager.Resources;
|
||||
using Azure.ResourceManager.ApiManagement;
|
||||
|
||||
// Generated from example definition: specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2023-03-01-preview/examples/ApiManagementCreateContentTypeContentItem.json
|
||||
// this example is just showing the usage of "ContentItem_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
|
||||
|
||||
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
|
||||
TokenCredential cred = new DefaultAzureCredential();
|
||||
// authenticate your client
|
||||
ArmClient client = new ArmClient(cred);
|
||||
|
||||
// this example assumes you already have this ApiManagementServiceResource created on azure
|
||||
// for more information of creating ApiManagementServiceResource, please refer to the document of ApiManagementServiceResource
|
||||
string subscriptionId = "00000000-0000-0000-0000-000000000000";
|
||||
string resourceGroupName = "rg1";
|
||||
string serviceName = "apimService1";
|
||||
ResourceIdentifier apiManagementServiceResourceId = ApiManagementServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serviceName);
|
||||
ApiManagementServiceResource apiManagementService = client.GetApiManagementServiceResource(apiManagementServiceResourceId);
|
||||
|
||||
// invoke the operation
|
||||
string contentTypeId = "page";
|
||||
string contentItemId = "4e3cf6a5-574a-ba08-1f23-2e7a38faa6d8";
|
||||
ApiManagementContentItem result = await apiManagementService.CreateOrUpdateContentItemAsync(contentTypeId, contentItemId);
|
||||
|
||||
Console.WriteLine($"Succeeded: {result}");
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-net/blob/Azure.ResourceManager.ApiManagement_1.3.0-beta.1/sdk/apimanagement/Azure.ResourceManager.ApiManagement/README.md"}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче